use of com.emc.storageos.model.customservices.CustomServicesWorkflowUpdateParam in project coprhd-controller by CoprHD.
the class WorkflowBuilder method saveWorkflow.
public static void saveWorkflow(final URI workflowId, final CustomServicesWorkflowDocument workflowDoc) {
final CustomServicesWorkflowUpdateParam param = new CustomServicesWorkflowUpdateParam();
for (final CustomServicesWorkflowDocument.Step step : workflowDoc.getSteps()) {
final String success_criteria = ESAPI.encoder().decodeForHTML(step.getSuccessCriteria());
step.setSuccessCriteria(success_criteria);
// If this workflow has any ansible steps add host_file input
addInventoryFileInputs(step);
}
param.setDocument(workflowDoc);
final CustomServicesWorkflowRestRep customServicesWorkflowRestRep = getCatalogClient().customServicesPrimitives().editWorkflow(workflowId, param);
}
use of com.emc.storageos.model.customservices.CustomServicesWorkflowUpdateParam in project coprhd-controller by CoprHD.
the class WorkflowBuilder method updateWorkflowInventoryFiles.
private static boolean updateWorkflowInventoryFiles(final String localAnsiblePrimitiveId) {
boolean updatedWorkflows = false;
final CustomServicesWorkflowList customServicesWorkflowList = getCatalogClient().customServicesPrimitives().getWorkflows(localAnsiblePrimitiveId);
if (customServicesWorkflowList != null && CollectionUtils.isNotEmpty(customServicesWorkflowList.getWorkflows())) {
for (final NamedRelatedResourceRep resourceRep : customServicesWorkflowList.getWorkflows()) {
final URI workflowId = resourceRep.getId();
final CustomServicesWorkflowRestRep customServicesWorkflowRestRep = getCatalogClient().customServicesPrimitives().getWorkflow(workflowId);
if (null != customServicesWorkflowRestRep) {
Logger.info("Updating workflow {} with new host inventory files", workflowId);
final CustomServicesWorkflowUpdateParam param = new CustomServicesWorkflowUpdateParam();
for (final CustomServicesWorkflowDocument.Step step : customServicesWorkflowRestRep.getDocument().getSteps()) {
addInventoryFileInputs(step);
}
param.setDocument(customServicesWorkflowRestRep.getDocument());
getCatalogClient().customServicesPrimitives().editWorkflow(workflowId, param);
updatedWorkflows = true;
}
}
}
return updatedWorkflows;
}
use of com.emc.storageos.model.customservices.CustomServicesWorkflowUpdateParam in project coprhd-controller by CoprHD.
the class WorkflowBuilder method editWorkflowName.
public static void editWorkflowName(final String id, final String newName) throws URISyntaxException {
URI workflowURI = new URI(id);
CustomServicesWorkflowRestRep customServicesWorkflowRestRep = getCatalogClient().customServicesPrimitives().getWorkflow(workflowURI);
if (null != customServicesWorkflowRestRep) {
final CustomServicesWorkflowUpdateParam param = new CustomServicesWorkflowUpdateParam();
param.setDocument(customServicesWorkflowRestRep.getDocument());
param.getDocument().setName(newName);
getCatalogClient().customServicesPrimitives().editWorkflow(workflowURI, param);
} else {
flash.error("Workflow " + id + "not found");
}
}
Aggregations