Java Code Examples for org.activiti.bpmn.model.BpmnModel#getPools()

The following examples show how to use org.activiti.bpmn.model.BpmnModel#getPools() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModelImageService.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected GraphicInfo calculateDiagramSize(BpmnModel bpmnModel) {
  GraphicInfo diagramInfo = new GraphicInfo();

  for (Pool pool : bpmnModel.getPools()) {
    GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId());
    double elementMaxX = graphicInfo.getX() + graphicInfo.getWidth();
    double elementMaxY = graphicInfo.getY() + graphicInfo.getHeight();

    if (elementMaxX > diagramInfo.getWidth()) {
      diagramInfo.setWidth(elementMaxX);
    }
    if (elementMaxY > diagramInfo.getHeight()) {
      diagramInfo.setHeight(elementMaxY);
    }
  }

  for (Process process : bpmnModel.getProcesses()) {
    calculateWidthForFlowElements(process.getFlowElements(), bpmnModel, diagramInfo);
    calculateWidthForArtifacts(process.getArtifacts(), bpmnModel, diagramInfo);
  }
  return diagramInfo;
}
 
Example 2
Source File: BpmnImageTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected GraphicInfo calculateDiagramSize(BpmnModel bpmnModel) {
	GraphicInfo diagramInfo = new GraphicInfo();

    for (Pool pool : bpmnModel.getPools()) {
      GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId());
      double elementMaxX = graphicInfo.getX() + graphicInfo.getWidth();
      double elementMaxY = graphicInfo.getY() + graphicInfo.getHeight();
      
      if (elementMaxX > diagramInfo.getWidth()) {
    	  diagramInfo.setWidth(elementMaxX);
      }
      if (elementMaxY > diagramInfo.getHeight()) {
    	  diagramInfo.setHeight(elementMaxY);
      }
    }
    
    for (Process process : bpmnModel.getProcesses()) {
    	calculateWidthForFlowElements(process.getFlowElements(), bpmnModel, diagramInfo);
    	calculateWidthForArtifacts(process.getArtifacts(), bpmnModel, diagramInfo);
    }
    return diagramInfo;
}
 
Example 3
Source File: ModelImageService.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void scaleDiagram(BpmnModel bpmnModel, double scaleFactor) {
  for (Pool pool : bpmnModel.getPools()) {
    GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId());
    scaleGraphicInfo(graphicInfo, scaleFactor);
  }

  for (Process process : bpmnModel.getProcesses()) {
    scaleFlowElements(process.getFlowElements(), bpmnModel, scaleFactor);
    scaleArtifacts(process.getArtifacts(), bpmnModel, scaleFactor);
    for (Lane lane : process.getLanes()) {
      scaleGraphicInfo(bpmnModel.getGraphicInfo(lane.getId()), scaleFactor);
    }
  }
}
 
Example 4
Source File: BpmnImageTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void scaleDiagram(BpmnModel bpmnModel, double scaleFactor) {
    for (Pool pool : bpmnModel.getPools()) {
      GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId());
      scaleGraphicInfo(graphicInfo, scaleFactor);
    }
    
    for (Process process : bpmnModel.getProcesses()) {
    	scaleFlowElements(process.getFlowElements(), bpmnModel, scaleFactor);
    	scaleArtifacts(process.getArtifacts(), bpmnModel, scaleFactor);
    	for (Lane lane : process.getLanes()) {
    		scaleGraphicInfo(bpmnModel.getGraphicInfo(lane.getId()), scaleFactor);
		}
    }
}
 
Example 5
Source File: CollaborationExport.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public static void writePools(BpmnModel model, XMLStreamWriter xtw) throws Exception {
  if (!model.getPools().isEmpty()) {
    xtw.writeStartElement(ELEMENT_COLLABORATION);
    xtw.writeAttribute(ATTRIBUTE_ID, "Collaboration");
    for (Pool pool : model.getPools()) {
      xtw.writeStartElement(ELEMENT_PARTICIPANT);
      xtw.writeAttribute(ATTRIBUTE_ID, pool.getId());
      if (StringUtils.isNotEmpty(pool.getName())) {
        xtw.writeAttribute(ATTRIBUTE_NAME, pool.getName());
      }
      if (StringUtils.isNotEmpty(pool.getProcessRef())) {
        xtw.writeAttribute(ATTRIBUTE_PROCESS_REF, pool.getProcessRef());
      }
      xtw.writeEndElement();
    }

    for (MessageFlow messageFlow : model.getMessageFlows().values()) {
      xtw.writeStartElement(ELEMENT_MESSAGE_FLOW);
      xtw.writeAttribute(ATTRIBUTE_ID, messageFlow.getId());
      if (StringUtils.isNotEmpty(messageFlow.getName())) {
        xtw.writeAttribute(ATTRIBUTE_NAME, messageFlow.getName());
      }
      if (StringUtils.isNotEmpty(messageFlow.getSourceRef())) {
        xtw.writeAttribute(ATTRIBUTE_FLOW_SOURCE_REF, messageFlow.getSourceRef());
      }
      if (StringUtils.isNotEmpty(messageFlow.getTargetRef())) {
        xtw.writeAttribute(ATTRIBUTE_FLOW_TARGET_REF, messageFlow.getTargetRef());
      }
      if (StringUtils.isNotEmpty(messageFlow.getMessageRef())) {
        xtw.writeAttribute(ATTRIBUTE_MESSAGE_REF, messageFlow.getMessageRef());
      }
      xtw.writeEndElement();
    }

    xtw.writeEndElement();
  }
}