Search in sources :

Example 86 with Process

use of org.eclipse.bpmn2.Process in project kie-wb-common by kiegroup.

the class BPMFinderServiceImpl method getModelForProcess.

@Override
public JBPMProcessModel getModelForProcess(final String processId, final Path path) {
    GenerationConfig<Optional<JBPMProcessModel>> operations = new GenerationConfig<>(Optional.empty());
    operations.setPredicate(definitions -> {
        if (definitions.isPresent()) {
            if (!operations.getValue().isPresent()) {
                Optional<Process> optional = Optional.of(bpmnFormModelGenerator.getProcess(definitions.get()));
                return optional.isPresent() && optional.get().getId().equals(processId);
            }
        }
        return false;
    });
    operations.setConsumer(processModel -> operations.setValue(Optional.ofNullable(processModel)));
    Path rootPath = moduleService.resolveModule(path).getRootPath();
    scannProcessesForType(rootPath, "bpmn2", operations);
    if (!operations.getValue().isPresent()) {
        scannProcessesForType(rootPath, "bpmn", operations);
    }
    return operations.getValue().orElse(null);
}
Also used : Path(org.uberfire.backend.vfs.Path) Optional(java.util.Optional) Process(org.eclipse.bpmn2.Process)

Aggregations

Process (org.eclipse.bpmn2.Process)54 SubProcess (org.eclipse.bpmn2.SubProcess)36 RootElement (org.eclipse.bpmn2.RootElement)34 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)31 ArrayList (java.util.ArrayList)25 FlowElement (org.eclipse.bpmn2.FlowElement)21 Definitions (org.eclipse.bpmn2.Definitions)20 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)16 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)15 Test (org.junit.Test)15 List (java.util.List)14 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)14 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)14 Entry (java.util.Map.Entry)12 DataInput (org.eclipse.bpmn2.DataInput)12 DataObject (org.eclipse.bpmn2.DataObject)12 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)12 Graph (org.kie.workbench.common.stunner.core.graph.Graph)12 Artifact (org.eclipse.bpmn2.Artifact)11 DataOutput (org.eclipse.bpmn2.DataOutput)11