Search in sources :

Example 1 with ValidationHelper

use of com.emc.sa.workflow.ValidationHelper in project coprhd-controller by CoprHD.

the class CustomServicesWorkflowService method validateWorkflow.

@POST
@CheckPermission(roles = { Role.SYSTEM_ADMIN })
@Path("/{id}/validate")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public CustomServicesValidationResponse validateWorkflow(@PathParam("id") final URI id) {
    try {
        final CustomServicesWorkflowDocument wfDocument = WorkflowHelper.toWorkflowDocument(getCustomServicesWorkflow(id));
        final ValidationHelper customServicesValidationHelper = new ValidationHelper(wfDocument);
        final CustomServicesValidationResponse validationResponse = customServicesValidationHelper.validate(id, client);
        // update the status of workflow VALID / INVALID in the DB
        final CustomServicesWorkflow wfstatusUpdated = WorkflowHelper.updateState(getCustomServicesWorkflow(id), validationResponse.getStatus());
        customServicesWorkflowManager.save(wfstatusUpdated);
        return validationResponse;
    } catch (final IOException e) {
        throw APIException.internalServerErrors.genericApisvcError("Failed to deserialize workflow document", e);
    }
}
Also used : ValidationHelper(com.emc.sa.workflow.ValidationHelper) CustomServicesWorkflowDocument(com.emc.storageos.model.customservices.CustomServicesWorkflowDocument) CustomServicesWorkflow(com.emc.storageos.db.client.model.uimodels.CustomServicesWorkflow) CustomServicesValidationResponse(com.emc.storageos.model.customservices.CustomServicesValidationResponse) IOException(java.io.IOException) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

ValidationHelper (com.emc.sa.workflow.ValidationHelper)1 CustomServicesWorkflow (com.emc.storageos.db.client.model.uimodels.CustomServicesWorkflow)1 CustomServicesValidationResponse (com.emc.storageos.model.customservices.CustomServicesValidationResponse)1 CustomServicesWorkflowDocument (com.emc.storageos.model.customservices.CustomServicesWorkflowDocument)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 IOException (java.io.IOException)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1