Search in sources :

Example 1 with EndNoneEvent

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");
    }
}
Also used : EventDefinition(org.eclipse.bpmn2.EventDefinition) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) EndErrorEvent(org.kie.workbench.common.stunner.bpmn.definition.EndErrorEvent) Edge(org.kie.workbench.common.stunner.core.graph.Edge) BpmnNode(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode) MessageRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) ErrorRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.error.ErrorRef) MessageEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageEventExecutionSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) TypedFactoryManager(org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager) EndEvent(org.eclipse.bpmn2.EndEvent) EndTerminateEvent(org.kie.workbench.common.stunner.bpmn.definition.EndTerminateEvent) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) EndMessageEvent(org.kie.workbench.common.stunner.bpmn.definition.EndMessageEvent) EventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader) EndSignalEvent(org.kie.workbench.common.stunner.bpmn.definition.EndSignalEvent) PropertyReaderFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.PropertyReaderFactory) SignalScope(org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.SignalScope) List(java.util.List) SignalRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.SignalRef) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) Match(org.kie.workbench.common.stunner.bpmn.backend.converters.Match) ScopedSignalEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.ScopedSignalEventExecutionSet) ThrowEventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader) TerminateEventDefinition(org.eclipse.bpmn2.TerminateEventDefinition) CancelEventDefinition(org.eclipse.bpmn2.CancelEventDefinition) Node(org.kie.workbench.common.stunner.core.graph.Node) EndNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent) DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) ErrorEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.error.ErrorEventExecutionSet) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) BpmnNode(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode) ThrowEventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader) EventDefinition(org.eclipse.bpmn2.EventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) TerminateEventDefinition(org.eclipse.bpmn2.TerminateEventDefinition) CancelEventDefinition(org.eclipse.bpmn2.CancelEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition)

Example 2 with EndNoneEvent

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());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) EndNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent) Test(org.junit.Test)

Example 3 with EndNoneEvent

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);
}
Also used : Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) EndNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) EventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader) ThrowEventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)

Example 4 with EndNoneEvent

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())));
}
Also used : ScriptTask(org.kie.workbench.common.stunner.bpmn.definition.ScriptTask) NoneTask(org.kie.workbench.common.stunner.bpmn.definition.NoneTask) ParallelGateway(org.kie.workbench.common.stunner.bpmn.definition.ParallelGateway) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) BusinessRuleTask(org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask) EndNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent) StartNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent) Test(org.junit.Test)

Example 5 with EndNoneEvent

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());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) EndNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent) Test(org.junit.Test)

Aggregations

EndNoneEvent (org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent)5 Test (org.junit.Test)3 EventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader)2 ThrowEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader)2 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)2 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)2 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)2 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)2 Edge (org.kie.workbench.common.stunner.core.graph.Edge)2 Graph (org.kie.workbench.common.stunner.core.graph.Graph)2 View (org.kie.workbench.common.stunner.core.graph.content.view.View)2 List (java.util.List)1 CancelEventDefinition (org.eclipse.bpmn2.CancelEventDefinition)1 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)1 EndEvent (org.eclipse.bpmn2.EndEvent)1 ErrorEventDefinition (org.eclipse.bpmn2.ErrorEventDefinition)1 EscalationEventDefinition (org.eclipse.bpmn2.EscalationEventDefinition)1 EventDefinition (org.eclipse.bpmn2.EventDefinition)1 MessageEventDefinition (org.eclipse.bpmn2.MessageEventDefinition)1 SignalEventDefinition (org.eclipse.bpmn2.SignalEventDefinition)1