Examples of ComplexProperty


Examples of org.apache.padaf.xmpbox.type.ComplexProperty

     *            The value to add to the bag.
     */
    public void addBagValue(String qualifiedSeqName, AbstractField seqValue) {

        String[] splittedQualifiedName = qualifiedSeqName.split(":");
        ComplexProperty bag = (ComplexProperty) getAbstractProperty(qualifiedSeqName);
        if (bag != null) {
            bag.getContainer().addProperty(seqValue);
        } else {
            ComplexProperty newBag = new ComplexProperty(metadata,
                    splittedQualifiedName[0], splittedQualifiedName[1],
                    ComplexProperty.UNORDERED_ARRAY);
            newBag.getContainer().addProperty(seqValue);
            content.addProperty(newBag);
        }
    }
View Full Code Here

Examples of org.apache.padaf.xmpbox.type.ComplexProperty

     *            The value to add to the sequence.
     */
    public void addSequenceValue(String qualifiedSeqName, AbstractField seqValue) {

        String[] splittedQualifiedName = qualifiedSeqName.split(":");
        ComplexProperty seq = (ComplexProperty) getAbstractProperty(qualifiedSeqName);
        if (seq != null) {
            seq.getContainer().addProperty(seqValue);
        } else {
            ComplexProperty newSeq = new ComplexProperty(metadata,
                    splittedQualifiedName[0], splittedQualifiedName[1],
                    ComplexProperty.ORDERED_ARRAY);
            newSeq.getContainer().addProperty(seqValue);
            content.addProperty(newSeq);
        }
    }
View Full Code Here

