Package org.apache.padaf.xmpbox.type

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


    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

        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

     * @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

  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

  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

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

    }
    expectNextSpecificTag(XMLStreamReader.END_ELEMENT, seqName
View Full Code Here

  protected void parseAltProperty(XMPMetadata metadata, QName altName,
      XmpPropertyType stype, ComplexPropertyContainer container)
          throws XmpUnexpectedTypeException, XmpParsingException,
          XMLStreamException, XmpUnknownPropertyTypeException,
          XmpPropertyFormatException {
    ComplexProperty alt = new ComplexProperty(metadata,
        altName.getPrefix(), altName.getLocalPart(),
        ComplexProperty.ALTERNATIVE_ARRAY);
    container.addProperty(alt);
    // <rdf:Alt>
    expectNextSpecificTag(XMLStreamReader.START_ELEMENT, ALT_NAME,
        "Expected Alt Declaration");
    int elmtType = reader.get().nextTag();
    while (!((elmtType == XMLStreamReader.END_ELEMENT) && reader.get()
        .getName().getLocalPart().equals(ALT_NAME))) {
      parseXmpSimpleProperty(metadata, reader.get().getName(), stype, alt
          .getContainer());
      elmtType = reader.get().nextTag();

    }
    // <dc:description><rdf:Alt><rdf:li>sujet</rdf:li></rdf:Alt></dc:description>
View Full Code Here

  private void parseAltThumbnailProperty(XMPMetadata metadata, QName altName,
      ComplexPropertyContainer container)
          throws XmpUnexpectedTypeException, XmpParsingException,
          XMLStreamException, XmpUnknownPropertyTypeException,
          XmpPropertyFormatException {
    ComplexProperty alt = new ComplexProperty(metadata,
        altName.getPrefix(), altName.getLocalPart(),
        ComplexProperty.ALTERNATIVE_ARRAY);
    container.addProperty(alt);
    // <rdf:Alt>
    expectNextSpecificTag(XMLStreamReader.START_ELEMENT, ALT_NAME,
        "Expected Alt Declaration");
    int elmtType = reader.get().nextTag();
    while (!((elmtType == XMLStreamReader.END_ELEMENT) && reader.get()
        .getName().getLocalPart().equals(ALT_NAME))) {
      parseThumbnailProperty(metadata, reader.get().getName(), alt
          .getContainer());
      elmtType = reader.get().nextTag();
    }

    // <dc:description><rdf:Alt><rdf:li>sujet</rdf:li></rdf:Alt></dc:description>
View Full Code Here

   *            Image data
   */
  public void addThumbnails(Integer height, Integer width, String format,
      String img) {
    if (altThumbs == null) {
      altThumbs = new ComplexProperty(metadata, localPrefix, THUMBNAILS,
          ComplexProperty.ALTERNATIVE_ARRAY);
      addProperty(altThumbs);
    }
    ThumbnailType thumb = new ThumbnailType(metadata, "rdf", "li");
    /*
 
View Full Code Here

TOP

Related Classes of org.apache.padaf.xmpbox.type.ComplexProperty

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.