Search in sources :

Example 1 with EndEvent

use of org.eclipse.bpmn2.EndEvent 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 EndEvent

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

the class EndEventConverter method noneEvent.

private PropertyWriter noneEvent(Node<View<EndNoneEvent>, ?> n) {
    EndEvent event = bpmn2.createEndEvent();
    event.setId(n.getUUID());
    BaseEndEvent definition = n.getContent().getDefinition();
    ThrowEventPropertyWriter p = propertyWriterFactory.of(event);
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    p.setBounds(n.getContent().getBounds());
    return p;
}
Also used : BaseEndEvent(org.kie.workbench.common.stunner.bpmn.definition.BaseEndEvent) BaseEndEvent(org.kie.workbench.common.stunner.bpmn.definition.BaseEndEvent) EndEvent(org.eclipse.bpmn2.EndEvent) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) ThrowEventPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ThrowEventPropertyWriter)

Example 3 with EndEvent

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

the class EndEventConverter method terminateEvent.

private PropertyWriter terminateEvent(Node<View<EndTerminateEvent>, ?> n) {
    EndEvent event = bpmn2.createEndEvent();
    event.setId(n.getUUID());
    EndTerminateEvent definition = n.getContent().getDefinition();
    ThrowEventPropertyWriter p = propertyWriterFactory.of(event);
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    p.addTerminate();
    p.setBounds(n.getContent().getBounds());
    return p;
}
Also used : BaseEndEvent(org.kie.workbench.common.stunner.bpmn.definition.BaseEndEvent) EndEvent(org.eclipse.bpmn2.EndEvent) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) EndTerminateEvent(org.kie.workbench.common.stunner.bpmn.definition.EndTerminateEvent) ThrowEventPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ThrowEventPropertyWriter)

Example 4 with EndEvent

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

the class EndEventConverter method errorEvent.

private PropertyWriter errorEvent(Node<View<EndErrorEvent>, ?> n) {
    EndEvent event = bpmn2.createEndEvent();
    event.setId(n.getUUID());
    EndErrorEvent definition = n.getContent().getDefinition();
    ThrowEventPropertyWriter p = propertyWriterFactory.of(event);
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    p.setAssignmentsInfo(definition.getDataIOSet().getAssignmentsinfo());
    ErrorEventExecutionSet executionSet = definition.getExecutionSet();
    p.addError(executionSet.getErrorRef());
    p.setBounds(n.getContent().getBounds());
    return p;
}
Also used : BaseEndEvent(org.kie.workbench.common.stunner.bpmn.definition.BaseEndEvent) EndEvent(org.eclipse.bpmn2.EndEvent) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) EndErrorEvent(org.kie.workbench.common.stunner.bpmn.definition.EndErrorEvent) ErrorEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.error.ErrorEventExecutionSet) ThrowEventPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ThrowEventPropertyWriter)

Example 5 with EndEvent

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

the class EndEventConverter method messageEvent.

private PropertyWriter messageEvent(Node<View<EndMessageEvent>, ?> n) {
    EndEvent event = bpmn2.createEndEvent();
    event.setId(n.getUUID());
    EndMessageEvent definition = n.getContent().getDefinition();
    ThrowEventPropertyWriter p = propertyWriterFactory.of(event);
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    p.setAssignmentsInfo(definition.getDataIOSet().getAssignmentsinfo());
    MessageEventExecutionSet executionSet = definition.getExecutionSet();
    p.addMessage(executionSet.getMessageRef());
    p.setBounds(n.getContent().getBounds());
    return p;
}
Also used : BaseEndEvent(org.kie.workbench.common.stunner.bpmn.definition.BaseEndEvent) EndEvent(org.eclipse.bpmn2.EndEvent) EndMessageEvent(org.kie.workbench.common.stunner.bpmn.definition.EndMessageEvent) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) MessageEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageEventExecutionSet) ThrowEventPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ThrowEventPropertyWriter)

Aggregations

EndEvent (org.eclipse.bpmn2.EndEvent)6 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)6 ThrowEventPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ThrowEventPropertyWriter)5 BaseEndEvent (org.kie.workbench.common.stunner.bpmn.definition.BaseEndEvent)5 EndErrorEvent (org.kie.workbench.common.stunner.bpmn.definition.EndErrorEvent)2 EndMessageEvent (org.kie.workbench.common.stunner.bpmn.definition.EndMessageEvent)2 EndSignalEvent (org.kie.workbench.common.stunner.bpmn.definition.EndSignalEvent)2 EndTerminateEvent (org.kie.workbench.common.stunner.bpmn.definition.EndTerminateEvent)2 ErrorEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.error.ErrorEventExecutionSet)2 MessageEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageEventExecutionSet)2 List (java.util.List)1 CancelEventDefinition (org.eclipse.bpmn2.CancelEventDefinition)1 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)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 TerminateEventDefinition (org.eclipse.bpmn2.TerminateEventDefinition)1 Match (org.kie.workbench.common.stunner.bpmn.backend.converters.Match)1