Search in sources :

Example 1 with DomainDetails

use of org.apache.cloudstack.api.ApiConstants.DomainDetails in project cloudstack by apache.

the class ListAccountsCmd method getDetails.

public EnumSet<DomainDetails> getDetails() throws InvalidParameterValueException {
    EnumSet<DomainDetails> dv;
    if (viewDetails == null || viewDetails.size() <= 0) {
        dv = EnumSet.of(DomainDetails.all);
    } else {
        try {
            ArrayList<DomainDetails> dc = new ArrayList<DomainDetails>();
            for (String detail : viewDetails) {
                dc.add(DomainDetails.valueOf(detail));
            }
            dv = EnumSet.copyOf(dc);
        } catch (IllegalArgumentException e) {
            throw new InvalidParameterValueException("The details parameter contains a non permitted value. The allowed values are " + EnumSet.allOf(DomainDetails.class));
        }
    }
    return dv;
}
Also used : DomainDetails(org.apache.cloudstack.api.ApiConstants.DomainDetails) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) ArrayList(java.util.ArrayList)

Example 2 with DomainDetails

use of org.apache.cloudstack.api.ApiConstants.DomainDetails in project cloudstack by apache.

the class ListProjectsCmd method getDetails.

public EnumSet<DomainDetails> getDetails() throws InvalidParameterValueException {
    EnumSet<DomainDetails> dv;
    if (viewDetails == null || viewDetails.size() <= 0) {
        dv = EnumSet.of(DomainDetails.all);
    } else {
        try {
            ArrayList<DomainDetails> dc = new ArrayList<DomainDetails>();
            for (String detail : viewDetails) {
                dc.add(DomainDetails.valueOf(detail));
            }
            dv = EnumSet.copyOf(dc);
        } catch (IllegalArgumentException e) {
            throw new InvalidParameterValueException("The details parameter contains a non permitted value. The allowed values are " + EnumSet.allOf(DomainDetails.class));
        }
    }
    return dv;
}
Also used : DomainDetails(org.apache.cloudstack.api.ApiConstants.DomainDetails) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) ArrayList(java.util.ArrayList)

Example 3 with DomainDetails

use of org.apache.cloudstack.api.ApiConstants.DomainDetails in project cloudstack by apache.

the class ListDomainsCmd method getDetails.

public EnumSet<DomainDetails> getDetails() throws InvalidParameterValueException {
    EnumSet<DomainDetails> dv;
    if (viewDetails == null || viewDetails.size() <= 0) {
        dv = EnumSet.of(DomainDetails.all);
    } else {
        try {
            ArrayList<DomainDetails> dc = new ArrayList<DomainDetails>();
            for (String detail : viewDetails) {
                dc.add(DomainDetails.valueOf(detail));
            }
            dv = EnumSet.copyOf(dc);
        } catch (IllegalArgumentException e) {
            throw new InvalidParameterValueException("The details parameter contains a non permitted value. The allowed values are " + EnumSet.allOf(DomainDetails.class));
        }
    }
    return dv;
}
Also used : DomainDetails(org.apache.cloudstack.api.ApiConstants.DomainDetails) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) ArrayList(java.util.ArrayList)

Aggregations

InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)3 ArrayList (java.util.ArrayList)3 DomainDetails (org.apache.cloudstack.api.ApiConstants.DomainDetails)3