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, "" + graphicInfo.getHeight());
xtw.writeAttribute(ATTRIBUTE_DI_WIDTH, "" + graphicInfo.getWidth());
xtw.writeAttribute(ATTRIBUTE_DI_X, "" + graphicInfo.getX());
xtw.writeAttribute(ATTRIBUTE_DI_Y, "" + graphicInfo.getY());
xtw.writeEndElement();
xtw.writeEndElement();
}
}
for (String elementId : model.getFlowLocationMap().keySet()) {
if (model.getFlowElement(elementId) != null || model.getArtifact(elementId) != null ||
model.getMessageFlow(elementId) != null) {
xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_EDGE, BPMNDI_NAMESPACE);
xtw.writeAttribute(ATTRIBUTE_DI_BPMNELEMENT, elementId);
xtw.writeAttribute(ATTRIBUTE_ID, "BPMNEdge_" + elementId);
List<GraphicInfo> graphicInfoList = model.getFlowLocationGraphicInfo(elementId);
for (GraphicInfo graphicInfo : graphicInfoList) {
xtw.writeStartElement(OMGDI_PREFIX, ELEMENT_DI_WAYPOINT, OMGDI_NAMESPACE);
xtw.writeAttribute(ATTRIBUTE_DI_X, "" + graphicInfo.getX());
xtw.writeAttribute(ATTRIBUTE_DI_Y, "" + graphicInfo.getY());
xtw.writeEndElement();
}
GraphicInfo labelGraphicInfo = model.getLabelGraphicInfo(elementId);
FlowElement flowElement = model.getFlowElement(elementId);
MessageFlow messageFlow = null;
if (flowElement == null) {
messageFlow = model.getMessageFlow(elementId);
}
boolean hasName = false;
if (flowElement != null && StringUtils.isNotEmpty(flowElement.getName())) {
hasName = true;
} else if (messageFlow != null && StringUtils.isNotEmpty(messageFlow.getName())) {
hasName = true;
}