@Override public Function<Node, Pair<Object, String>> getMapper() { return node -> { ErrorRef errorRef = null; if (startErrorEventsFilter.test(node)) { errorRef = ((StartErrorEvent) ((View) node.getContent()).getDefinition()).getExecutionSet().getErrorRef(); } else if (intermediateErrorEventsFilter.test(node)) { errorRef = ((IntermediateErrorEventCatching) ((View) node.getContent()).getDefinition()).getExecutionSet().getErrorRef(); } else if (endErrorEventsFilter.test(node)) { errorRef = ((EndErrorEvent) ((View) node.getContent()).getDefinition()).getExecutionSet().getErrorRef(); } if (errorRef != null && errorRef.getValue() != null && !errorRef.getValue().isEmpty()) { return new Pair<>(errorRef.getValue(), errorRef.getValue(), Pair.PairEqualsMode.K1); } else { return null; } }; } }
private void assertErrorEventExecutionSet(CancellingErrorEventExecutionSet executionSet, String eventName, boolean isCancelling) { assertNotNull(executionSet); assertNotNull(executionSet.getErrorRef()); assertNotNull(executionSet.getCancelActivity()); assertEquals(eventName, executionSet.getErrorRef().getValue()); assertEquals(isCancelling, executionSet.getCancelActivity().getValue()); } }
private PropertyWriter errorEvent(Node<View<IntermediateErrorEventCatching>, ?> n) { CatchEventPropertyWriter p = createCatchEventPropertyWriter(n); p.getFlowElement().setId(n.getUUID()); IntermediateErrorEventCatching definition = n.getContent().getDefinition(); BPMNGeneralSet general = definition.getGeneral(); p.setName(general.getName().getValue()); p.setDocumentation(general.getDocumentation().getValue()); p.setAssignmentsInfo( definition.getDataIOSet().getAssignmentsinfo()); CancellingErrorEventExecutionSet executionSet = definition.getExecutionSet(); p.setCancelActivity(executionSet.getCancelActivity().getValue()); p.addError(executionSet.getErrorRef()); p.setBounds(n.getContent().getBounds()); return p; }
@Test @SuppressWarnings("unchecked") public void testUnmarshallIntermediateErrorEventCatching() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_ERROR_EVENTCATCHING); assertDiagram(diagram, 2); assertEquals("intermediateErrorCatching", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> intermediateEventNode = diagram.getGraph().getNode("80A2A7A9-7C68-408C-BE3B-467562A2C139"); IntermediateErrorEventCatching intermediateErrorEventCatching = (IntermediateErrorEventCatching) intermediateEventNode.getContent().getDefinition(); assertNotNull(intermediateErrorEventCatching.getGeneral()); assertEquals("MyErrorCatchingEvent", intermediateErrorEventCatching.getGeneral().getName().getValue()); assertEquals("MyErrorCatchingEventDocumentation", intermediateErrorEventCatching.getGeneral().getDocumentation().getValue()); assertNotNull(intermediateErrorEventCatching.getExecutionSet()); assertEquals(true, intermediateErrorEventCatching.getExecutionSet().getCancelActivity().getValue()); assertEquals("MyError", intermediateErrorEventCatching.getExecutionSet().getErrorRef().getValue()); DataIOSet dataIOSet = intermediateErrorEventCatching.getDataIOSet(); AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo(); assertEquals("||theErrorEventOutput:String||[dout]theErrorEventOutput->errorVar", assignmentsInfo.getValue()); }
@Test @SuppressWarnings("unchecked") public void testUnmarshallIntermediateErrorEventCatching() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_ERROR_EVENTCATCHING); assertDiagram(diagram, 2); assertEquals("intermediateErrorCatching", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> intermediateEventNode = diagram.getGraph().getNode("80A2A7A9-7C68-408C-BE3B-467562A2C139"); IntermediateErrorEventCatching intermediateErrorEventCatching = (IntermediateErrorEventCatching) intermediateEventNode.getContent().getDefinition(); assertNotNull(intermediateErrorEventCatching.getGeneral()); assertEquals("MyErrorCatchingEvent", intermediateErrorEventCatching.getGeneral().getName().getValue()); assertEquals("MyErrorCatchingEventDocumentation", intermediateErrorEventCatching.getGeneral().getDocumentation().getValue()); assertNotNull(intermediateErrorEventCatching.getExecutionSet()); assertEquals(true, intermediateErrorEventCatching.getExecutionSet().getCancelActivity().getValue()); assertEquals("MyError", intermediateErrorEventCatching.getExecutionSet().getErrorRef().getValue()); DataIOSet dataIOSet = intermediateErrorEventCatching.getDataIOSet(); AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo(); assertEquals("||theErrorEventOutput:String||[dout]theErrorEventOutput->errorVar", assignmentsInfo.getValue()); }