protected static void createBpmnShape(BpmnModel model, String elementId, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_SHAPE, BPMNDI_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_DI_BPMNELEMENT, elementId); xtw.writeAttribute(ATTRIBUTE_ID, "BPMNShape_" + elementId); GraphicInfo graphicInfo = model.getGraphicInfo(elementId); FlowElement flowElement = model.getFlowElement(elementId); if (flowElement instanceof SubProcess && graphicInfo.getExpanded() != null) { xtw.writeAttribute(ATTRIBUTE_DI_IS_EXPANDED, String.valueOf(graphicInfo.getExpanded())); } xtw.writeStartElement(OMGDC_PREFIX, ELEMENT_DI_BOUNDS, OMGDC_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_DI_HEIGHT, String.valueOf(graphicInfo.getHeight())); xtw.writeAttribute(ATTRIBUTE_DI_WIDTH, String.valueOf(graphicInfo.getWidth())); xtw.writeAttribute(ATTRIBUTE_DI_X, String.valueOf(graphicInfo.getX())); xtw.writeAttribute(ATTRIBUTE_DI_Y, String.valueOf(graphicInfo.getY())); xtw.writeEndElement(); xtw.writeEndElement(); }
protected Area createRectangle(GraphicInfo graphicInfo) { Area outerRectangle = new Area(new Rectangle2D.Double( graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight() )); Area innerRectangle = new Area(new Rectangle2D.Double( graphicInfo.getX() + lineWidth, graphicInfo.getY() + lineWidth, graphicInfo.getWidth() - 2*lineWidth, graphicInfo.getHeight() - 2*lineWidth )); outerRectangle.subtract(innerRectangle); return outerRectangle; }
@RequestMapping(value = "/rest/admin/process-definitions/{processDefinitionId}/model-json", method = RequestMethod.GET, produces = "application/json") public JsonNode getProcessDefinitionModelJSON(@PathVariable String processDefinitionId) { ServerConfig config = retrieveServerConfig(EndpointType.PROCESS); ObjectNode displayNode = objectMapper.createObjectNode(); BpmnModel pojoModel = clientService.getProcessDefinitionModel(config, processDefinitionId); if (!pojoModel.getLocationMap().isEmpty()) { try { GraphicInfo diagramInfo = new GraphicInfo(); processProcessElements(config, pojoModel, displayNode, diagramInfo, null, null); displayNode.put("diagramBeginX", diagramInfo.getX()); displayNode.put("diagramBeginY", diagramInfo.getY()); displayNode.put("diagramWidth", diagramInfo.getWidth()); displayNode.put("diagramHeight", diagramInfo.getHeight()); } catch (Exception e) { LOGGER.error("Error creating model JSON", e); } } return displayNode; }
xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_LABEL, BPMNDI_NAMESPACE); xtw.writeStartElement(OMGDC_PREFIX, ELEMENT_DI_BOUNDS, OMGDC_NAMESPACE); xtw.writeAttribute(ATTRIBUTE_DI_HEIGHT, String.valueOf(labelGraphicInfo.getHeight())); xtw.writeAttribute(ATTRIBUTE_DI_WIDTH, String.valueOf(labelGraphicInfo.getWidth())); xtw.writeAttribute(ATTRIBUTE_DI_X, String.valueOf(labelGraphicInfo.getX()));
protected Area createGateway(GraphicInfo graphicInfo) { Area outerGatewayArea = new Area( createGatewayShape(graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight()) ); Area innerGatewayArea = new Area( createGatewayShape(graphicInfo.getX()+lineWidth, graphicInfo.getY()+lineWidth, graphicInfo.getWidth()-2*lineWidth, graphicInfo.getHeight()-2*lineWidth) ); outerGatewayArea.subtract(innerGatewayArea); return outerGatewayArea; }
protected void fillGraphicInfo(ObjectNode elementNode, GraphicInfo graphicInfo, boolean includeWidthAndHeight) { commonFillGraphicInfo(elementNode, graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight(), includeWidthAndHeight); }
ObjectNode dockNode = objectMapper.createObjectNode(); dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(association.getSourceRef()).getWidth() / 2.0); dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(association.getSourceRef()).getHeight() / 2.0); dockersArrayNode.add(dockNode); double diffBottomY = Math.abs(flowGraphicInfo.getY() - (targetGraphicInfo.getY() + targetGraphicInfo.getHeight())); dockNode.put(EDITOR_BOUNDS_Y, targetGraphicInfo.getHeight() / 2.0); dockNode.put(EDITOR_BOUNDS_Y, targetGraphicInfo.getHeight()); dockNode.put(EDITOR_BOUNDS_Y, targetGraphicInfo.getHeight() / 2.0);
displayNode.put("diagramBeginY", diagramInfo.getY()); displayNode.put("diagramWidth", diagramInfo.getWidth()); displayNode.put("diagramHeight", diagramInfo.getHeight());
protected void fillGraphicInfo(ObjectNode elementNode, GraphicInfo graphicInfo, boolean includeWidthAndHeight) { commonFillGraphicInfo(elementNode, graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight(), includeWidthAndHeight); }
ObjectNode dockNode = objectMapper.createObjectNode(); dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(messageFlow.getSourceRef()).getWidth() / 2.0); dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(messageFlow.getSourceRef()).getHeight() / 2.0); dockersArrayNode.add(dockNode); dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(messageFlow.getTargetRef()).getHeight() / 2.0); dockersArrayNode.add(dockNode); flowNode.set("dockers", dockersArrayNode);
displayNode.put("diagramBeginY", diagramInfo.getY()); displayNode.put("diagramWidth", diagramInfo.getWidth()); displayNode.put("diagramHeight", diagramInfo.getHeight());
ObjectNode dockNode = objectMapper.createObjectNode(); dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(sequenceFlow.getSourceRef()).getWidth() / 2.0); dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(sequenceFlow.getSourceRef()).getHeight() / 2.0); dockersArrayNode.add(dockNode); dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(sequenceFlow.getTargetRef()).getHeight() / 2.0); dockersArrayNode.add(dockNode); flowNode.set("dockers", dockersArrayNode);
protected void createDIBounds(GraphicInfo graphicInfo, HasDIBounds target) { target.setX((int) graphicInfo.getX()); target.setY((int) graphicInfo.getY()); target.setWidth((int) graphicInfo.getWidth()); target.setHeight((int) graphicInfo.getHeight()); }
protected void fillDiagramInfo(GraphicInfo graphicInfo, GraphicInfo diagramInfo) { double rightX = graphicInfo.getX() + graphicInfo.getWidth(); double bottomY = graphicInfo.getY() + graphicInfo.getHeight(); double middleX = graphicInfo.getX() + (graphicInfo.getWidth() / 2); if (middleX < diagramInfo.getX()) { diagramInfo.setX(middleX); } if (graphicInfo.getY() < diagramInfo.getY()) { diagramInfo.setY(graphicInfo.getY()); } if (rightX > diagramInfo.getWidth()) { diagramInfo.setWidth(rightX); } if (bottomY > diagramInfo.getHeight()) { diagramInfo.setHeight(bottomY); } }
protected void fillDiagramInfo(GraphicInfo graphicInfo, GraphicInfo diagramInfo) { double rightX = graphicInfo.getX() + graphicInfo.getWidth(); double bottomY = graphicInfo.getY() + graphicInfo.getHeight(); double middleX = graphicInfo.getX() + (graphicInfo.getWidth() / 2); if (middleX < diagramInfo.getX()) { diagramInfo.setX(middleX); } if (graphicInfo.getY() < diagramInfo.getY()) { diagramInfo.setY(graphicInfo.getY()); } if (rightX > diagramInfo.getWidth()) { diagramInfo.setWidth(rightX); } if (bottomY > diagramInfo.getHeight()) { diagramInfo.setHeight(bottomY); } } }
double bottomY = poolInfo.getY() + poolInfo.getHeight(); double middleX = poolInfo.getX() + (poolInfo.getWidth() / 2); if (firstElement || middleX < diagramInfo.getX()) { diagramInfo.setWidth(rightX); if (bottomY > diagramInfo.getHeight()) { diagramInfo.setHeight(bottomY); displayNode.put("diagramBeginY", diagramInfo.getY()); displayNode.put("diagramWidth", diagramInfo.getWidth()); displayNode.put("diagramHeight", diagramInfo.getHeight()); return displayNode;
public boolean equals(GraphicInfo ginfo) { if (this.getX() != ginfo.getX()) { return false; } if (this.getY() != ginfo.getY()) { return false; } if (this.getHeight() != ginfo.getHeight()) { return false; } if (this.getWidth() != ginfo.getWidth()) { return false; } // check for zero value in case we are comparing model value to BPMN DI value // model values do not have xml location information if (0 != this.getXmlColumnNumber() && 0 != ginfo.getXmlColumnNumber() && this.getXmlColumnNumber() != ginfo.getXmlColumnNumber()) { return false; } if (0 != this.getXmlRowNumber() && 0 != ginfo.getXmlRowNumber() && this.getXmlRowNumber() != ginfo.getXmlRowNumber()) { return false; } // only check for elements that support this value if (null != this.getExpanded() && null != ginfo.getExpanded() && this.getExpanded() != ginfo.getExpanded()) { return false; } return true; } }
public boolean equals(GraphicInfo ginfo) { if (this.getX() != ginfo.getX()) { return false; } if (this.getY() != ginfo.getY()) { return false; } if (this.getHeight() != ginfo.getHeight()) { return false; } if (this.getWidth() != ginfo.getWidth()) { return false; } // check for zero value in case we are comparing model value to BPMN DI value // model values do not have xml location information if (0 != this.getXmlColumnNumber() && 0 != ginfo.getXmlColumnNumber() && this.getXmlColumnNumber() != ginfo.getXmlColumnNumber()) { return false; } if (0 != this.getXmlRowNumber() && 0 != ginfo.getXmlRowNumber() && this.getXmlRowNumber() != ginfo.getXmlRowNumber()) { return false; } // only check for elements that support this value if (null != this.getExpanded() && null != ginfo.getExpanded() && this.getExpanded() != ginfo.getExpanded()) { return false; } return true; } }