/** * 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; }
/** * 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; }
(source.getNamespace() == null ? DEFAULT_EXTENSION_NS : source.getNamespace()), source.getName()); doc.appendChild(root); root.setAttributeNS((source.getNamespace() == null ? DEFAULT_EXTENSION_NS : source.getNamespace()), e.getKey(), e.getValue());
if (source.getNamespace() != null) { String prefix = writer.getPrefix(source.getNamespace()); if (prefix == null) { int p = ns.indexOf(source.getNamespace()); ns.add(source.getNamespace()); addedNamespace = true; } else { writer.writeStartElement(prefix, source.getName(), source.getNamespace()); writer.writeNamespace(prefix, source.getNamespace());
/** * 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(); }
/** * 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()); } }
if (source.getNamespace() != null) { namespace = source.getNamespace(); writer.startTag(source.getNamespace(), source.getName());
if (!ALFRESCO_EXTENSION_NAMESPACE.equals(extension.getNamespace()))
if (!ALFRESCO_EXTENSION_NAMESPACE.equals(extension.getNamespace()))
if (ALFRESCO_EXTENSION_NAMESPACE.equals(extension.getNamespace()) && SET_ASPECTS.equals(extension.getName()))
if (ALFRESCO_EXTENSION_NAMESPACE.equals(extension.getNamespace()) && SET_ASPECTS.equals(extension.getName()))