Java Code Examples for org.flowable.bpmn.model.Process#isExecutable()

The following examples show how to use org.flowable.bpmn.model.Process#isExecutable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BpmnModelValidator.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Override
public void validate(BpmnModel bpmnModel, List<ValidationError> errors) {

    // If all process definitions of this bpmnModel are not executable, raise an error
    boolean isAtLeastOneExecutable = validateAtLeastOneExecutable(bpmnModel, errors);

    // If at least one process definition is executable, show a warning for each of the none-executables
    if (isAtLeastOneExecutable) {
        for (Process process : bpmnModel.getProcesses()) {
            if (!process.isExecutable()) {
                addWarning(errors, Problems.PROCESS_DEFINITION_NOT_EXECUTABLE, process, process,
                        "Process definition is not executable. Please verify that this is intentional.");
            }
            handleProcessConstraints(bpmnModel, process, errors);
        }
    }
    handleBPMNModelConstraints(bpmnModel, errors);
}
 
Example 2
Source File: BpmnModelValidator.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
/**
 * Returns 'true' if at least one process definition in the {@link BpmnModel} is executable.
 */
protected boolean validateAtLeastOneExecutable(BpmnModel bpmnModel, List<ValidationError> errors) {
    int nrOfExecutableDefinitions = 0;
    for (Process process : bpmnModel.getProcesses()) {
        if (process.isExecutable()) {
            nrOfExecutableDefinitions++;
        }
    }

    if (nrOfExecutableDefinitions == 0) {
        addError(errors, Problems.ALL_PROCESS_DEFINITIONS_NOT_EXECUTABLE,
                "All process definition are set to be non-executable (property 'isExecutable' on process). This is not allowed.");
    }

    return nrOfExecutableDefinitions > 0;
}
 
Example 3
Source File: ProcessParseHandler.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
protected void executeParse(BpmnParse bpmnParse, Process process) {
    if (!process.isExecutable()) {
        LOGGER.info("Ignoring non-executable process with id='{}'. Set the attribute isExecutable=\"true\" to deploy this process.", process.getId());
    } else {
        bpmnParse.getProcessDefinitions().add(transformProcess(bpmnParse, process));
    }
}
 
Example 4
Source File: BpmnParse.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
/**
 * Parses the 'definitions' root element
 */
protected void applyParseHandlers() {
    sequenceFlows = new HashMap<>();
    for (Process process : bpmnModel.getProcesses()) {
        currentProcess = process;
        if (process.isExecutable()) {
            bpmnParserHandlers.parseElement(this, process);
        }
    }
}
 
Example 5
Source File: ProcessParseHandler.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
protected void executeParse(BpmnParse bpmnParse, Process process) {
    if (!process.isExecutable()) {
        LOGGER.info("Ignoring non-executable process with id='{}'. Set the attribute isExecutable=\"true\" to deploy this process.", process.getId());
    } else {
        bpmnParse.getProcessDefinitions().add(transformProcess(bpmnParse, process));
    }
}
 
Example 6
Source File: BpmnParse.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
/**
 * Parses the 'definitions' root element
 */
protected void transformProcessDefinitions() {
    sequenceFlows = new HashMap<>();
    for (Process process : bpmnModel.getProcesses()) {
        if (process.isExecutable()) {
            bpmnParserHandlers.parseElement(this, process);
        }
    }

    if (!processDefinitions.isEmpty()) {
        processDI();
    }
}