Search in sources :

Example 16 with ArrayProperty

use of org.apache.xmpbox.type.ArrayProperty in project pdfbox by apache.

the class XMPSchema method addBagValue.

/**
 * Add a new value to a bag property.
 *
 * @param qualifiedSeqName
 *            The name of the sequence property, it must include the namespace prefix, e.g. "pdf:Keywords"
 * @param seqValue
 *            The value to add to the bag.
 */
public void addBagValue(String qualifiedSeqName, AbstractField seqValue) {
    ArrayProperty bag = (ArrayProperty) getAbstractProperty(qualifiedSeqName);
    if (bag != null) {
        bag.getContainer().addProperty(seqValue);
    } else {
        ArrayProperty newBag = createArrayProperty(qualifiedSeqName, Cardinality.Bag);
        newBag.getContainer().addProperty(seqValue);
        addProperty(newBag);
    }
}
Also used : ArrayProperty(org.apache.xmpbox.type.ArrayProperty)

Example 17 with ArrayProperty

use of org.apache.xmpbox.type.ArrayProperty in project pdfbox by apache.

the class XMPSchema method addUnqualifiedSequenceValue.

/**
 * Add a new value to a sequence property.
 *
 * @param seqName
 *            The name of the sequence property, it must include the namespace prefix, e.g. "pdf:Keywords"
 * @param seqValue
 *            The value to add to the sequence.
 */
public void addUnqualifiedSequenceValue(String seqName, AbstractField seqValue) {
    ArrayProperty seq = (ArrayProperty) getAbstractProperty(seqName);
    if (seq != null) {
        seq.getContainer().addProperty(seqValue);
    } else {
        ArrayProperty newSeq = createArrayProperty(seqName, Cardinality.Seq);
        newSeq.getContainer().addProperty(seqValue);
        addProperty(newSeq);
    }
}
Also used : ArrayProperty(org.apache.xmpbox.type.ArrayProperty)

Aggregations

ArrayProperty (org.apache.xmpbox.type.ArrayProperty)17 AbstractField (org.apache.xmpbox.type.AbstractField)11 TextType (org.apache.xmpbox.type.TextType)5 Attribute (org.apache.xmpbox.type.Attribute)4 TypeMapping (org.apache.xmpbox.type.TypeMapping)4 ArrayList (java.util.ArrayList)3 AbstractStructuredType (org.apache.xmpbox.type.AbstractStructuredType)3 Element (org.w3c.dom.Element)3 List (java.util.List)2 AbstractSimpleProperty (org.apache.xmpbox.type.AbstractSimpleProperty)2 DefinedStructuredType (org.apache.xmpbox.type.DefinedStructuredType)2 PDFAPropertyType (org.apache.xmpbox.type.PDFAPropertyType)2 PropertiesDescription (org.apache.xmpbox.type.PropertiesDescription)2 PropertyType (org.apache.xmpbox.type.PropertyType)2 Method (java.lang.reflect.Method)1 Calendar (java.util.Calendar)1 Map (java.util.Map)1 QName (javax.xml.namespace.QName)1 ValidationError (org.apache.pdfbox.preflight.ValidationResult.ValidationError)1 XMPMetadata (org.apache.xmpbox.XMPMetadata)1