use of com.emc.storageos.model.varray.VirtualArrayBulkRep in project coprhd-controller by CoprHD.
the class VirtualArrayService method queryFilteredBulkResourceReps.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected VirtualArrayBulkRep queryFilteredBulkResourceReps(List<URI> ids) {
if (isSystemOrRestrictedSystemAdmin()) {
return queryBulkResourceReps(ids);
}
if (!ids.iterator().hasNext()) {
return new VirtualArrayBulkRep();
}
// get vdc id from the first id; assume all id's are from the same vdc
String shortVdcId = VdcUtil.getVdcId(getResourceClass(), ids.iterator().next()).toString();
Iterator<VirtualArray> dbIterator;
if (shortVdcId.equals(VdcUtil.getLocalShortVdcId())) {
dbIterator = _dbClient.queryIterativeObjects(getResourceClass(), ids);
} else {
GeoServiceClient geoClient = _geoHelper.getClient(shortVdcId);
try {
dbIterator = geoClient.queryObjects(getResourceClass(), ids);
} catch (Exception ex) {
// TODO: revisit this exception
_log.error("error retrieving bulk virtual arrays from vdc " + shortVdcId, ex);
throw APIException.internalServerErrors.genericApisvcError("error retrieving remote array", ex);
}
}
BulkList.ResourceFilter filter = new BulkList.VirtualArrayACLFilter(getUserFromContext(), _permissionsHelper);
return new VirtualArrayBulkRep(BulkList.wrapping(dbIterator, MapVirtualArray.getInstance(), filter));
}
use of com.emc.storageos.model.varray.VirtualArrayBulkRep in project coprhd-controller by CoprHD.
the class VirtualArrayService method queryBulkResourceReps.
@Override
public VirtualArrayBulkRep queryBulkResourceReps(List<URI> ids) {
if (!ids.iterator().hasNext()) {
return new VirtualArrayBulkRep();
}
// get vdc id from the first id; assume all id's are from the same vdc
String shortVdcId = VdcUtil.getVdcId(getResourceClass(), ids.iterator().next()).toString();
Iterator<VirtualArray> dbIterator;
if (shortVdcId.equals(VdcUtil.getLocalShortVdcId())) {
dbIterator = _dbClient.queryIterativeObjects(getResourceClass(), ids);
} else {
GeoServiceClient geoClient = _geoHelper.getClient(shortVdcId);
try {
dbIterator = geoClient.queryObjects(getResourceClass(), ids);
} catch (Exception ex) {
// TODO: revisit this exception
_log.error("error retrieving bulk virtual arrays from vdc " + shortVdcId, ex);
throw APIException.internalServerErrors.genericApisvcError("error retrieving remote array", ex);
}
}
return new VirtualArrayBulkRep(BulkList.wrapping(dbIterator, MapVirtualArray.getInstance()));
}
Aggregations