@StencilId("IntermediateCompensationEventThrowing") public IntermediateThrowEvent createIntermediateCompensationEvent(GenericShape shape) { IntermediateThrowEvent itEvent = new IntermediateThrowEvent(); CompensateEventDefinition compDef = new CompensateEventDefinition(); /* Activity Reference */ String activityRef = shape.getProperty("activityref"); if (activityRef != null && !(activityRef.length() == 0)) { Task taskRef = new Task(); taskRef.setId(activityRef); compDef.setActivityRef(taskRef); } /* Wait for Completion */ String waitForCompletion = shape.getProperty("waitforcompletion"); if (waitForCompletion != null && waitForCompletion.equals("false")) { compDef.setWaitForCompletion(false); } else { compDef.setWaitForCompletion(true); } itEvent.getEventDefinition().add(compDef); return itEvent; }
/** Test the {@link Diagram2BpmnConverter#getDefinitionsFromDiagram} method. */ @Test public void testGetDefinitionsFromDiagram1() throws BpmnConverterException, IOException, JAXBException, JSONException, SAXException { // Read the test JSON BufferedReader br = new BufferedReader( new FileReader( new File( new File(testsDirectory, "data"), "GetDiagramFromBpmn20_1-expected.json"))); String bpmnJson = ""; String line; while ((line = br.readLine()) != null) { bpmnJson += line; } BasicDiagram diagram = BasicDiagramBuilder.parseJson(bpmnJson); // Execute the conversion Diagram2BpmnConverter converter = new Diagram2BpmnConverter(diagram, AbstractBpmnFactory.getFactoryClasses()); Definitions definitions = converter.getDefinitionsFromDiagram(); // Examine the resultant BPMN XML assertValidBPMN(definitions, "test-GetDefinitionsFromDiagram.bpmn.xml"); Task airbus = (Task) ((Process) definitions.getRootElement().get(0)).getFlowElement().get(0); assertEquals("sid-B8EA9D11-3DF2-46E9-8498-9351EEB1C3B4", airbus.getId()); assertEquals(1, airbus.getIncoming().size()); assertEquals("sid-B6C60809-2232-4F2B-B290-A4639AD05BCD", airbus.getIncoming().get(0).getId()); assertEquals(1, ((FlowNode) airbus).get_incomingSequenceFlows().size()); assertEquals( "sid-B6C60809-2232-4F2B-B290-A4639AD05BCD", ((FlowNode) airbus).get_incomingSequenceFlows().get(0).getId()); assertEquals(1, airbus.getOutgoing().size()); assertEquals("sid-F44D88A1-2E18-43E6-93C7-7F038AB2C2A1", airbus.getOutgoing().get(0).getId()); assertEquals(1, ((FlowNode) airbus).get_outgoingSequenceFlows().size()); assertEquals( "sid-F44D88A1-2E18-43E6-93C7-7F038AB2C2A1", ((FlowNode) airbus).get_outgoingSequenceFlows().get(0).getId()); }