@Override public Function<Node, Pair<Object, String>> getMapper() { return node -> { EscalationRef escalationRef = null; if (startEscalationEventsFilter.test(node)) { escalationRef = ((StartEscalationEvent) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } else if (intermediateCatchingEscalationEventsFilter.test(node)) { escalationRef = ((IntermediateEscalationEvent) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } else if (intermediateThrowingEscalationEventsFilter.test(node)) { escalationRef = ((IntermediateEscalationEventThrowing) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } else if (endEscalationEventsFilter.test(node)) { escalationRef = ((EndEscalationEvent) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } if (escalationRef != null && escalationRef.getValue() != null && !escalationRef.getValue().isEmpty()) { return new Pair<>(escalationRef.getValue(), escalationRef.getValue(), Pair.PairEqualsMode.K1); } else { return null; } }; } }
private void assertEscalationEventExecutionSet(CancellingEscalationEventExecutionSet executionSet, String escalationRef, boolean isCancelling) { assertNotNull(executionSet); assertNotNull(executionSet.getEscalationRef()); assertNotNull(executionSet.getCancelActivity()); assertEquals(escalationRef, executionSet.getEscalationRef().getValue()); assertEquals(isCancelling, executionSet.getCancelActivity().getValue()); } }
private void assertEscalationEventExecutionSet(CancellingEscalationEventExecutionSet executionSet, String escalationRef, boolean isCancelling) { assertNotNull(executionSet); assertNotNull(executionSet.getEscalationRef()); assertNotNull(executionSet.getCancelActivity()); assertEquals(escalationRef, executionSet.getEscalationRef().getValue()); assertEquals(isCancelling, executionSet.getCancelActivity().getValue()); } }
private PropertyWriter escalationEvent(Node<View<IntermediateEscalationEvent>, ?> n) { CatchEventPropertyWriter p = createCatchEventPropertyWriter(n); p.getFlowElement().setId(n.getUUID()); IntermediateEscalationEvent definition = n.getContent().getDefinition(); BPMNGeneralSet general = definition.getGeneral(); p.setName(general.getName().getValue()); p.setDocumentation(general.getDocumentation().getValue()); p.setAssignmentsInfo( definition.getDataIOSet().getAssignmentsinfo()); CancellingEscalationEventExecutionSet executionSet = definition.getExecutionSet(); p.setCancelActivity(executionSet.getCancelActivity().getValue()); p.addEscalation(executionSet.getEscalationRef()); p.setBounds(n.getContent().getBounds()); return p; }
@Test @SuppressWarnings("unchecked") public void testUnmarshallIntermediateEscalationEvents() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_ESCALATION_EVENTS); assertDiagram(diagram, 3); assertEquals("IntermediateEscalationEvents", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> catchingEventNode = diagram.getGraph().getNode("_C7F2BA98-1100-4CF8-A994-40E2B65F6E5D"); assertNotNull(catchingEventNode); IntermediateEscalationEvent intermediateEscalationEvent = (IntermediateEscalationEvent) catchingEventNode.getContent().getDefinition(); assertNotNull(intermediateEscalationEvent.getGeneral()); assertEquals("BoundaryEscalationEventName", intermediateEscalationEvent.getGeneral().getName().getValue()); assertEquals("BoundaryEscalationEventDocumentation", intermediateEscalationEvent.getGeneral().getDocumentation().getValue()); assertNotNull(intermediateEscalationEvent.getExecutionSet()); assertEquals(true, intermediateEscalationEvent.getExecutionSet().getCancelActivity().getValue()); assertEquals("EscalationCode", intermediateEscalationEvent.getExecutionSet().getEscalationRef().getValue()); DataIOSet dataIOSet = intermediateEscalationEvent.getDataIOSet(); AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo(); assertEquals("||escalationOutput:String||[dout]escalationOutput->processVar1", assignmentsInfo.getValue()); }
@Test @SuppressWarnings("unchecked") public void testUnmarshallIntermediateEscalationEvents() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_ESCALATION_EVENTS); assertDiagram(diagram, 3); assertEquals("IntermediateEscalationEvents", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> catchingEventNode = diagram.getGraph().getNode("_C7F2BA98-1100-4CF8-A994-40E2B65F6E5D"); assertNotNull(catchingEventNode); IntermediateEscalationEvent intermediateEscalationEvent = (IntermediateEscalationEvent) catchingEventNode.getContent().getDefinition(); assertNotNull(intermediateEscalationEvent.getGeneral()); assertEquals("BoundaryEscalationEventName", intermediateEscalationEvent.getGeneral().getName().getValue()); assertEquals("BoundaryEscalationEventDocumentation", intermediateEscalationEvent.getGeneral().getDocumentation().getValue()); assertNotNull(intermediateEscalationEvent.getExecutionSet()); assertEquals(true, intermediateEscalationEvent.getExecutionSet().getCancelActivity().getValue()); assertEquals("EscalationCode", intermediateEscalationEvent.getExecutionSet().getEscalationRef().getValue()); DataIOSet dataIOSet = intermediateEscalationEvent.getDataIOSet(); AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo(); assertEquals("||escalationOutput:String||[dout]escalationOutput->processVar1", assignmentsInfo.getValue()); }