Search in sources :

Example 1 with IntermediateCatchEvent

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

the class IntermediateCatchEventConverter method convertIntermediateCatchEvent.

public BpmnNode convertIntermediateCatchEvent(IntermediateCatchEvent event) {
    CatchEventPropertyReader p = propertyReaderFactory.of(event);
    List<EventDefinition> eventDefinitions = p.getEventDefinitions();
    switch(eventDefinitions.size()) {
        case 0:
            throw new UnsupportedOperationException("An intermediate catch event should contain exactly one definition");
        case 1:
            return Match.of(EventDefinition.class, BpmnNode.class).when(TimerEventDefinition.class, e -> timerEvent(event, e)).when(SignalEventDefinition.class, e -> signalEvent(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 intermediate catch event");
    }
}
Also used : EventDefinition(org.eclipse.bpmn2.EventDefinition) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) CancellingErrorEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.error.CancellingErrorEventExecutionSet) IntermediateErrorEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateErrorEventCatching) CancellingMessageEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.CancellingMessageEventExecutionSet) Edge(org.kie.workbench.common.stunner.core.graph.Edge) BoundaryEvent(org.eclipse.bpmn2.BoundaryEvent) BpmnNode(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode) MessageRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef) TimerSettings(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettings) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) ErrorRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.error.ErrorRef) IntermediateCatchEvent(org.eclipse.bpmn2.IntermediateCatchEvent) CancelActivity(org.kie.workbench.common.stunner.bpmn.definition.property.event.CancelActivity) 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) IntermediateSignalEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateSignalEventCatching) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) CancellingSignalEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.CancellingSignalEventExecutionSet) CancellingTimerEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.CancellingTimerEventExecutionSet) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) EventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) PropertyReaderFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.PropertyReaderFactory) 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) IntermediateTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent) CatchEvent(org.eclipse.bpmn2.CatchEvent) CatchEventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader) IntermediateMessageEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateMessageEventCatching) 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) CatchEventPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) BpmnNode(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode) 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) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition)

Example 2 with IntermediateCatchEvent

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

the class Bpmn2JsonMarshaller method marshallIntermediateCatchEvent.

protected void marshallIntermediateCatchEvent(IntermediateCatchEvent catchEvent, BPMNPlane plane, JsonGenerator generator, float xOffset, float yOffset, Map<String, Object> properties) throws JsonGenerationException, IOException {
    List<EventDefinition> eventDefinitions = catchEvent.getEventDefinitions();
    // simulation properties
    setSimulationProperties(catchEvent.getId(), properties);
    if (eventDefinitions.size() == 1) {
        EventDefinition eventDefinition = eventDefinitions.get(0);
        if (eventDefinition instanceof SignalEventDefinition) {
            marshallNode(catchEvent, properties, "IntermediateSignalEventCatching", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof MessageEventDefinition) {
            marshallNode(catchEvent, properties, "IntermediateMessageEventCatching", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof TimerEventDefinition) {
            marshallNode(catchEvent, properties, "IntermediateTimerEvent", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof ConditionalEventDefinition) {
            marshallNode(catchEvent, properties, "IntermediateConditionalEvent", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof ErrorEventDefinition) {
            marshallNode(catchEvent, properties, "IntermediateErrorEvent", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof EscalationEventDefinition) {
            marshallNode(catchEvent, properties, "IntermediateEscalationEvent", plane, generator, xOffset, yOffset);
        } else if (eventDefinition instanceof CompensateEventDefinition) {
            marshallNode(catchEvent, properties, "IntermediateCompensationEventCatching", plane, generator, xOffset, yOffset);
        } else {
            throw new UnsupportedOperationException("Event definition not supported: " + eventDefinition);
        }
    } else {
        throw new UnsupportedOperationException("Intermediate catch event does not have event definition.");
    }
}
Also used : EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) EventDefinition(org.eclipse.bpmn2.EventDefinition) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) TerminateEventDefinition(org.eclipse.bpmn2.TerminateEventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) CancelEventDefinition(org.eclipse.bpmn2.CancelEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition)

Aggregations

CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)2 ConditionalEventDefinition (org.eclipse.bpmn2.ConditionalEventDefinition)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 TimerEventDefinition (org.eclipse.bpmn2.TimerEventDefinition)2 List (java.util.List)1 BoundaryEvent (org.eclipse.bpmn2.BoundaryEvent)1 CancelEventDefinition (org.eclipse.bpmn2.CancelEventDefinition)1 CatchEvent (org.eclipse.bpmn2.CatchEvent)1 IntermediateCatchEvent (org.eclipse.bpmn2.IntermediateCatchEvent)1 TerminateEventDefinition (org.eclipse.bpmn2.TerminateEventDefinition)1 Match (org.kie.workbench.common.stunner.bpmn.backend.converters.Match)1 TypedFactoryManager (org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager)1 BpmnNode (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode)1 CatchEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader)1 EventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader)1 PropertyReaderFactory (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.PropertyReaderFactory)1