Examples of org.apache.padaf.xmpbox.type.ComplexProperty

     *            namespace prefix. ie "pdf:Keywords"
     * @param date
     *            The date to remove from the sequence property.
     */
    public void removeSequenceDateValue(String qualifiedSeqName, Calendar date) {
        ComplexProperty seq = (ComplexProperty) 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

Examples of org.apache.padaf.xmpbox.type.ComplexProperty

     *         property does not exist.
     *
     */
    public List<Calendar> getSequenceDateValueList(String qualifiedSeqName) {
        List<Calendar> retval = null;
        ComplexProperty seq = (ComplexProperty) getAbstractProperty(qualifiedSeqName);
        if (seq != null) {
            retval = new ArrayList<Calendar>();
            Iterator<AbstractField> it = seq.getContainer().getAllProperties()
            .iterator();
            AbstractField tmp;
            while (it.hasNext()) {
                tmp = it.next();
                if (tmp instanceof DateType) {
View Full Code Here

Examples of org.apache.padaf.xmpbox.type.ComplexProperty

     *            The value of the property in the specified language.
     */
    public void setLanguagePropertyValue(String qualifiedName, String language,
            String value) {
        AbstractField property = getAbstractProperty(qualifiedName);
        ComplexProperty prop;
        if (property != null) {
            // Analyzing content of property
            if (property instanceof ComplexProperty) {
                prop = (ComplexProperty) property;
                Iterator<AbstractField> itCplx = prop.getContainer()
                .getAllProperties().iterator();
                // try to find the same lang definition
                AbstractField tmp;
                // Try to find a definition
                while (itCplx.hasNext()) {
                    tmp = itCplx.next();
                    // System.err.println(tmp.getAttribute("xml:lang").getStringValue());
                    if (tmp.getAttribute("xml:lang").getValue()
                            .equals(language)) {
                        // the same language has been found
                        if (value == null) {
                            // if value null, erase this definition
                            prop.getContainer().removeProperty(tmp);
                        } else {
                            prop.getContainer().removeProperty(tmp);
                            TextType langValue;
                            langValue = new TextType(metadata, "rdf", "li",
                                    value);

                            langValue.setAttribute(new Attribute(null, "xml",
                                    "lang", language));
                            prop.getContainer().addProperty(langValue);
                        }
                        reorganizeAltOrder(prop.getContainer());
                        return;
                    }
                }
                // if no definition found, we add a new one
                TextType langValue;
                langValue = new TextType(metadata, "rdf", "li", value);
                langValue.setAttribute(new Attribute(null, "xml", "lang",
                        language));
                prop.getContainer().addProperty(langValue);
                reorganizeAltOrder(prop.getContainer());
            }
        } else {
            String[] splittedQualifiedName = qualifiedName.split(":");
            prop = new ComplexProperty(metadata, splittedQualifiedName[0],
                    splittedQualifiedName[1], ComplexProperty.ALTERNATIVE_ARRAY);
            TextType langValue;
            langValue = new TextType(metadata, "rdf", "li", value);
            langValue
            .setAttribute(new Attribute(null, "xml", "lang", language));
            prop.getContainer().addProperty(langValue);
            content.addProperty(prop);
        }
    }
View Full Code Here

Examples of org.apache.padaf.xmpbox.type.ComplexProperty

    public String getLanguagePropertyValue(String qualifiedName, String expectedLanguage) {
        String language = (expectedLanguage!=null)?expectedLanguage:"x-default";
        AbstractField property = getAbstractProperty(qualifiedName);
        if (property != null) {
            if (property instanceof ComplexProperty) {
                ComplexProperty prop = (ComplexProperty) property;
                Iterator<AbstractField> langsDef = prop.getContainer()
                .getAllProperties().iterator();
                AbstractField tmp;
                Attribute text;
                while (langsDef.hasNext()) {
                    tmp = langsDef.next();
View Full Code Here

Examples of org.apache.padaf.xmpbox.type.ComplexProperty

        List<String> retval = new ArrayList<String>();

        AbstractField property = getAbstractProperty(qualifiedName);
        if (property != null) {
            if (property instanceof ComplexProperty) {
                ComplexProperty prop = (ComplexProperty) property;
                Iterator<AbstractField> langsDef = prop.getContainer()
                .getAllProperties().iterator();
                AbstractField tmp;
                Attribute text;
                while (langsDef.hasNext()) {
                    tmp = langsDef.next();
View Full Code Here

Examples of org.apache.padaf.xmpbox.type.ComplexProperty

     * @throws BadFieldValueException
     *             Property not contains property (not complex property)
     */
    public List<AbstractField> getArrayList(String qualifiedName)
    throws BadFieldValueException {
        ComplexProperty array = null;
        Iterator<AbstractField> itProp = content.getAllProperties().iterator();
        AbstractField tmp;
        while (itProp.hasNext()) {
            tmp = itProp.next();
            if (tmp.getQualifiedName().equals(qualifiedName)) {
                if (tmp instanceof ComplexProperty) {
                    array = (ComplexProperty) tmp;
                    break;
                } else {
                    throw new BadFieldValueException(
                    "Property asked not seems to be an array");
                }

            }
        }
        if (array != null) {
            Iterator<AbstractField> it = array.getContainer()
            .getAllProperties().iterator();
            List<AbstractField> list = new ArrayList<AbstractField>();
            while (it.hasNext()) {
                list.add(it.next());
            }
View Full Code Here

Examples of org.apache.padaf.xmpbox.type.ComplexProperty

  protected void parseBagProperty(XMPMetadata metadata, QName bagName,
      XmpPropertyType stype, ComplexPropertyContainer container)
          throws XmpUnexpectedTypeException, XmpParsingException,
          XMLStreamException, XmpUnknownPropertyTypeException,
          XmpPropertyFormatException {
    ComplexProperty bag = new ComplexProperty(metadata,
        bagName.getPrefix(), bagName.getLocalPart(),
        ComplexProperty.UNORDERED_ARRAY);
    container.addProperty(bag);
    // <rdf:Bag>
    expectNextSpecificTag(XMLStreamReader.START_ELEMENT, BAG_NAME, "Expected Bag Declaration");
    // Each property definition
    int elmtType = reader.get().nextTag();
    while ((elmtType != XMLStreamReader.END_ELEMENT)
        && !reader.get().getName().getLocalPart().equals(BAG_NAME)) {
      parseXmpSimpleProperty(metadata, reader.get().getName(), stype, bag.getContainer());
      elmtType = reader.get().nextTag();

    }
    expectNextSpecificTag(XMLStreamReader.END_ELEMENT, bagName
        .getLocalPart(), "Expected end of Bag property");
View Full Code Here

Examples of org.apache.padaf.xmpbox.type.ComplexProperty

  protected void parseComplexBagProperty(XMPMetadata metadata, QName bagName, StructuredPropertyParser complexParser,
      ComplexPropertyContainer container)
          throws XmpUnexpectedTypeException, XmpParsingException,
          XMLStreamException, XmpUnknownPropertyTypeException,
          XmpPropertyFormatException {
    ComplexProperty bag = new ComplexProperty(metadata,
        bagName.getPrefix(), bagName.getLocalPart(),
        ComplexProperty.UNORDERED_ARRAY);
    container.addProperty(bag);
    // <rdf:Bag>
    expectNextSpecificTag(XMLStreamReader.START_ELEMENT, BAG_NAME,
        "Expected Bag Declaration");
    // Each property definition
    int elmtType = reader.get().nextTag();
    while ((elmtType != XMLStreamReader.END_ELEMENT)
        && !reader.get().getName().getLocalPart().equals(BAG_NAME)) {
      complexParser.parse(metadata, reader.get().getName(), bag.getContainer());
      elmtType = reader.get().nextTag();

    }
    expectNextSpecificTag(XMLStreamReader.END_ELEMENT, bagName
        .getLocalPart(), "Expected end of Bag property");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.