Search in sources :

Example 1 with CustomServicesValidationResponse

use of com.emc.storageos.model.customservices.CustomServicesValidationResponse 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)

Example 2 with CustomServicesValidationResponse

use of com.emc.storageos.model.customservices.CustomServicesValidationResponse in project coprhd-controller by CoprHD.

the class ValidationHelper method validate.

public CustomServicesValidationResponse validate(final URI id, final ModelClient client) {
    final CustomServicesValidationResponse validationResponse = new CustomServicesValidationResponse();
    validationResponse.setId(id);
    final CustomServicesValidationResponse.Error error = validateSteps(client);
    if (StringUtils.isNotBlank(error.getErrorMessage()) || MapUtils.isNotEmpty(error.getErrorSteps())) {
        validationResponse.setError(error);
        validationResponse.setStatus(CustomServicesWorkflow.CustomServicesWorkflowStatus.INVALID.toString());
    } else {
        validationResponse.setStatus(CustomServicesWorkflow.CustomServicesWorkflowStatus.VALID.toString());
    }
    logger.debug("CustomService workflow validation response is {}", validationResponse);
    return validationResponse;
}
Also used : CustomServicesValidationResponse(com.emc.storageos.model.customservices.CustomServicesValidationResponse)

Example 3 with CustomServicesValidationResponse

use of com.emc.storageos.model.customservices.CustomServicesValidationResponse in project coprhd-controller by CoprHD.

the class WorkflowBuilder method validateWorkflow.

public static void validateWorkflow(final URI workflowId) {
    CustomServicesValidationResponse customServicesWorkflowValidationResponse = getCatalogClient().customServicesPrimitives().validateWorkflow(workflowId);
    renderJSON(customServicesWorkflowValidationResponse);
}
Also used : CustomServicesValidationResponse(com.emc.storageos.model.customservices.CustomServicesValidationResponse)

Aggregations

CustomServicesValidationResponse (com.emc.storageos.model.customservices.CustomServicesValidationResponse)3 ValidationHelper (com.emc.sa.workflow.ValidationHelper)1 CustomServicesWorkflow (com.emc.storageos.db.client.model.uimodels.CustomServicesWorkflow)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