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");
}
}
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.");
}
}
Aggregations