Search in sources :

Example 1 with CustomServicesWorkflowUpdateParam

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);
}
Also used : CustomServicesWorkflowDocument(com.emc.storageos.model.customservices.CustomServicesWorkflowDocument) CustomServicesWorkflowRestRep(com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep) CustomServicesWorkflowUpdateParam(com.emc.storageos.model.customservices.CustomServicesWorkflowUpdateParam)

Example 2 with CustomServicesWorkflowUpdateParam

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;
}
Also used : CustomServicesWorkflowDocument(com.emc.storageos.model.customservices.CustomServicesWorkflowDocument) CustomServicesWorkflowList(com.emc.storageos.model.customservices.CustomServicesWorkflowList) CustomServicesWorkflowRestRep(com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI) CustomServicesWorkflowUpdateParam(com.emc.storageos.model.customservices.CustomServicesWorkflowUpdateParam)

Example 3 with CustomServicesWorkflowUpdateParam

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");
    }
}
Also used : CustomServicesWorkflowRestRep(com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep) URI(java.net.URI) CustomServicesWorkflowUpdateParam(com.emc.storageos.model.customservices.CustomServicesWorkflowUpdateParam)

Aggregations

CustomServicesWorkflowRestRep (com.emc.storageos.model.customservices.CustomServicesWorkflowRestRep)3 CustomServicesWorkflowUpdateParam (com.emc.storageos.model.customservices.CustomServicesWorkflowUpdateParam)3 CustomServicesWorkflowDocument (com.emc.storageos.model.customservices.CustomServicesWorkflowDocument)2 URI (java.net.URI)2 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 CustomServicesWorkflowList (com.emc.storageos.model.customservices.CustomServicesWorkflowList)1