@Override protected BaseElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) { Association association = new Association(); String sourceRef = BpmnJsonConverterUtil.lookForSourceRef(elementNode.get(EDITOR_SHAPE_ID).asText(), modelNode.get(EDITOR_CHILD_SHAPES)); if (sourceRef != null) { association.setSourceRef(sourceRef); String targetId = elementNode.get("target").get(EDITOR_SHAPE_ID).asText(); association.setTargetRef(BpmnJsonConverterUtil.getElementId(shapeMap.get(targetId))); } return association; } }
@Override protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception { Association association = new Association(); BpmnXMLUtil.addXMLLocation(association, xtr); association.setSourceRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_SOURCE_REF)); association.setTargetRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_TARGET_REF)); association.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID)); String asociationDirectionString = xtr.getAttributeValue(null, ATTRIBUTE_ASSOCIATION_DIRECTION); if (StringUtils.isNotEmpty(asociationDirectionString)) { AssociationDirection associationDirection = AssociationDirection.valueOf(asociationDirectionString.toUpperCase()); association.setAssociationDirection(associationDirection); } parseChildElements(getXMLElementName(), association, model, xtr); return association; }
@Override protected BaseElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) { Association association = new Association(); String sourceRef = BpmnJsonConverterUtil.lookForSourceRef(elementNode.get(EDITOR_SHAPE_ID).asText(), modelNode.get(EDITOR_CHILD_SHAPES)); if (sourceRef != null) { association.setSourceRef(sourceRef); String targetId = elementNode.get("target").get(EDITOR_SHAPE_ID).asText(); association.setTargetRef(BpmnJsonConverterUtil.getElementId(shapeMap.get(targetId))); } return association; } }
@Override protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception { Association association = new Association(); BpmnXMLUtil.addXMLLocation(association, xtr); association.setSourceRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_SOURCE_REF)); association.setTargetRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_TARGET_REF)); association.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID)); String asociationDirectionString = xtr.getAttributeValue(null, ATTRIBUTE_ASSOCIATION_DIRECTION); if (StringUtils.isNotEmpty(asociationDirectionString)) { AssociationDirection associationDirection = AssociationDirection.valueOf(asociationDirectionString.toUpperCase()); association.setAssociationDirection(associationDirection); } parseChildElements(getXMLElementName(), association, model, xtr); return association; }
@Override protected BaseElement convertXMLToElement(XMLStreamReader xtr) throws Exception { Association association = new Association(); BpmnXMLUtil.addXMLLocation(association, xtr); association.setSourceRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_SOURCE_REF)); association.setTargetRef(xtr.getAttributeValue(null, ATTRIBUTE_FLOW_TARGET_REF)); association.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID)); if(StringUtils.isEmpty(association.getSourceRef())) { model.addProblem("association element missing attribute 'sourceRef'", xtr); } if(StringUtils.isEmpty(association.getTargetRef())) { model.addProblem("association element missing attribute 'targetRef'", xtr); } return association; }