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;
}
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;
}
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;
}
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;
}
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();
}
}
Aggregations