Package org.apache.xmpbox.type

Examples of org.apache.xmpbox.type.ArrayProperty


                            "Found invalid prefix for PDF/A extension, found '" + xmpSchema.getPrefix()
                                    + "', should be '" + stPdfaExt.preferedPrefix() + "'");
                }
                // create schema and types
                PDFAExtensionSchema pes = (PDFAExtensionSchema) xmpSchema;
                ArrayProperty sp = pes.getSchemasProperty();
                for (AbstractField af : sp.getAllProperties())
                {
                    if (af instanceof PDFASchemaType)
                    {
                        PDFASchemaType st = (PDFASchemaType) af;
                        String namespaceUri = st.getNamespaceURI();
                        String prefix = st.getPrefixValue();
                        ArrayProperty properties = st.getProperty();
                        ArrayProperty valueTypes = st.getValueType();
                        XMPSchemaFactory xsf = tm.getSchemaFactory(namespaceUri);
                        // retrieve namespaces
                        if (xsf == null)
                        {
                            // create namespace with no field
                            tm.addNewNameSpace(namespaceUri, prefix);
                            xsf = tm.getSchemaFactory(namespaceUri);
                        }
                        // populate value type
                        if (valueTypes != null)
                        {
                            for (AbstractField af2 : valueTypes.getAllProperties())
                            {
                                if (af2 instanceof PDFATypeType)
                                {
                                    PDFATypeType type = (PDFATypeType) af2;
                                    String ttype = type.getType();
                                    String tns = type.getNamespaceURI();
                                    String tprefix = type.getPrefixValue();
                                    String tdescription = type.getDescription();
                                    ArrayProperty fields = type.getFields();
                                    if (ttype == null || tns == null || tprefix == null || tdescription == null)
                                    {
                                        // all fields are mandatory
                                        throw new XmpParsingException(ErrorType.RequiredProperty,
                                                "Missing field in type definition");
                                    }
                                    // create the structured type
                                    DefinedStructuredType structuredType = new DefinedStructuredType(meta, tns,
                                            tprefix, null); // TODO
                                                            // maybe
                                                            // a name
                                                            // exists
                                    if (fields != null)
                                    {
                                        List<AbstractField> definedFields = fields.getAllProperties();
                                        for (AbstractField af3 : definedFields)
                                        {
                                            if (af3 instanceof PDFAFieldType)
                                            {
                                                PDFAFieldType field = (PDFAFieldType) af3;
View Full Code Here


     * @param fieldValue
     *            the field value
     */
    private void removeUnqualifiedArrayValue(String arrayName, String fieldValue)
    {
        ArrayProperty array = (ArrayProperty) getAbstractProperty(arrayName);
        if (array != null)
        {
            ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
            Iterator<AbstractField> it = array.getContainer().getAllProperties().iterator();
            AbstractSimpleProperty tmp;
            while (it.hasNext())
            {
                tmp = (AbstractSimpleProperty) it.next();
                if (tmp.getStringValue().equals(fieldValue))
                {
                    toDelete.add(tmp);
                }
            }
            Iterator<AbstractField> eraseProperties = toDelete.iterator();
            while (eraseProperties.hasNext())
            {
                array.getContainer().removeProperty(eraseProperties.next());
            }
        }

    }
View Full Code Here

        this.internalAddBagValue(simpleName, bagValue);
    }

    private void internalAddBagValue(String qualifiedBagName, String bagValue)
    {
        ArrayProperty bag = (ArrayProperty) getAbstractProperty(qualifiedBagName);
        TextType li = createTextType(XmpConstants.LIST_NAME, bagValue);
        if (bag != null)
        {
            bag.getContainer().addProperty(li);
        }
        else
        {
            ArrayProperty newBag = createArrayProperty(qualifiedBagName, Cardinality.Bag);
            newBag.getContainer().addProperty(li);
            addProperty(newBag);
        }
    }
View Full Code Here

     *
     * @return All values of the bag property in a list.
     */
    public List<String> getUnqualifiedBagValueList(String bagName)
    {
        ArrayProperty array = (ArrayProperty) getAbstractProperty(bagName);
        if (array != null)
        {
            return array.getElementsAsString();
        }
        else
        {
            return null;
        }
View Full Code Here

     *            the elementable field value
     */
    public void removeUnqualifiedArrayValue(String arrayName, AbstractField fieldValue)
    {
        String qualifiedArrayName = arrayName;
        ArrayProperty array = (ArrayProperty) getAbstractProperty(qualifiedArrayName);
        if (array != null)
        {
            ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
            Iterator<AbstractField> it = array.getContainer().getAllProperties().iterator();
            AbstractSimpleProperty tmp;
            while (it.hasNext())
            {
                tmp = (AbstractSimpleProperty) it.next();
                if (tmp.equals(fieldValue))
                {
                    toDelete.add(tmp);
                }
            }
            Iterator<AbstractField> eraseProperties = toDelete.iterator();
            while (eraseProperties.hasNext())
            {
                array.getContainer().removeProperty(eraseProperties.next());
            }
        }
    }
View Full Code Here

     *            The value to add to the sequence.
     */
    public void addUnqualifiedSequenceValue(String simpleSeqName, String seqValue)
    {
        String qualifiedSeqName = simpleSeqName;
        ArrayProperty seq = (ArrayProperty) getAbstractProperty(qualifiedSeqName);
        TextType li = createTextType(XmpConstants.LIST_NAME, seqValue);
        if (seq != null)
        {
            seq.getContainer().addProperty(li);
        }
        else
        {
            ArrayProperty newSeq = createArrayProperty(simpleSeqName, Cardinality.Seq);
            newSeq.getContainer().addProperty(li);
            addProperty(newSeq);
        }
    }
View Full Code Here

     * @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);
        }
    }
View Full Code Here

     *            The value to add to the sequence.
     */
    public void addUnqualifiedSequenceValue(String seqName, AbstractField seqValue)
    {
        String qualifiedSeqName = seqName;
        ArrayProperty seq = (ArrayProperty) getAbstractProperty(qualifiedSeqName);
        if (seq != null)
        {
            seq.getContainer().addProperty(seqValue);
        }
        else
        {
            ArrayProperty newSeq = createArrayProperty(seqName, Cardinality.Seq);
            newSeq.getContainer().addProperty(seqValue);
            addProperty(newSeq);
        }
    }
View Full Code Here

     *
     * @return A read-only list of java.lang.String objects or null if the property does not exist.
     */
    public List<String> getUnqualifiedSequenceValueList(String seqName)
    {
        ArrayProperty array = (ArrayProperty) getAbstractProperty(seqName);
        if (array != null)
        {
            return array.getElementsAsString();
        }
        else
        {
            return null;
        }
View Full Code Here

     *            The date to remove from the sequence property.
     */
    public void removeUnqualifiedSequenceDateValue(String seqName, Calendar date)
    {
        String qualifiedSeqName = seqName;
        ArrayProperty seq = (ArrayProperty) getAbstractProperty(qualifiedSeqName);
        if (seq != null)
        {
            ArrayList<AbstractField> toDelete = new ArrayList<AbstractField>();
            Iterator<AbstractField> it = seq.getContainer().getAllProperties().iterator();
            AbstractField tmp;
            while (it.hasNext())
            {
                tmp = it.next();
                if (tmp instanceof DateType)
                {
                    if (((DateType) tmp).getValue().equals(date))
                    {
                        toDelete.add(tmp);

                    }
                }
            }
            Iterator<AbstractField> eraseProperties = toDelete.iterator();
            while (eraseProperties.hasNext())
            {
                seq.getContainer().removeProperty(eraseProperties.next());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.xmpbox.type.ArrayProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.