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()); } }
public IntermediateErrorEventCatching() { this(new BPMNGeneralSet(""), new BackgroundSet(), new FontSet(), new CircleDimensionSet(new Radius()), new DataIOSet(), new CancellingErrorEventExecutionSet()); }
@Override public boolean equals(Object o) { if (o instanceof IntermediateErrorEventCatching) { IntermediateErrorEventCatching other = (IntermediateErrorEventCatching) o; return super.equals(other) && executionSet.equals(other.executionSet) && dataIOSet.equals(other.dataIOSet); } return false; } }
@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; } }; } }
@Override public int hashCode() { return HashUtil.combineHashCodes(super.hashCode(), executionSet.hashCode(), dataIOSet.hashCode()); }
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; }
private BpmnNode errorEvent(CatchEvent event, ErrorEventDefinition e) { String nodeId = event.getId(); Node<View<IntermediateErrorEventCatching>, Edge> node = factoryManager.newNode(nodeId, IntermediateErrorEventCatching.class); IntermediateErrorEventCatching definition = node.getContent().getDefinition(); CatchEventPropertyReader p = propertyReaderFactory.of(event); definition.setGeneral(new BPMNGeneralSet( new Name(p.getName()), new Documentation(p.getDocumentation()) )); definition.setDataIOSet( new DataIOSet( p.getAssignmentsInfo())); definition.setExecutionSet(new CancellingErrorEventExecutionSet( new CancelActivity(p.isCancelActivity()), new ErrorRef(EventDefinitionReader.errorRefOf(e)) )); node.getContent().setBounds(p.getBounds()); definition.setDimensionsSet(p.getCircleDimensionSet()); definition.setFontSet(p.getFontSet()); definition.setBackgroundSet(p.getBackgroundSet()); return BpmnNode.of(node); }
@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()); }