Search in sources :

Example 1 with ValidationResult

use of io.zeebe.model.bpmn.ValidationResult in project zeebe by zeebe-io.

the class DeploymentCreateProcessor method readAndValidateWorkflowsOfResource.

private boolean readAndValidateWorkflowsOfResource(final DeploymentResource deploymentResource, final DirectBuffer topicName, final StringBuilder validationErrors) {
    final WorkflowDefinition definition = readWorkflowDefinition(deploymentResource);
    final ValidationResult validationResult = bpmn.validate(definition);
    final boolean isValid = !validationResult.hasErrors();
    if (isValid) {
        assignVersionToWorkflows(deploymentResourceIterator, topicName, definition);
        transformWorkflowResource(deploymentResource, definition);
    }
    if (validationResult.hasErrors() || validationResult.hasWarnings()) {
        validationErrors.append(String.format("Resource '%s':\n", bufferAsString(deploymentResource.getResourceName())));
        validationErrors.append(validationResult.format());
    }
    return isValid;
}
Also used : WorkflowDefinition(io.zeebe.model.bpmn.instance.WorkflowDefinition) ValidationResult(io.zeebe.model.bpmn.ValidationResult)

Aggregations

ValidationResult (io.zeebe.model.bpmn.ValidationResult)1 WorkflowDefinition (io.zeebe.model.bpmn.instance.WorkflowDefinition)1