use of com.emc.storageos.model.vpool.ManagedResourcesCapacity.CapacityResourceType in project coprhd-controller by CoprHD.
the class CapacityService method getCapacityDataResource.
private ManagedResourcesCapacity getCapacityDataResource() throws Exception {
ManagedResourcesCapacity capacities = new ManagedResourcesCapacity();
for (CapacityResourceType capType : CapacityResourceType.values()) {
ManagedCapacityImpl.CapacityPropertyListTypes resourceType = ManagedCapacityImpl.mapCapacityType(capType);
List<URI> dataResourcesURI = _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getConstraint(PropertyListDataObject.class, "resourceType", resourceType.toString()));
if (dataResourcesURI.isEmpty()) {
_log.warn("Failed to find capacity of type {} in the database, recompute", resourceType);
throw new Exception("Failed to find capacity in the database");
}
PropertyListDataObject resource = _dbClient.queryObject(PropertyListDataObject.class, dataResourcesURI.get(0));
ManagedResourceCapacity mCap = map(resource, ManagedResourceCapacity.class);
capacities.getResourceCapacityList().add(mCap);
}
return capacities;
}
Aggregations