Search in sources :

Example 6 with ResourceType

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;
}
Also used : ArrayList(java.util.ArrayList) ResourceType(com.emc.sa.util.ResourceType) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep) URI(java.net.URI)

Example 7 with ResourceType

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;
}
Also used : ResourceType(com.emc.sa.util.ResourceType) URIUtil(com.emc.storageos.db.client.URIUtil) Util(play.mvc.Util)

Aggregations

ResourceType (com.emc.sa.util.ResourceType)7 URI (java.net.URI)3 ArrayList (java.util.ArrayList)3 URIUtil (com.emc.storageos.db.client.URIUtil)2 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)2 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)2 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)2 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)2 Util (play.mvc.Util)2 Asset (com.emc.sa.asset.annotation.Asset)1 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)1 DataObjectRestRep (com.emc.storageos.model.DataObjectRestRep)1 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)1 ExportBlockParam (com.emc.storageos.model.block.export.ExportBlockParam)1 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)1 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)1 WorkflowStepRestRep (com.emc.storageos.model.workflow.WorkflowStepRestRep)1 AssetOption (com.emc.vipr.model.catalog.AssetOption)1 TaskLogsDataTable (models.datatable.TaskLogsDataTable)1