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);
}
}
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;
}
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);
}
Aggregations