use of org.jbpm.process.core.validation.ProcessValidationError in project jbpm by kiegroup.
the class RuleFlowProcessValidator method validateProcess.
public ProcessValidationError[] validateProcess(final RuleFlowProcess process) {
final List<ProcessValidationError> errors = new ArrayList<ProcessValidationError>();
if (process.getName() == null) {
errors.add(new ProcessValidationErrorImpl(process, "Process has no name."));
}
if (process.getId() == null || "".equals(process.getId())) {
errors.add(new ProcessValidationErrorImpl(process, "Process has no id."));
}
// check start node of process
if (process.getStartNodes().isEmpty() && !process.isDynamic()) {
errors.add(new ProcessValidationErrorImpl(process, "Process has no start node."));
}
// Check end node of the process.
if (process.getEndNodes().isEmpty() && !process.isDynamic()) {
errors.add(new ProcessValidationErrorImpl(process, "Process has no end node."));
}
validateNodes(process.getNodes(), errors, process);
validateVariables(errors, process);
checkAllNodesConnectedToStart(process, process.isDynamic(), errors, process);
return errors.toArray(new ProcessValidationError[errors.size()]);
}
use of org.jbpm.process.core.validation.ProcessValidationError in project jbpm by kiegroup.
the class RuleFlowProcessValidatorTest method testEmptyPackageName.
@Test
public void testEmptyPackageName() throws Exception {
RuleFlowProcess process = new RuleFlowProcess();
process.setId("org.drools.core.process");
process.setName("Empty Package Name Process");
process.setPackageName("");
process.setDynamic(true);
ProcessValidationError[] errors = validator.validateProcess(process);
assertNotNull(errors);
assertEquals(0, errors.length);
}
Aggregations