/** * Remove an attribute of this entity * * @param qualifiedName * the full qualified name of the attribute wanted */ public final void removeAttribute(String qualifiedName) { if (containsAttribute(qualifiedName)) { attributes.remove(qualifiedName); } }
boolean xdefaultFound = false; if (it.hasNext() && it.next().getAttribute(XmpConstants.LANG_NAME).getValue().equals(XmpConstants.X_DEFAULT)) if (xdefault.getAttribute(XmpConstants.LANG_NAME).getValue().equals(XmpConstants.X_DEFAULT))
for (AbstractField child : xmpSchema.getContainer().getAllProperties()) if (child.getPrefix().equals(getPrefix())) analyzedPropQualifiedName = child.getPropertyName(); for (AbstractField tmpEmbeddedProperty : getAllProperties()) tmpEmbeddedProperty.getPropertyName().equals(analyzedPropQualifiedName))
/** * Check if two properties are equal. * * @param prop1 * First property * @param prop2 * Second property * @return True if these properties are equal. */ public boolean isSameProperty(AbstractField prop1, AbstractField prop2) { if (prop1.getClass().equals(prop2.getClass())) { String pn1 = prop1.getPropertyName(); String pn2 = prop2.getPropertyName(); if (pn1 == null) { return pn2 == null; } else { if (pn1.equals(pn2)) { return prop1.equals(prop2); } } } return false; }
private void loadAttributes(AbstractField sp, Element element) { NamedNodeMap nnm = element.getAttributes(); for (int i = 0; i < nnm.getLength(); i++) { Attr attr = (Attr) nnm.item(i); if (XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getPrefix())) { // do nothing } else if (XmpConstants.DEFAULT_RDF_PREFIX.equals(attr.getPrefix()) && XmpConstants.ABOUT_NAME.equals(attr.getLocalName())) { // set about if (sp instanceof XMPSchema) { ((XMPSchema) sp).setAboutAsSimple(attr.getValue()); } } else { Attribute attribute = new Attribute(XMLConstants.XML_NS_URI, attr.getLocalName(), attr.getValue()); sp.setAttribute(attribute); } } }
for (AbstractField abstractField : absFields) if (abstractField.getPropertyName().equals(localName))
private void loadAttributes(AbstractField sp, Element element) { NamedNodeMap nnm = element.getAttributes(); for (int i = 0; i < nnm.getLength(); i++) { Attr attr = (Attr) nnm.item(i); if (XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getPrefix())) { // do nothing } else if (XmpConstants.DEFAULT_RDF_PREFIX.equals(attr.getPrefix()) && XmpConstants.ABOUT_NAME.equals(attr.getLocalName())) { // set about if (sp instanceof XMPSchema) { ((XMPSchema) sp).setAboutAsSimple(attr.getValue()); } } else { Attribute attribute = new Attribute(XMLConstants.XML_NS_URI, attr.getLocalName(), attr.getValue()); sp.setAttribute(attribute); } } }
/** * Retrieve a generic simple type property * * @param qualifiedName * Full qualified name of property wanted * @return The generic simple type property according to its qualified name */ public AbstractField getAbstractProperty(String qualifiedName) { for (AbstractField child : getContainer().getAllProperties()) { if (child.getPropertyName().equals(qualifiedName)) { return child; } } return null; }
for (AbstractField child : arrayProp.getContainer().getAllProperties()) Attribute text = child.getAttribute(XmpConstants.LANG_NAME); if (text != null)
for (AbstractField child : xmpSchema.getContainer().getAllProperties()) if (child.getPrefix().equals(getPrefix())) analyzedPropQualifiedName = child.getPropertyName(); for (AbstractField tmpEmbeddedProperty : getAllProperties()) tmpEmbeddedProperty.getPropertyName().equals(analyzedPropQualifiedName))
/** * Remove an attribute of this entity * * @param qualifiedName * the full qualified name of the attribute wanted */ public final void removeAttribute(String qualifiedName) { if (containsAttribute(qualifiedName)) { attributes.remove(qualifiedName); } }
private void loadAttributes(AbstractField sp, Element element) { NamedNodeMap nnm = element.getAttributes(); for (int i = 0; i < nnm.getLength(); i++) { Attr attr = (Attr) nnm.item(i); if (XMLConstants.XMLNS_ATTRIBUTE.equals(attr.getPrefix())) { // do nothing } else if (XmpConstants.DEFAULT_RDF_PREFIX.equals(attr.getPrefix()) && XmpConstants.ABOUT_NAME.equals(attr.getLocalName())) { // set about if (sp instanceof XMPSchema) { ((XMPSchema) sp).setAboutAsSimple(attr.getValue()); } } else { Attribute attribute = new Attribute(XMLConstants.XML_NS_URI, attr.getLocalName(), attr.getValue()); sp.setAttribute(attribute); } } }
/** * Add a property to the current structure * * @param obj * the property to add */ public final void addProperty(AbstractField obj) { // https://www.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/cs6/XMPSpecificationPart1.pdf // "Each property name in an XMP packet shall be unique within that packet" // "Multiple values are represented using an XMP array value" // "The nested element's element content shall consist of zero or more rdf:li elements, // one for each item in the array" // thus delete existing elements of a property, except for arrays ("li") if (!(this instanceof ArrayProperty)) { container.removePropertiesByName(obj.getPropertyName()); } container.addProperty(obj); }
for (AbstractField child : arrayProp.getContainer().getAllProperties()) Attribute text = child.getAttribute(XmpConstants.LANG_NAME); if (text != null && text.getValue().equals(language))
for (AbstractField child : xmpSchema.getContainer().getAllProperties()) if (child.getPrefix().equals(getPrefix())) analyzedPropQualifiedName = child.getPropertyName(); for (AbstractField tmpEmbeddedProperty : getAllProperties()) tmpEmbeddedProperty.getPropertyName().equals(analyzedPropQualifiedName))
/** * Remove an attribute of this entity * * @param qualifiedName * the full qualified name of the attribute wanted */ public final void removeAttribute(String qualifiedName) { if (containsAttribute(qualifiedName)) { attributes.remove(qualifiedName); } }
for (AbstractField field : fields) if (attribute.getName().compareTo(field.getPropertyName()) == 0)
if (child.getAttribute(XmpConstants.LANG_NAME).getValue().equals(language))
/** * Get an AbstractField list corresponding to the content of an array * property. * * @param name The property name whitout namespace. * @return List of properties contained in the array property. * @throws BadFieldValueException If the property with the requested name isn't an array. */ public List<AbstractField> getUnqualifiedArrayList(String name) throws BadFieldValueException { ArrayProperty array = null; for (AbstractField child : getAllProperties()) { if (child.getPropertyName().equals(name)) { if (child instanceof ArrayProperty) { array = (ArrayProperty) child; break; } throw new BadFieldValueException("Property asked is not an array"); } } if (array != null) { return new ArrayList<>(array.getContainer().getAllProperties()); } return null; }
boolean xdefaultFound = false; if (it.hasNext() && it.next().getAttribute(XmpConstants.LANG_NAME).getValue().equals(XmpConstants.X_DEFAULT)) if (xdefault.getAttribute(XmpConstants.LANG_NAME).getValue().equals(XmpConstants.X_DEFAULT))