use of org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent in project kie-wb-common by kiegroup.
the class EndEventConverter method convert.
public BpmnNode convert(EndEvent event) {
ThrowEventPropertyReader p = propertyReaderFactory.of(event);
List<EventDefinition> eventDefinitions = p.getEventDefinitions();
switch(eventDefinitions.size()) {
case 0:
return endNoneEvent(event);
case 1:
return Match.of(EventDefinition.class, BpmnNode.class).when(TerminateEventDefinition.class, e -> terminateEndEvent(event, e)).when(SignalEventDefinition.class, e -> signalEventDefinition(event, e)).when(MessageEventDefinition.class, e -> messageEventDefinition(event, e)).when(ErrorEventDefinition.class, e -> errorEventDefinition(event, e)).missing(EscalationEventDefinition.class).missing(CompensateEventDefinition.class).missing(CancelEventDefinition.class).apply(eventDefinitions.get(0)).value();
default:
throw new UnsupportedOperationException("Multiple event definitions not supported for end event");
}
}
use of org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallEndNoneEvent.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallEndNoneEvent() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ENDNONEEVENT);
assertDiagram(diagram, 3);
assertEquals("endNoneEvent", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> endNoneEventNode = diagram.getGraph().getNode("_9DF2C9D3-15DF-4436-B6C6-85B58B8696B6");
EndNoneEvent endNoneEvent = (EndNoneEvent) endNoneEventNode.getContent().getDefinition();
assertNotNull(endNoneEvent.getGeneral());
assertEquals("MyEndNoneEvent", endNoneEvent.getGeneral().getName().getValue());
assertEquals("MyEndNoneEventDocumentation", endNoneEvent.getGeneral().getDocumentation().getValue());
}
use of org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent in project kie-wb-common by kiegroup.
the class EndEventConverter method endNoneEvent.
private BpmnNode endNoneEvent(EndEvent event) {
Node<View<EndNoneEvent>, Edge> node = factoryManager.newNode(event.getId(), EndNoneEvent.class);
EndNoneEvent definition = node.getContent().getDefinition();
EventPropertyReader p = propertyReaderFactory.of(event);
definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
node.getContent().setBounds(p.getBounds());
definition.setDimensionsSet(p.getCircleDimensionSet());
definition.setFontSet(p.getFontSet());
definition.setBackgroundSet(p.getBackgroundSet());
return BpmnNode.of(node);
}
use of org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent in project kie-wb-common by kiegroup.
the class ContextUtilsTest method testIsFormGenerationSupported.
@Test
public void testIsFormGenerationSupported() {
Assert.assertTrue(ContextUtils.isFormGenerationSupported(createNode(new UserTask())));
Assert.assertFalse(ContextUtils.isFormGenerationSupported(createNode(new ScriptTask())));
Assert.assertFalse(ContextUtils.isFormGenerationSupported(createNode(new BusinessRuleTask())));
Assert.assertFalse(ContextUtils.isFormGenerationSupported(createNode(new NoneTask())));
Assert.assertFalse(ContextUtils.isFormGenerationSupported(createNode(new StartNoneEvent())));
Assert.assertFalse(ContextUtils.isFormGenerationSupported(createNode(new EndNoneEvent())));
Assert.assertFalse(ContextUtils.isFormGenerationSupported(createNode(new ParallelGateway())));
}
use of org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallEndNoneEvent.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallEndNoneEvent() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ENDNONEEVENT);
assertDiagram(diagram, 3);
assertEquals("endNoneEvent", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> endNoneEventNode = diagram.getGraph().getNode("_9DF2C9D3-15DF-4436-B6C6-85B58B8696B6");
EndNoneEvent endNoneEvent = (EndNoneEvent) endNoneEventNode.getContent().getDefinition();
assertNotNull(endNoneEvent.getGeneral());
assertEquals("MyEndNoneEvent", endNoneEvent.getGeneral().getName().getValue());
assertEquals("MyEndNoneEventDocumentation", endNoneEvent.getGeneral().getDocumentation().getValue());
}
Aggregations