Search in sources :

Example 1 with ValidationException

use of org.kie.kogito.process.validation.ValidationException in project kogito-runtimes by kiegroup.

the class ConnectionImpl method connect.

public void connect() {
    try {
        ((Node) this.from).addOutgoingConnection(fromType, this);
        ((Node) this.to).addIncomingConnection(toType, this);
    } catch (Exception exception) {
        throw new ValidationException(null, exception.getMessage());
    }
}
Also used : ValidationException(org.kie.kogito.process.validation.ValidationException) Node(org.jbpm.workflow.core.Node) ValidationException(org.kie.kogito.process.validation.ValidationException)

Example 2 with ValidationException

use of org.kie.kogito.process.validation.ValidationException in project kogito-runtimes by kiegroup.

the class ProcessValidator method validate.

default void validate(Process process) throws ValidationException {
    final ProcessValidationError[] errors = validateProcess(process);
    Optional.ofNullable(errors).filter(e -> e.length == 0).orElseThrow(() -> new ValidationException(process.getId(), Arrays.asList(errors)));
}
Also used : Resource(org.kie.api.io.Resource) Arrays(java.util.Arrays) Process(org.kie.api.definition.process.Process) Optional(java.util.Optional) ValidationException(org.kie.kogito.process.validation.ValidationException) ValidationException(org.kie.kogito.process.validation.ValidationException)

Aggregations

ValidationException (org.kie.kogito.process.validation.ValidationException)2 Arrays (java.util.Arrays)1 Optional (java.util.Optional)1 Node (org.jbpm.workflow.core.Node)1 Process (org.kie.api.definition.process.Process)1 Resource (org.kie.api.io.Resource)1