use of org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode in project kie-wb-common by kiegroup.
the class IntermediateCatchEventConverter method convertBoundaryEvent.
public BpmnNode convertBoundaryEvent(BoundaryEvent event) {
CatchEventPropertyReader p = propertyReaderFactory.of(event);
List<EventDefinition> eventDefinitions = p.getEventDefinitions();
switch(eventDefinitions.size()) {
case 0:
throw new UnsupportedOperationException("A boundary event should contain exactly one definition");
case 1:
return Match.of(EventDefinition.class, BpmnNode.class).when(SignalEventDefinition.class, e -> signalEvent(event, e)).when(TimerEventDefinition.class, e -> timerEvent(event, e)).when(MessageEventDefinition.class, e -> messageEvent(event, e)).when(ErrorEventDefinition.class, e -> errorEvent(event, e)).missing(EscalationEventDefinition.class).missing(CompensateEventDefinition.class).missing(ConditionalEventDefinition.class).apply(eventDefinitions.get(0)).value();
default:
throw new UnsupportedOperationException("Multiple definitions not supported for boundary event");
}
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode in project kie-wb-common by kiegroup.
the class StartEventConverter method convert.
public BpmnNode convert(StartEvent event) {
CatchEventPropertyReader p = propertyReaderFactory.of(event);
List<EventDefinition> eventDefinitions = p.getEventDefinitions();
switch(eventDefinitions.size()) {
case 0:
return noneEvent(event);
case 1:
return Match.of(EventDefinition.class, BpmnNode.class).when(SignalEventDefinition.class, e -> signalEvent(event, e)).when(MessageEventDefinition.class, e -> messageEvent(event, e)).when(TimerEventDefinition.class, e -> timerEvent(event, e)).when(ErrorEventDefinition.class, e -> errorEvent(event, e)).missing(ConditionalEventDefinition.class).missing(EscalationEventDefinition.class).missing(CompensateEventDefinition.class).apply(eventDefinitions.get(0)).value();
default:
throw new UnsupportedOperationException("Multiple event definitions not supported for start event");
}
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode in project kie-wb-common by kiegroup.
the class AbstractProcessConverter method convertLaneSets.
private void convertLaneSets(List<LaneSet> laneSets, Map<String, BpmnNode> freeFloatingNodes, BpmnNode firstDiagramNode) {
laneSets.stream().flatMap(laneSet -> laneSet.getLanes().stream()).forEach(lane -> {
BpmnNode laneNode = converterFactory.laneConverter().convert(lane);
laneNode.setParent(firstDiagramNode);
lane.getFlowNodeRefs().forEach(node -> {
freeFloatingNodes.get(node.getId()).setParent(laneNode);
});
});
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode in project kie-wb-common by kiegroup.
the class RootProcessConverter method convertProcess.
public BpmnNode convertProcess() {
Process process = definitionResolver.getProcess();
String definitionsId = definitionResolver.getDefinitions().getId();
BpmnNode processRoot = convertProcessNode(definitionsId, process);
Map<String, BpmnNode> nodes = super.convertChildNodes(processRoot, process.getFlowElements(), process.getLaneSets());
super.convertEdges(processRoot, process.getFlowElements(), nodes);
return processRoot;
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshaller method unmarshall.
@Override
public Graph<DefinitionSet, Node> unmarshall(final Metadata metadata, final InputStream inputStream) throws IOException {
LOG.debug("Starting diagram unmarshalling...");
// definition resolver provides utlities to access elements of the BPMN datamodel
DefinitionResolver definitionResolver = new DefinitionResolver(parseDefinitions(inputStream));
metadata.setCanvasRootUUID(definitionResolver.getDefinitions().getId());
metadata.setTitle(definitionResolver.getProcess().getName());
ConverterFactory converterFactory = new ConverterFactory(definitionResolver, typedFactoryManager);
// perform actual conversion. Process is the root of the diagram
BpmnNode diagramRoot = converterFactory.rootProcessConverter().convertProcess();
LOG.debug("Diagram unmarshalling completed successfully.");
// the root node contains all of the information
// needed to build the entire graph (including parent/child relationships)
// thus, we can now walk the graph to issue all the commands
// to draw it on our canvas
Diagram<Graph<DefinitionSet, Node>, Metadata> diagram = typedFactoryManager.newDiagram(definitionResolver.getDefinitions().getId(), BPMNDefinitionSet.class, metadata);
GraphBuilder graphBuilder = new GraphBuilder(diagram.getGraph(), definitionManager, typedFactoryManager, ruleManager, commandFactory, commandManager);
graphBuilder.render(diagramRoot);
LOG.debug("Diagram drawing completed successfully.");
return diagram.getGraph();
}
Aggregations