Search in sources :

Example 1 with DataObjectRestRep

use of com.emc.storageos.model.DataObjectRestRep in project coprhd-controller by CoprHD.

the class ObjectProvider method createBucketOptions.

protected static List<AssetOption> createBucketOptions(ViPRCoreClient client, URI project, URI hostId, Collection<? extends DataObjectRestRep> bucketObjects) {
    Map<URI, BucketRestRep> bucketNames = getProjectBucketNames(client, project);
    List<AssetOption> options = Lists.newArrayList();
    for (DataObjectRestRep bucketObject : bucketObjects) {
        options.add(createBucketOption(client, hostId, bucketObject, bucketNames));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) DataObjectRestRep(com.emc.storageos.model.DataObjectRestRep) BucketRestRep(com.emc.storageos.model.object.BucketRestRep) URI(java.net.URI)

Example 2 with DataObjectRestRep

use of com.emc.storageos.model.DataObjectRestRep in project coprhd-controller by CoprHD.

the class BaseAssetOptionsProvider method createBaseResourceOptions.

protected List<AssetOption> createBaseResourceOptions(Collection<? extends DataObjectRestRep> values) {
    List<AssetOption> options = Lists.newArrayList();
    for (DataObjectRestRep value : values) {
        options.add(createBaseResourceOption(value));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) DataObjectRestRep(com.emc.storageos.model.DataObjectRestRep)

Example 3 with DataObjectRestRep

use of com.emc.storageos.model.DataObjectRestRep in project coprhd-controller by CoprHD.

the class ViprResourceController method dataObjectOptions.

protected static List<StringOption> dataObjectOptions(Collection<? extends DataObjectRestRep> values, boolean sorted, boolean escaped) {
    List<StringOption> options = Lists.newArrayList();
    if (values != null) {
        for (DataObjectRestRep value : values) {
            String name = (escaped ? StringEscapeUtils.escapeHtml(name(value)) : name(value));
            options.add(new StringOption(stringId(value), name));
        }
    }
    if (sorted) {
        Collections.sort(options);
    }
    return options;
}
Also used : StringOption(util.StringOption) DataObjectRestRep(com.emc.storageos.model.DataObjectRestRep)

Example 4 with DataObjectRestRep

use of com.emc.storageos.model.DataObjectRestRep in project coprhd-controller by CoprHD.

the class TaskUtils method getWorkflowSteps.

@Util
public static List<WorkflowStep> getWorkflowSteps(URI workflowId) {
    List<WorkflowStepRestRep> workflowSteps = getViprClient().workflows().getSteps(workflowId);
    // Order Workflow steps by date started, not started tasks will sink to the bottom of the list
    Collections.sort(workflowSteps, new Comparator<WorkflowStepRestRep>() {

        @Override
        public int compare(WorkflowStepRestRep o1, WorkflowStepRestRep o2) {
            if (o1.getStartTime() == null && o2.getStartTime() == null) {
                // If both steps not started yet, then just order on creation time
                return o1.getCreationTime().compareTo(o2.getCreationTime());
            }
            if (o1.getStartTime() == null && o2.getStartTime() != null) {
                return 1;
            }
            if (o1.getStartTime() != null && o2.getStartTime() == null) {
                return -1;
            }
            return o1.getStartTime().compareTo(o2.getStartTime());
        }
    });
    // Get the names of all resources
    Map<String, DataObjectRestRep> systemObjects = Maps.newHashMap();
    for (WorkflowStepRestRep step : workflowSteps) {
        ResourceType type = ResourceType.fromResourceId(step.getSystem());
        DataObjectRestRep dataObject = null;
        switch(type) {
            case STORAGE_SYSTEM:
                dataObject = getViprClient().storageSystems().get(uri(step.getSystem()));
                break;
            case PROTECTION_SYSTEM:
                dataObject = getViprClient().protectionSystems().get(uri(step.getSystem()));
                break;
            case NETWORK_SYSTEM:
                dataObject = getViprClient().networkSystems().get(uri(step.getSystem()));
                break;
            case COMPUTE_SYSTEM:
                dataObject = getViprClient().computeSystems().get(uri(step.getSystem()));
                break;
        }
        if (dataObject != null) {
            systemObjects.put(step.getSystem(), dataObject);
        }
    }
    List<WorkflowStep> steps = Lists.newArrayList();
    for (WorkflowStepRestRep workflowStep : workflowSteps) {
        steps.add(new WorkflowStep(workflowStep, systemObjects));
    }
    return steps;
}
Also used : WorkflowStepRestRep(com.emc.storageos.model.workflow.WorkflowStepRestRep) DataObjectRestRep(com.emc.storageos.model.DataObjectRestRep) ResourceType(com.emc.sa.util.ResourceType) URIUtil(com.emc.storageos.db.client.URIUtil) Util(play.mvc.Util)

Example 5 with DataObjectRestRep

use of com.emc.storageos.model.DataObjectRestRep in project coprhd-controller by CoprHD.

the class CatalogApi method invokeByPath.

public static void invokeByPath(String sp1, String sp2, String sp3, String sp4, String sp5) {
    CatalogCategoryRestRep catalog = CatalogCategoryUtils.getRootCategory();
    DataObjectRestRep results = findCategoryOrService(catalog, sp1, sp2, sp3, sp4, sp5);
    if (results != null && results instanceof CatalogServiceRestRep) {
        CatalogServiceRestRep catalogService = (CatalogServiceRestRep) results;
        runCatalogService(catalogService.getId().toString());
    } else {
        notFound();
    }
}
Also used : DataObjectRestRep(com.emc.storageos.model.DataObjectRestRep) CatalogServiceRestRep(com.emc.vipr.model.catalog.CatalogServiceRestRep) CatalogCategoryRestRep(com.emc.vipr.model.catalog.CatalogCategoryRestRep)

Aggregations

DataObjectRestRep (com.emc.storageos.model.DataObjectRestRep)6 AssetOption (com.emc.vipr.model.catalog.AssetOption)2 CatalogCategoryRestRep (com.emc.vipr.model.catalog.CatalogCategoryRestRep)2 CatalogServiceRestRep (com.emc.vipr.model.catalog.CatalogServiceRestRep)2 ResourceType (com.emc.sa.util.ResourceType)1 URIUtil (com.emc.storageos.db.client.URIUtil)1 BucketRestRep (com.emc.storageos.model.object.BucketRestRep)1 WorkflowStepRestRep (com.emc.storageos.model.workflow.WorkflowStepRestRep)1 URI (java.net.URI)1 Util (play.mvc.Util)1 StringOption (util.StringOption)1