/** * 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; }
for (AbstractField abstractField : absFields) if (abstractField.getPropertyName().equals(localName))
/** * 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; }
/** * 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 field : fields) if (attribute.getName().compareTo(field.getPropertyName()) == 0)
/** * 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; }
/** * Add a SimpleProperty to this schema * * @param prop * The Property to add */ private void setSpecifiedSimpleTypeProperty(AbstractSimpleProperty prop) { // attribute placement for simple property has been removed // Search in properties to erase for (AbstractField child : getAllProperties()) { if (child.getPropertyName().equals(prop.getPropertyName())) { removeProperty(child); addProperty(prop); return; } } addProperty(prop); }
analyzedPropQualifiedName = child.getPropertyName(); for (AbstractField tmpEmbeddedProperty : getAllProperties()) tmpEmbeddedProperty.getPropertyName().equals(analyzedPropQualifiedName))
if (child.getPropertyName().equals(qualifiedName)) if (child.getPropertyName().equals(qualifiedName))
/** * 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; }
for (AbstractField abstractField : absFields) if (abstractField.getPropertyName().equals(localName))
/** * 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; }
/** * 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; }
/** * 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); }
/** * 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 field : fields) if (attribute.getName().compareTo(field.getPropertyName()) == 0)
/** * 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; }
/** * 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<AbstractField>(array.getContainer().getAllProperties()); } return null; }
/** * Add a SimpleProperty to this schema * * @param prop * The Property to add */ private void setSpecifiedSimpleTypeProperty(AbstractSimpleProperty prop) { // attribute placement for simple property has been removed // Search in properties to erase for (AbstractField child : getAllProperties()) { if (child.getPropertyName().equals(prop.getPropertyName())) { removeProperty(child); addProperty(prop); return; } } addProperty(prop); }
/** * Add a SimpleProperty to this schema * * @param prop * The Property to add */ private void setSpecifiedSimpleTypeProperty(AbstractSimpleProperty prop) { // attribute placement for simple property has been removed // Search in properties to erase for (AbstractField child : getAllProperties()) { if (child.getPropertyName().equals(prop.getPropertyName())) { removeProperty(child); addProperty(prop); return; } } addProperty(prop); }