use of org.activiti.bpmn.model.GraphicInfo in project Activiti by Activiti.
the class BpmnJsonConverter method createGraphicInfo.
private GraphicInfo createGraphicInfo(double x, double y) {
GraphicInfo graphicInfo = new GraphicInfo();
graphicInfo.setX(x);
graphicInfo.setY(y);
return graphicInfo;
}
use of org.activiti.bpmn.model.GraphicInfo in project Activiti by Activiti.
the class BaseBpmnJsonConverter method createDataAssociation.
protected void createDataAssociation(DataAssociation dataAssociation, boolean incoming, Activity activity) {
String sourceRef = null;
String targetRef = null;
if (incoming) {
sourceRef = dataAssociation.getSourceRef();
targetRef = activity.getId();
} else {
sourceRef = activity.getId();
targetRef = dataAssociation.getTargetRef();
}
ObjectNode flowNode = BpmnJsonConverterUtil.createChildShape(dataAssociation.getId(), STENCIL_DATA_ASSOCIATION, 172, 212, 128, 212);
ArrayNode dockersArrayNode = objectMapper.createArrayNode();
ObjectNode dockNode = objectMapper.createObjectNode();
dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(sourceRef).getWidth() / 2.0);
dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(sourceRef).getHeight() / 2.0);
dockersArrayNode.add(dockNode);
if (model.getFlowLocationGraphicInfo(dataAssociation.getId()).size() > 2) {
for (int i = 1; i < model.getFlowLocationGraphicInfo(dataAssociation.getId()).size() - 1; i++) {
GraphicInfo graphicInfo = model.getFlowLocationGraphicInfo(dataAssociation.getId()).get(i);
dockNode = objectMapper.createObjectNode();
dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX());
dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getY());
dockersArrayNode.add(dockNode);
}
}
dockNode = objectMapper.createObjectNode();
dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(targetRef).getWidth() / 2.0);
dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(targetRef).getHeight() / 2.0);
dockersArrayNode.add(dockNode);
flowNode.put("dockers", dockersArrayNode);
ArrayNode outgoingArrayNode = objectMapper.createArrayNode();
outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(targetRef));
flowNode.put("outgoing", outgoingArrayNode);
flowNode.put("target", BpmnJsonConverterUtil.createResourceNode(targetRef));
ObjectNode propertiesNode = objectMapper.createObjectNode();
propertiesNode.put(PROPERTY_OVERRIDE_ID, dataAssociation.getId());
flowNode.put(EDITOR_SHAPE_PROPERTIES, propertiesNode);
shapesArrayNode.add(flowNode);
}
use of org.activiti.bpmn.model.GraphicInfo in project Activiti by Activiti.
the class BoundaryEventJsonConverter method convertElementToJson.
protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) {
BoundaryEvent boundaryEvent = (BoundaryEvent) baseElement;
ArrayNode dockersArrayNode = objectMapper.createArrayNode();
ObjectNode dockNode = objectMapper.createObjectNode();
GraphicInfo graphicInfo = model.getGraphicInfo(boundaryEvent.getId());
GraphicInfo parentGraphicInfo = model.getGraphicInfo(boundaryEvent.getAttachedToRef().getId());
dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX() - parentGraphicInfo.getX());
dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getY() - parentGraphicInfo.getY());
dockersArrayNode.add(dockNode);
flowElementNode.put("dockers", dockersArrayNode);
propertiesNode.put(PROPERTY_CANCEL_ACTIVITY, boundaryEvent.isCancelActivity());
addEventProperties(boundaryEvent, propertiesNode);
}
use of org.activiti.bpmn.model.GraphicInfo in project Activiti by Activiti.
the class SubProcessJsonConverter method convertElementToJson.
protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) {
SubProcess subProcess = (SubProcess) baseElement;
propertiesNode.put("activitytype", "Sub-Process");
propertiesNode.put("subprocesstype", "Embedded");
ArrayNode subProcessShapesArrayNode = objectMapper.createArrayNode();
GraphicInfo graphicInfo = model.getGraphicInfo(subProcess.getId());
processor.processFlowElements(subProcess, model, subProcessShapesArrayNode, graphicInfo.getX(), graphicInfo.getY());
flowElementNode.put("childShapes", subProcessShapesArrayNode);
if (subProcess instanceof Transaction) {
propertiesNode.put("istransaction", true);
}
BpmnJsonConverterUtil.convertDataPropertiesToJson(subProcess.getDataObjects(), propertiesNode);
}
use of org.activiti.bpmn.model.GraphicInfo in project Activiti by Activiti.
the class BpmnAutoLayout method createDiagramInterchangeInformation.
protected void createDiagramInterchangeInformation(BaseElement element, List<mxPoint> waypoints) {
List<GraphicInfo> graphicInfoForWaypoints = new ArrayList<GraphicInfo>();
for (mxPoint waypoint : waypoints) {
GraphicInfo graphicInfo = new GraphicInfo();
graphicInfo.setElement(element);
graphicInfo.setX(waypoint.getX());
graphicInfo.setY(waypoint.getY());
graphicInfoForWaypoints.add(graphicInfo);
}
bpmnModel.addFlowGraphicInfoList(element.getId(), graphicInfoForWaypoints);
}
Aggregations