Package org.apache.padaf.xmpbox.type

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


  }

  @Test
  public void testArrayList() throws Exception {
    ComplexProperty newSeq = new ComplexProperty(parent, "nsSchem",
        "seqType", ComplexProperty.ORDERED_ARRAY);
    TextType li1 = new TextType(parent, "rdf", "li", "valeur1");
    TextType li2 = new TextType(parent, "rdf", "li", "valeur2");
    newSeq.getContainer().addProperty(li1);
    newSeq.getContainer().addProperty(li2);
    schem.addProperty(newSeq);
    List<AbstractField> list = schem.getArrayList("nsSchem:seqType");
    Assert.assertTrue(list.contains(li1));
    Assert.assertTrue(list.contains(li2));
View Full Code Here


     *            the full qualified name of property wanted
     * @param fieldValue
     *            the field value
     */
    private void removeArrayValue(String qualifiedArrayName, String fieldValue) {
        ComplexProperty array = (ComplexProperty) 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.getStringValue().equals(fieldValue)) {
                    toDelete.add(tmp);
                }
            }
            Iterator<AbstractField> eraseProperties = toDelete.iterator();
            while (eraseProperties.hasNext()) {
                array.getContainer().removeProperty(eraseProperties.next());
            }
        }

    }
View Full Code Here

     * @param bagValue
     *            The value to add to the bagList.
     */
    public void addBagValue(String qualifiedBagName, String bagValue) {
        String[] splittedQualifiedName = qualifiedBagName.split(":");
        ComplexProperty bag = (ComplexProperty) getAbstractProperty(qualifiedBagName);
        TextType li = new TextType(metadata, "rdf", "li", bagValue);
        if (bag != null) {
            bag.getContainer().addProperty(li);
        } else {
            ComplexProperty newBag = new ComplexProperty(metadata,
                    splittedQualifiedName[0], splittedQualifiedName[1],
                    ComplexProperty.UNORDERED_ARRAY);
            newBag.getContainer().addProperty(li);
            content.addProperty(newBag);
        }
    }
View Full Code Here

     *            the full qualified name of property concerned
     * @return String list which represents content of array property
     */
    private List<String> getArrayListToString(String qualifiedArrayName) {
        List<String> retval = null;
        ComplexProperty array = (ComplexProperty) getAbstractProperty(qualifiedArrayName);
        if (array != null) {
            retval = new ArrayList<String>();
            Iterator<AbstractField> it = array.getContainer()
            .getAllProperties().iterator();
            AbstractSimpleProperty tmp;
            while (it.hasNext()) {
                tmp = (AbstractSimpleProperty) it.next();
                retval.add(tmp.getStringValue());
View Full Code Here

     * @param fieldValue
     *            the elementable field value
     */
    public void removeArrayValue(String qualifiedArrayName,
            Elementable fieldValue) {
        ComplexProperty array = (ComplexProperty) 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

     * @param seqValue
     *            The value to add to the sequence.
     */
    public void addSequenceValue(String qualifiedSeqName, String seqValue) {
        String[] splittedQualifiedName = qualifiedSeqName.split(":");
        ComplexProperty seq = (ComplexProperty) getAbstractProperty(qualifiedSeqName);
        TextType li = new TextType(metadata, "rdf", "li", seqValue);
        if (seq != null) {
            seq.getContainer().addProperty(li);
        } else {
            ComplexProperty newSeq = new ComplexProperty(metadata,
                    splittedQualifiedName[0], splittedQualifiedName[1],
                    ComplexProperty.ORDERED_ARRAY);
            newSeq.getContainer().addProperty(li);
            content.addProperty(newSeq);
        }

    }
View Full Code Here

     *            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

     *            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

     *            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

     *         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

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.