use of com.emc.storageos.model.workflow.WorkflowStepRestRep in project coprhd-controller by CoprHD.
the class WorkflowMapper method map.
public static WorkflowStepRestRep map(WorkflowStep from, List<URI> childWorkflows) {
if (from == null) {
return null;
}
WorkflowStepRestRep to = new WorkflowStepRestRep();
mapDataObjectFields(from, to);
to.setControllerName(from.getControllerName());
to.setDescription(from.getDescription());
to.setSystemType(from.getSystemType());
to.setExecuteMethod(from.getExecuteMethod());
to.setMessage(from.getMessage());
to.setState(from.getState());
to.setStepGroup(from.getStepGroup());
to.setStepId(from.getStepId());
to.setWaitFor(from.getWaitFor());
if (false == from.getSystemId().equals(URIUtil.NULL_URI)) {
to.setSystem(from.getSystemId().toString());
} else {
to.setSystem("");
}
to.setWorkflow(toRelatedResource(ResourceTypeEnum.WORKFLOW, from.getWorkflowId()));
to.setStartTime(from.getStartTime());
to.setEndTime(from.getEndTime());
for (URI childWorkflow : childWorkflows) {
to.getChildWorkflows().add(toRelatedResource(ResourceTypeEnum.WORKFLOW, childWorkflow));
}
return to;
}
use of com.emc.storageos.model.workflow.WorkflowStepRestRep 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.workflow.WorkflowStepRestRep in project coprhd-controller by CoprHD.
the class WorkflowMapper method map.
public static WorkflowStepRestRep map(WorkflowStep from) {
if (from == null) {
return null;
}
WorkflowStepRestRep to = new WorkflowStepRestRep();
mapDataObjectFields(from, to);
to.setControllerName(from.getControllerName());
to.setDescription(from.getDescription());
to.setSystemType(from.getSystemType());
to.setExecuteMethod(from.getExecuteMethod());
to.setMessage(from.getMessage());
to.setState(from.getState());
to.setStepGroup(from.getStepGroup());
to.setStepId(from.getStepId());
to.setWaitFor(from.getWaitFor());
to.setSystem(from.getSystemId().toString());
to.setWorkflow(toRelatedResource(ResourceTypeEnum.WORKFLOW, from.getWorkflowId()));
to.setStartTime(from.getStartTime());
to.setEndTime(from.getEndTime());
return to;
}
Aggregations