public ErrorEventExecutionSet() { this(new ErrorRef()); }
@Override public boolean equals(Object o) { if (o instanceof ErrorEventExecutionSet) { ErrorEventExecutionSet other = (ErrorEventExecutionSet) o; return errorRef.equals(other.errorRef); } return false; } }
@Override public int hashCode() { return HashUtil.combineHashCodes(errorRef.hashCode()); }
@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; } }; } }
public void addError(ErrorRef errorRef) { Error error = bpmn2.createError(); ErrorEventDefinition errorEventDefinition = bpmn2.createErrorEventDefinition(); addEventDefinition(errorEventDefinition); String errorCode = errorRef.getValue(); if (errorCode == null || errorCode.isEmpty()) { return; } error.setId(errorCode); error.setErrorCode(errorCode); errorEventDefinition.setErrorRef(error); CustomAttribute.errorName.of(errorEventDefinition).set(errorCode); addRootElement(error); }
private void assertErrorEventExecutionSet(ErrorEventExecutionSet executionSet, String eventName) { assertNotNull(executionSet); assertNotNull(executionSet.getErrorRef()); assertEquals(eventName, executionSet.getErrorRef().getValue()); } }
public CancellingErrorEventExecutionSet() { this(new CancelActivity(true), new ErrorRef()); }
@Override public boolean equals(Object o) { if (o instanceof InterruptingErrorEventExecutionSet) { InterruptingErrorEventExecutionSet other = (InterruptingErrorEventExecutionSet) o; return isInterrupting.equals(other.isInterrupting) && errorRef.equals(other.errorRef); } return false; } }
@Override public int hashCode() { return HashUtil.combineHashCodes(isInterrupting.hashCode(), errorRef.hashCode()); }
private void assertErrorEventExecutionSet(InterruptingErrorEventExecutionSet executionSet, String eventName, boolean isInterrupting) { assertNotNull(executionSet); assertNotNull(executionSet.getErrorRef()); assertEquals(eventName, executionSet.getErrorRef().getValue()); assertEquals(isInterrupting, executionSet.getIsInterrupting().getValue()); } }
public InterruptingErrorEventExecutionSet() { this(new IsInterrupting(true), new ErrorRef()); }
@Override public boolean equals(Object o) { if (o instanceof CancellingErrorEventExecutionSet) { CancellingErrorEventExecutionSet other = (CancellingErrorEventExecutionSet) o; return cancelActivity.equals(other.cancelActivity) && errorRef.equals(other.errorRef); } return false; } }
@Override public int hashCode() { return HashUtil.combineHashCodes(cancelActivity.hashCode(), errorRef.hashCode()); }
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 BpmnNode errorEventDefinition(EndEvent event, ErrorEventDefinition e) { Node<View<EndErrorEvent>, Edge> node = factoryManager.newNode(event.getId(), EndErrorEvent.class); EndErrorEvent definition = node.getContent().getDefinition(); EventPropertyReader 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 ErrorEventExecutionSet( 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 public void testUnmarshallEndErrorEvent() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ENDERROR_EVENT); assertDiagram(diagram, 2); assertEquals("endErrorEventProcess", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> endEventNode = diagram.getGraph().getNode("_E69BD781-AB7F-45C4-85DA-B1F3BAE5BCCB"); EndErrorEvent endErrorEvent = (EndErrorEvent) endEventNode.getContent().getDefinition(); assertNotNull(endErrorEvent.getGeneral()); assertEquals("MyErrorEventName", endErrorEvent.getGeneral().getName().getValue()); assertEquals("MyErrorEventDocumentation", endErrorEvent.getGeneral().getDocumentation().getValue()); assertNotNull(endErrorEvent.getExecutionSet()); assertNotNull(endErrorEvent.getExecutionSet().getErrorRef()); assertEquals("MyError", endErrorEvent.getExecutionSet().getErrorRef().getValue()); DataIOSet dataIOSet = endErrorEvent.getDataIOSet(); AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo(); assertEquals("myErrorEventInput:String||||[din]var1->myErrorEventInput", assignmentsInfo.getValue()); }
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 public void testUnmarshallEndErrorEvent() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ENDERROR_EVENT); assertDiagram(diagram, 2); assertEquals("endErrorEventProcess", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> endEventNode = diagram.getGraph().getNode("_E69BD781-AB7F-45C4-85DA-B1F3BAE5BCCB"); EndErrorEvent endErrorEvent = (EndErrorEvent) endEventNode.getContent().getDefinition(); assertNotNull(endErrorEvent.getGeneral()); assertEquals("MyErrorEventName", endErrorEvent.getGeneral().getName().getValue()); assertEquals("MyErrorEventDocumentation", endErrorEvent.getGeneral().getDocumentation().getValue()); assertNotNull(endErrorEvent.getExecutionSet()); assertNotNull(endErrorEvent.getExecutionSet().getErrorRef()); assertEquals("MyError", endErrorEvent.getExecutionSet().getErrorRef().getValue()); DataIOSet dataIOSet = endErrorEvent.getDataIOSet(); AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo(); assertEquals("myErrorEventInput:String||||[din]var1->myErrorEventInput", assignmentsInfo.getValue()); }
private BpmnNode errorEvent( StartEvent event, ErrorEventDefinition e) { Node<View<StartErrorEvent>, Edge> node = factoryManager.newNode(event.getId(), StartErrorEvent.class); StartErrorEvent definition = node.getContent().getDefinition(); EventPropertyReader 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 InterruptingErrorEventExecutionSet( new IsInterrupting(event.isIsInterrupting()), new ErrorRef(EventDefinitionReader.errorRefOf(e)) )); definition.setSimulationSet(p.getSimulationSet()); node.getContent().setBounds(p.getBounds()); definition.setDimensionsSet(p.getCircleDimensionSet()); definition.setFontSet(p.getFontSet()); definition.setBackgroundSet(p.getBackgroundSet()); return BpmnNode.of(node); }
@Test public void testUnmarshallStartErrorEvent() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_STARTERROREVENT); assertDiagram(diagram, 3); assertEquals("startErrorEventProcess", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> startEventNode = diagram.getGraph().getNode("3BD5BBC8-F1C7-45DE-8BDF-A06D8464A61B"); StartErrorEvent startErrorEvent = (StartErrorEvent) startEventNode.getContent().getDefinition(); assertNotNull(startErrorEvent.getGeneral()); assertEquals("MyStartErrorEvent", startErrorEvent.getGeneral().getName().getValue()); assertEquals("MyStartErrorEventDocumentation", startErrorEvent.getGeneral().getDocumentation().getValue()); assertNotNull(startErrorEvent.getExecutionSet()); assertNotNull(startErrorEvent.getExecutionSet().getErrorRef()); assertEquals("MyError", startErrorEvent.getExecutionSet().getErrorRef().getValue()); DataIOSet dataIOSet = startErrorEvent.getDataIOSet(); AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo(); assertEquals("||errorOutput_:String||[dout]errorOutput_->var1", assignmentsInfo.getValue()); }