protected internal virtual void assertEventShapeProperties(string id) { BpmnShape bpmnShapeEvent = findBpmnShape(id); assertNotNull(bpmnShapeEvent); assertEventSize(bpmnShapeEvent); }
protected internal virtual void assertGatewayShapeProperties(string id) { BpmnShape bpmnShapeGateway = findBpmnShape(id); assertNotNull(bpmnShapeGateway); assertGatewaySize(bpmnShapeGateway); }
public void BPMNShape_Populate() { BpmnShape shape = new BpmnShape { BPMNLabel = new BpmnLabel(), BpmnElement = XmlQualifiedName.Empty, IsHorizontal = false, IsHorizontalSpecified = false, IsExpanded = false, IsExpandedSpecified = false, IsMarkerVisible = false, IsMarkerVisibleSpecified = false, IsMessageVisible = false, IsMessageVisibleSpecified = false, ParticipantBandKind = ParticipantBandKind.bottom_initiating, ParticipantBandKindSpecified = false, ChoreographyActivityShape = XmlQualifiedName.Empty }; Assert.NotNull(shape.BPMNLabel); Assert.NotNull(shape.BpmnElement); Assert.False(shape.IsHorizontal); Assert.False(shape.IsHorizontalSpecified); Assert.False(shape.IsExpanded); Assert.False(shape.IsExpandedSpecified); Assert.False(shape.IsMarkerVisible); Assert.False(shape.IsMarkerVisibleSpecified); Assert.False(shape.IsMessageVisible); Assert.False(shape.IsMessageVisibleSpecified); Assert.Equal(ParticipantBandKind.bottom_initiating, shape.ParticipantBandKind); Assert.False(shape.ParticipantBandKindSpecified); Assert.NotNull(shape.ChoreographyActivityShape); }
protected internal virtual void assertTaskShapeProperties(string id) { BpmnShape bpmnShapeTask = findBpmnShape(id); assertNotNull(bpmnShapeTask); assertActivitySize(bpmnShapeTask); }
public virtual StartEventBuilder startEvent(string id) { StartEvent start = createChild(typeof(StartEvent), id); BpmnShape bpmnShape = createBpmnShape(start); Coordinates = bpmnShape; return(start.builder()); }
protected internal virtual void resizeSubProcess(BpmnShape innerShape) { BaseElement innerElement = innerShape.BpmnElement; Bounds innerShapeBounds = innerShape.Bounds; ModelElementInstance parent = innerElement.ParentElement; while (parent is SubProcess) { BpmnShape subProcessShape = findBpmnShape((SubProcess)parent); if (subProcessShape != null) { Bounds subProcessBounds = subProcessShape.Bounds; double innerX = innerShapeBounds.getX().Value; double innerWidth = innerShapeBounds.getWidth().Value; double innerY = innerShapeBounds.getY().Value; double innerHeight = innerShapeBounds.getHeight().Value; double subProcessY = subProcessBounds.getY().Value; double subProcessHeight = subProcessBounds.getHeight().Value; double subProcessX = subProcessBounds.getX().Value; double subProcessWidth = subProcessBounds.getWidth().Value; double tmpWidth = innerX + innerWidth + SPACE; double tmpHeight = innerY + innerHeight + SPACE; if (innerY == subProcessY) { subProcessBounds.setY(subProcessY - SPACE); subProcessBounds.setHeight(subProcessHeight + SPACE); } if (tmpWidth >= subProcessX + subProcessWidth) { double newWidth = tmpWidth - subProcessX; subProcessBounds.setWidth(newWidth); } if (tmpHeight >= subProcessY + subProcessHeight) { double newHeight = tmpHeight - subProcessY; subProcessBounds.setHeight(newHeight); } innerElement = (SubProcess)parent; innerShapeBounds = subProcessBounds; parent = innerElement.ParentElement; } else { break; } } }
public virtual BoundaryEventBuilder boundaryEvent(string id) { BoundaryEvent boundaryEvent = createSibling(typeof(BoundaryEvent), id); boundaryEvent.AttachedTo = element; BpmnShape boundaryEventBpmnShape = createBpmnShape(boundaryEvent); BoundaryEventCoordinates = boundaryEventBpmnShape; return(boundaryEvent.builder()); }
protected internal virtual T createTarget <T>(Type typeClass, string identifier) where T : FlowNode { typeClass = typeof(T); T target = createSibling(typeClass, identifier); BpmnShape targetBpmnShape = createBpmnShape(target); Coordinates = targetBpmnShape; connectTarget(target); resizeSubProcess(targetBpmnShape); return(target); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBpmnLabel() public virtual void testBpmnLabel() { BpmnShape shape = startEvent.DiagramElement; assertThat(shape.BpmnElement).isEqualTo(startEvent); assertThat(shape.BpmnLabel).NotNull; BpmnLabel label = shape.BpmnLabel; assertThat(label.LabelStyle).Null; assertThat(label.Bounds).NotNull; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBpmnShape() public virtual void testBpmnShape() { BpmnShape shape = serviceTask.DiagramElement; assertThat(shape.BpmnElement).isEqualTo(serviceTask); assertThat(shape.BpmnLabel).Null; assertThat(shape.Expanded).False; assertThat(shape.Horizontal).False; assertThat(shape.MarkerVisible).False; assertThat(shape.MessageVisible).False; assertThat(shape.ParticipantBandKind).Null; assertThat(shape.ChoreographyActivityShape).Null; }
protected internal virtual double calculateXCoordinate(Bounds boundaryEventBounds) { BpmnShape attachedToElement = findBpmnShape(element); double x = 0; if (attachedToElement != null) { Bounds attachedToBounds = attachedToElement.Bounds; ICollection <BoundaryEvent> boundaryEvents = element.ParentElement.getChildElementsByType(typeof(BoundaryEvent)); ICollection <BoundaryEvent> attachedBoundaryEvents = new List <BoundaryEvent>(); IEnumerator <BoundaryEvent> iterator = boundaryEvents.GetEnumerator(); while (iterator.MoveNext()) { BoundaryEvent tmp = iterator.Current; if (tmp.AttachedTo.Equals(element)) { attachedBoundaryEvents.Add(tmp); } } double attachedToX = attachedToBounds.getX().Value; double attachedToWidth = attachedToBounds.getWidth().Value; double boundaryWidth = boundaryEventBounds.getWidth().Value; switch (attachedBoundaryEvents.Count) { case 2: { x = attachedToX + attachedToWidth / 2 + boundaryWidth / 2; break; } case 3: { x = attachedToX + attachedToWidth / 2 - 1.5 * boundaryWidth; break; } default: { x = attachedToX + attachedToWidth / 2 - boundaryWidth / 2; break; } } } return(x); }
protected internal virtual void setWaypointsWithSourceAndTarget(BpmnEdge edge, FlowNode edgeSource, FlowNode edgeTarget) { BpmnShape source = findBpmnShape(edgeSource); BpmnShape target = findBpmnShape(edgeTarget); if (source != null && target != null) { Bounds sourceBounds = source.Bounds; Bounds targetBounds = target.Bounds; double sourceX = sourceBounds.getX().Value; double sourceY = sourceBounds.getY().Value; double sourceWidth = sourceBounds.getWidth().Value; double sourceHeight = sourceBounds.getHeight().Value; double targetX = targetBounds.getX().Value; double targetY = targetBounds.getY().Value; double targetHeight = targetBounds.getHeight().Value; Waypoint w1 = createInstance(typeof(Waypoint)); if (edgeSource.Outgoing.Count == 1) { w1.X = sourceX + sourceWidth; w1.Y = sourceY + sourceHeight / 2; edge.addChildElement(w1); } else { w1.X = sourceX + sourceWidth / 2; w1.Y = sourceY + sourceHeight; edge.addChildElement(w1); Waypoint w2 = createInstance(typeof(Waypoint)); w2.X = sourceX + sourceWidth / 2; w2.Y = targetY + targetHeight / 2; edge.addChildElement(w2); } Waypoint w3 = createInstance(typeof(Waypoint)); w3.X = targetX; w3.Y = targetY + targetHeight / 2; edge.addChildElement(w3); } }
protected internal virtual BpmnShape findBpmnShape(string id) { ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); IEnumerator <BpmnShape> iterator = allShapes.GetEnumerator(); while (iterator.MoveNext()) { BpmnShape shape = iterator.Current; if (shape.BpmnElement.Id.Equals(id)) { return(shape); } } return(null); }
public virtual BpmnShape createBpmnShape(FlowNode node) { BpmnPlane bpmnPlane = findBpmnPlane(); if (bpmnPlane != null) { BpmnShape bpmnShape = createInstance(typeof(BpmnShape)); bpmnShape.BpmnElement = node; Bounds nodeBounds = createInstance(typeof(Bounds)); if (node is SubProcess) { bpmnShape.Expanded = true; nodeBounds.setWidth(350); nodeBounds.setHeight(200); } else if (node is Activity) { nodeBounds.setWidth(100); nodeBounds.setHeight(80); } else if (node is Event) { nodeBounds.setWidth(36); nodeBounds.setHeight(36); } else if (node is Gateway) { nodeBounds.setWidth(50); nodeBounds.setHeight(50); if (node is ExclusiveGateway) { bpmnShape.MarkerVisible = true; } } nodeBounds.setX(0); nodeBounds.setY(0); bpmnShape.addChildElement(nodeBounds); bpmnPlane.addChildElement(bpmnShape); return(bpmnShape); } return(null); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateShapeForExclusiveGateway() public virtual void shouldGenerateShapeForExclusiveGateway() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder.startEvent(START_EVENT_ID).exclusiveGateway("or").endEvent(END_EVENT_ID).done(); // then ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); assertEquals(3, allShapes.Count); assertGatewayShapeProperties("or"); BpmnShape bpmnShape = findBpmnShape("or"); assertTrue(bpmnShape.MarkerVisible); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateShapeForBlankSubProcess() public virtual void shouldGenerateShapeForBlankSubProcess() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder.startEvent(START_EVENT_ID).subProcess(SUB_PROCESS_ID).endEvent(END_EVENT_ID).done(); // then ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); assertEquals(3, allShapes.Count); BpmnShape bpmnShapeSubProcess = findBpmnShape(SUB_PROCESS_ID); assertNotNull(bpmnShapeSubProcess); assertSubProcessSize(bpmnShapeSubProcess); assertTrue(bpmnShapeSubProcess.Expanded); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateShapeForEventSubProcess() public virtual void shouldGenerateShapeForEventSubProcess() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder.startEvent(START_EVENT_ID).endEvent(END_EVENT_ID).subProcess(SUB_PROCESS_ID).triggerByEvent().embeddedSubProcess().startEvent("innerStartEvent").endEvent("innerEndEvent").subProcessDone().done(); // then ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); assertEquals(5, allShapes.Count); assertEventShapeProperties("innerStartEvent"); assertEventShapeProperties("innerEndEvent"); BpmnShape bpmnShapeEventSubProcess = findBpmnShape(SUB_PROCESS_ID); assertNotNull(bpmnShapeEventSubProcess); assertTrue(bpmnShapeEventSubProcess.Expanded); }
public virtual EventSubProcessBuilder eventSubProcess(string id) { // Create a subprocess, triggered by an event, and add it to modelInstance SubProcess subProcess = createChild(typeof(SubProcess), id); subProcess.TriggeredByEvent = true; // Create Bpmn shape so subprocess will be drawn BpmnShape targetBpmnShape = createBpmnShape(subProcess); //find the lowest shape in the process // place event sub process underneath EventSubProcessCoordinates = targetBpmnShape; resizeSubProcess(targetBpmnShape); // Return the eventSubProcessBuilder EventSubProcessBuilder eventSubProcessBuilder = new EventSubProcessBuilder(modelInstance, subProcess); return(eventSubProcessBuilder); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateShapeForTransaction() public virtual void shouldGenerateShapeForTransaction() { // given ProcessBuilder processBuilder = Bpmn.createExecutableProcess(); // when instance = processBuilder.startEvent(START_EVENT_ID).transaction(TRANSACTION_ID).embeddedSubProcess().startEvent("innerStartEvent").userTask("innerUserTask").endEvent("innerEndEvent").transactionDone().endEvent(END_EVENT_ID).done(); // then ICollection <BpmnShape> allShapes = instance.getModelElementsByType(typeof(BpmnShape)); assertEquals(6, allShapes.Count); assertEventShapeProperties("innerStartEvent"); assertTaskShapeProperties("innerUserTask"); assertEventShapeProperties("innerEndEvent"); BpmnShape bpmnShapeSubProcess = findBpmnShape(TRANSACTION_ID); assertNotNull(bpmnShapeSubProcess); assertTrue(bpmnShapeSubProcess.Expanded); }
public virtual StartEventBuilder startEvent(string id) { StartEvent start = createChild(typeof(StartEvent), id); BpmnShape startShape = createBpmnShape(start); BpmnShape subProcessShape = findBpmnShape(Element); if (subProcessShape != null) { Bounds subProcessBounds = subProcessShape.Bounds; Bounds startBounds = startShape.Bounds; double subProcessX = subProcessBounds.getX().Value; double subProcessY = subProcessBounds.getY().Value; double subProcessHeight = subProcessBounds.getHeight().Value; double startHeight = startBounds.getHeight().Value; startBounds.setX(subProcessX + SPACE); startBounds.setY(subProcessY + subProcessHeight / 2 - startHeight / 2); } return(start.builder()); }
protected internal virtual void assertEventSize(BpmnShape shape) { assertSize(shape, 36, 36); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCreateValidBpmnDi() public virtual void shouldCreateValidBpmnDi() { modelInstance = Bpmn.createProcess("process").startEvent("start").sequenceFlowId("flow").endEvent("end").done(); process = modelInstance.getModelElementById("process"); startEvent = modelInstance.getModelElementById("start"); sequenceFlow = modelInstance.getModelElementById("flow"); endEvent = modelInstance.getModelElementById("end"); // create bpmn diagram BpmnDiagram bpmnDiagram = modelInstance.newInstance(typeof(BpmnDiagram)); bpmnDiagram.Id = "diagram"; bpmnDiagram.Name = "diagram"; bpmnDiagram.Documentation = "bpmn diagram element"; bpmnDiagram.Resolution = 120.0; modelInstance.Definitions.addChildElement(bpmnDiagram); // create plane for process BpmnPlane processPlane = modelInstance.newInstance(typeof(BpmnPlane)); processPlane.Id = "plane"; processPlane.BpmnElement = process; bpmnDiagram.BpmnPlane = processPlane; // create shape for start event BpmnShape startEventShape = modelInstance.newInstance(typeof(BpmnShape)); startEventShape.Id = "startShape"; startEventShape.BpmnElement = startEvent; processPlane.DiagramElements.Add(startEventShape); // create bounds for start event shape Bounds startEventBounds = modelInstance.newInstance(typeof(Bounds)); startEventBounds.setHeight(36.0); startEventBounds.setWidth(36.0); startEventBounds.setX(632.0); startEventBounds.setY(312.0); startEventShape.Bounds = startEventBounds; // create shape for end event BpmnShape endEventShape = modelInstance.newInstance(typeof(BpmnShape)); endEventShape.Id = "endShape"; endEventShape.BpmnElement = endEvent; processPlane.DiagramElements.Add(endEventShape); // create bounds for end event shape Bounds endEventBounds = modelInstance.newInstance(typeof(Bounds)); endEventBounds.setHeight(36.0); endEventBounds.setWidth(36.0); endEventBounds.setX(718.0); endEventBounds.setY(312.0); endEventShape.Bounds = endEventBounds; // create edge for sequence flow BpmnEdge flowEdge = modelInstance.newInstance(typeof(BpmnEdge)); flowEdge.Id = "flowEdge"; flowEdge.BpmnElement = sequenceFlow; flowEdge.SourceElement = startEventShape; flowEdge.TargetElement = endEventShape; processPlane.DiagramElements.Add(flowEdge); // create waypoints for sequence flow edge Waypoint startWaypoint = modelInstance.newInstance(typeof(Waypoint)); startWaypoint.X = 668.0; startWaypoint.Y = 330.0; flowEdge.Waypoints.add(startWaypoint); Waypoint endWaypoint = modelInstance.newInstance(typeof(Waypoint)); endWaypoint.X = 718.0; endWaypoint.Y = 330.0; flowEdge.Waypoints.add(endWaypoint); }
protected internal virtual void assertGatewaySize(BpmnShape shape) { assertSize(shape, 50, 50); }
protected internal virtual void assertSubProcessSize(BpmnShape shape) { assertSize(shape, 200, 350); }
protected internal virtual void assertSize(BpmnShape shape, int height, int width) { assertThat(shape.Bounds.Height).isEqualTo(height); assertThat(shape.Bounds.Width).isEqualTo(width); }
protected internal virtual void assertActivitySize(BpmnShape shape) { assertSize(shape, 80, 100); }