Search in sources :

Example 1 with ThrowEventPropertyReader

use of org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader 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 ThrowEventPropertyReader

use of org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader in project kie-wb-common by kiegroup.

the class IntermediateThrowEventConverter method convert.

public BpmnNode convert(IntermediateThrowEvent event) {
    ThrowEventPropertyReader p = propertyReaderFactory.of(event);
    List<EventDefinition> eventDefinitions = p.getEventDefinitions();
    switch(eventDefinitions.size()) {
        case 0:
            throw new UnsupportedOperationException("An intermediate throw event should contain exactly one definition");
        case 1:
            return Match.of(EventDefinition.class, BpmnNode.class).when(SignalEventDefinition.class, e -> signalEvent(event, e)).when(MessageEventDefinition.class, e -> messageEvent(event, e)).missing(ErrorEventDefinition.class).missing(EscalationEventDefinition.class).missing(CompensateEventDefinition.class).missing(ConditionalEventDefinition.class).apply(eventDefinitions.get(0)).value();
        default:
            throw new UnsupportedOperationException("Multiple definitions not supported for intermediate throw event");
    }
}
Also used : EventDefinition(org.eclipse.bpmn2.EventDefinition) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) 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) 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) IntermediateSignalEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateSignalEventThrowing) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) EventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader) 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) IntermediateThrowEvent(org.eclipse.bpmn2.IntermediateThrowEvent) IntermediateMessageEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateMessageEventThrowing) 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) Node(org.kie.workbench.common.stunner.core.graph.Node) DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) 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) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition)

Aggregations

List (java.util.List)2 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)2 ErrorEventDefinition (org.eclipse.bpmn2.ErrorEventDefinition)2 EscalationEventDefinition (org.eclipse.bpmn2.EscalationEventDefinition)2 EventDefinition (org.eclipse.bpmn2.EventDefinition)2 MessageEventDefinition (org.eclipse.bpmn2.MessageEventDefinition)2 SignalEventDefinition (org.eclipse.bpmn2.SignalEventDefinition)2 Match (org.kie.workbench.common.stunner.bpmn.backend.converters.Match)2 TypedFactoryManager (org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager)2 BpmnNode (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode)2 EventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader)2 PropertyReaderFactory (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.PropertyReaderFactory)2 ThrowEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader)2 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)2 MessageEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageEventExecutionSet)2 MessageRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef)2 ScopedSignalEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.ScopedSignalEventExecutionSet)2 SignalRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.SignalRef)2 SignalScope (org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.SignalScope)2 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)2