/** * Finds the Alfresco extensions within the given extensions. */ public static List<CmisExtensionElement> findAlfrescoExtensions(List<CmisExtensionElement> extensions) { if (extensions == null || extensions.isEmpty()) { return null; } for (CmisExtensionElement ext : extensions) { if (ALFRESCO_NAMESPACE.equals(ext.getNamespace())) { return ext.getChildren(); } } return null; }
/** * Copy constructor. */ public CmisExtensionElementImpl(CmisExtensionElement element) { if (element == null) { throw new IllegalArgumentException("Element must set!"); } if (element.getName() == null) { throw new IllegalArgumentException("Name must set!"); } this.name = element.getName(); this.namespace = element.getNamespace(); this.value = element.getValue(); this.children = element.getChildren(); }
/** * Copy constructor. */ public CmisExtensionElementImpl(CmisExtensionElement element) { if (element == null) { throw new IllegalArgumentException("Element must set!"); } if (element.getName() == null) { throw new IllegalArgumentException("Name must set!"); } this.name = element.getName(); this.namespace = element.getNamespace(); this.value = element.getValue(); this.children = element.getChildren(); }
/** * Converts a CMIS extension element to a DOM node. */ private static Node convertCmisExtensionElementToNode(CmisExtensionElement source, Element parent, Document doc) { if (source == null) { return null; } Element element = doc.createElementNS( (source.getNamespace() == null ? DEFAULT_EXTENSION_NS : source.getNamespace()), source.getName()); if (source.getValue() != null) { element.appendChild(doc.createTextNode(source.getValue())); } else { for (CmisExtensionElement child : source.getChildren()) { element.appendChild(convertCmisExtensionElementToNode(child, element, doc)); } } // set attributes if (source.getAttributes() != null) { for (Map.Entry<String, String> e : source.getAttributes().entrySet()) { element.setAttributeNS((source.getNamespace() == null ? DEFAULT_EXTENSION_NS : source.getNamespace()), e.getKey(), e.getValue()); } } return element; }
writer.writeCharacters(source.getValue()); } else { if (source.getChildren() != null) { for (CmisExtensionElement child : source.getChildren()) { writeExtensionElement(writer, child, ns);
root.appendChild(doc.createTextNode(source.getValue())); } else { for (CmisExtensionElement child : source.getChildren()) { root.appendChild(convertCmisExtensionElementToNode(child, root, doc));
for (CmisExtensionElement property : extension.getChildren()) try for (CmisExtensionElement propertyValues : property.getChildren())
/** * Makes a deep copy of an extension element. */ private CmisExtensionElement copy(CmisExtensionElement element) { if (element == null) { return null; } Map<String, String> attrs = (element.getAttributes() != null ? new HashMap<String, String>( element.getAttributes()) : null); List<CmisExtensionElement> children = element.getChildren(); if (isNotEmpty(children)) { List<CmisExtensionElement> copyChildren = new ArrayList<CmisExtensionElement>(children.size()); for (CmisExtensionElement child : children) { copyChildren.add(copy(child)); } return new CmisExtensionElementImpl(element.getNamespace(), element.getName(), attrs, copyChildren); } else { return new CmisExtensionElementImpl(element.getNamespace(), element.getName(), attrs, element.getValue()); } }
private void setAspectProperties(NodeRef nodeRef, boolean isNameChanging, CmisExtensionElement aspectExtension) if (aspectExtension.getChildren() == null) Map<QName, List<Serializable>> aspectProperties = new HashMap<QName, List<Serializable>>(); for (CmisExtensionElement extension : aspectExtension.getChildren()) else if (PROPERTIES.equals(extension.getName()) && (extension.getChildren() != null)) for (CmisExtensionElement property : extension.getChildren()) if ((propertyId == null) || (property.getChildren() == null)) if (property.getChildren() != null) for (CmisExtensionElement valueElement : property.getChildren())
private void setAspectProperties(NodeRef nodeRef, boolean isNameChanging, CmisExtensionElement aspectExtension) if (aspectExtension.getChildren() == null) Map<QName, List<Serializable>> aspectProperties = new HashMap<QName, List<Serializable>>(); for (CmisExtensionElement extension : aspectExtension.getChildren()) else if (PROPERTIES.equals(extension.getName()) && (extension.getChildren() != null)) for (CmisExtensionElement property : extension.getChildren()) if ((propertyId == null) || (property.getChildren() == null)) if (property.getChildren() != null) for (CmisExtensionElement valueElement : property.getChildren())
writer.text(source.getValue()); } else { if (source.getChildren() != null) { for (CmisExtensionElement child : source.getChildren()) { writeExtensionElement(writer, child, ns);
private static void addExtensionToTarget(final CmisExtensionElement ext, final JSONObject target) { if (ext == null) { return; } Object value = null; if (isNotEmpty(ext.getChildren())) { value = convertExtensionList(ext.getChildren()); } else { value = ext.getValue(); } if (!target.containsKey(ext.getName())) { target.put(ext.getName(), value); } else { Object extValue = target.get(ext.getName()); JSONArray array; if (extValue instanceof JSONArray) { array = (JSONArray) extValue; } else { array = new JSONArray(); array.add(extValue); } array.add(value); target.put(ext.getName(), array); } }
private static void addExtensionToTarget(final CmisExtensionElement ext, final JSONObject target) { if (ext == null) { return; } Object value = null; if (isNotEmpty(ext.getChildren())) { value = convertExtensionList(ext.getChildren()); } else { value = ext.getValue(); } if (!target.containsKey(ext.getName())) { target.put(ext.getName(), value); } else { Object extValue = target.get(ext.getName()); JSONArray array; if (extValue instanceof JSONArray) { array = (JSONArray) extValue; } else { array = new JSONArray(); array.add(extValue); } array.add(value); target.put(ext.getName(), array); } }
List<CmisExtensionElement> extensions = objectData.getProperties().getExtensions().iterator().next().getChildren(); List<CmisExtensionElement> propExtensions = extension.getChildren(); assertTrue("cmisObject should contain aspect properties", propExtensions.size() > 0); for (CmisExtensionElement prop : propExtensions)
List<CmisExtensionElement> extensions = propertyExtensionList.iterator().next().getChildren(); for (CmisExtensionElement extension : extensions) List<CmisExtensionElement> propExtensions = extension.getChildren(); assertTrue("cmisObject should contain aspect properties", propExtensions.size() > 0); for (CmisExtensionElement prop : propExtensions)
for (CmisExtensionElement cmisEE : object.getProperties().getExtensions().get(0).getChildren()) for (CmisExtensionElement cmisEE : latestVersion.getProperties().getExtensions().get(0).getChildren())