use of com.emc.sa.util.ResourceType in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getBlockResources.
/**
* Retrieve a list of block resources based on the resource ids provided. This will gather
* the appropriate resources based on the resource type of the ids provided.
*
* @param resourceIds of the resources to retrieve.
* @param parentId of a continuous copy. This will be null for all other resource types.
* @return list of block resources
*/
public static List<BlockObjectRestRep> getBlockResources(List<URI> resourceIds, URI parentId) {
List<BlockObjectRestRep> blockResources = Lists.newArrayList();
List<URI> blockVolumes = new ArrayList<URI>();
List<URI> blockSnapshots = new ArrayList<URI>();
List<URI> blockContinuousCopies = new ArrayList<URI>();
for (URI resourceId : resourceIds) {
ResourceType volumeType = ResourceType.fromResourceId(resourceId.toString());
switch(volumeType) {
case VOLUME:
blockVolumes.add(resourceId);
break;
case BLOCK_SNAPSHOT:
blockSnapshots.add(resourceId);
break;
case BLOCK_CONTINUOUS_COPY:
blockContinuousCopies.add(resourceId);
break;
default:
break;
}
}
if (!blockVolumes.isEmpty()) {
blockResources.addAll(getVolumes(blockVolumes));
}
if (!blockSnapshots.isEmpty()) {
blockResources.addAll(getBlockSnapshots(blockSnapshots));
}
if (!blockContinuousCopies.isEmpty()) {
blockResources.addAll(getBlockContinuousCopies(blockContinuousCopies, parentId));
}
return blockResources;
}
use of com.emc.sa.util.ResourceType in project coprhd-controller by CoprHD.
the class TaskUtils method getTaskSummary.
@Util
public static TaskSummary getTaskSummary(TaskResourceRep task) {
TaskSummary taskSummary = new TaskSummary(task);
if (task != null && task.getResource() != null && task.getResource().getId() != null) {
ResourceType resourceType = ResourceType.fromResourceId(task.getResource().getId().toString());
taskSummary.resourceType = resourceType.name();
}
taskSummary.orderId = TagUtils.getOrderIdTagValue(task);
taskSummary.orderNumber = TagUtils.getOrderNumberTagValue(task);
if (Security.isSystemAdmin() || Security.isSystemMonitor()) {
if (task.getWorkflow() != null && task.getWorkflow().getId() != null) {
taskSummary.steps = getWorkflowSteps(task.getWorkflow().getId());
}
}
return taskSummary;
}
Aggregations