Examples of AbstractSimpleProperty


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

        Object[] propertyArgs = new Object[] { metadata,
                splittedQualifiedName[0], splittedQualifiedName[1],
                propertyValue };
        Constructor<? extends AbstractSimpleProperty> propertyConstructor;

        AbstractSimpleProperty specifiedTypeProperty;
        if (propertyValue == null) {
            // Search in properties to erase
            Iterator<AbstractField> it = content.getAllProperties().iterator();
            AbstractField tmp;
            while (it.hasNext()) {
View Full Code Here

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

        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()) {
View Full Code Here

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

        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());
            }
            retval = Collections.unmodifiableList(retval);
        }
        return retval;
    }
View Full Code Here

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

        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()) {
View Full Code Here

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

   *             When error during reading the rest of xmp stream
   */
  protected void parseXmpSimpleProperty(XMPMetadata metadata,  QName propertyName, XmpPropertyType stype, ComplexPropertyContainer container
          throws XmpUnknownPropertyTypeException, XmpPropertyFormatException,  XMLStreamException {
    try {
      AbstractSimpleProperty prop = null;
      ArrayList<Attribute> attributes = new ArrayList<Attribute>();
      int cpt = reader.get().getAttributeCount();
      for (int i = 0; i < cpt; i++) {
        attributes.add(new Attribute(null, reader.get()
            .getAttributePrefix(i), reader.get()
            .getAttributeLocalName(i), reader.get()
            .getAttributeValue(i)));
      }
      if (stype == XmpPropertyType.Text) {
        prop = new TextType(metadata, propertyName.getPrefix(),
            propertyName.getLocalPart(), reader.get()
            .getElementText());
      } else if (stype == XmpPropertyType.Integer) {
        prop = new IntegerType(metadata, propertyName.getPrefix(),
            propertyName.getLocalPart(), reader.get()
            .getElementText());
      } else if (stype == XmpPropertyType.Date) {
        prop = new DateType(metadata, propertyName.getPrefix(),
            propertyName.getLocalPart(), reader.get()
            .getElementText());
      } else if (stype == XmpPropertyType.Boolean) {
        prop = new BooleanType(metadata, propertyName.getPrefix(),
            propertyName.getLocalPart(), reader.get()
            .getElementText());
      } else if (stype == XmpPropertyType.Real) {
        prop = new RealType(metadata, propertyName.getPrefix(),
            propertyName.getLocalPart(), reader.get()
            .getElementText());
      }
      if (prop != null) {
        container.addProperty(prop);
        // ADD ATTRIBUTES
        for (Attribute att : attributes) {
          prop.setAttribute(att);
        }
      } else {
        throw new XmpUnknownPropertyTypeException(
            "Unknown simple type found");
      }
View Full Code Here

Examples of org.apache.xmpbox.type.AbstractSimpleProperty

    {
        if (cardinality != Cardinality.Simple)
            return;
        // only test simple properties
        Object value = TypeTestingHelper.getJavaValue(type);
        AbstractSimpleProperty property = getSchema().instanciateSimple(fieldName, value);
        getSchema().addProperty(property);
        String qn = getPropertyQualifiedName(fieldName);
        Assert.assertNotNull(getSchema().getProperty(fieldName));
        // check other properties not modified
        List<Field> fields = TypeTestingHelper.getXmpFields(getSchemaClass());
View Full Code Here

Examples of org.apache.xmpbox.type.AbstractSimpleProperty

    {
        if (cardinality == Cardinality.Simple)
            return;
        // only test array properties
        Object value = TypeTestingHelper.getJavaValue(type);
        AbstractSimpleProperty property = getSchema().instanciateSimple(fieldName, value);
        switch (cardinality)
        {
        case Seq:
            getSchema().addUnqualifiedSequenceValue(property.getPropertyName(), property);
            break;
        case Bag:
            getSchema().addBagValue(property.getPropertyName(), property);
            break;
        default:
            throw new Exception("Unexpected case in test : " + cardinality.name());
        }
        String qn = getPropertyQualifiedName(fieldName);
View Full Code Here

Examples of org.apache.xmpbox.type.AbstractSimpleProperty

    {
        if (cardinality != Cardinality.Simple)
            return;
        String setter = TypeTestingHelper.calculateSimpleSetter(fieldName) + "Property";
        Object value = TypeTestingHelper.getJavaValue(type);
        AbstractSimpleProperty asp = typeMapping.instanciateSimpleProperty(getSchema().getNamespace(), getSchema()
                .getPrefix(), fieldName, value, type);
        Method set = getSchemaClass().getMethod(setter, new Class<?>[] { type.getImplementingClass() });
        set.invoke(getSchema(), new Object[] { asp });
        // check property set
        AbstractSimpleProperty stored = (AbstractSimpleProperty) getSchema().getProperty(fieldName);
        Assert.assertEquals(value, stored.getValue());
        // check getter
        String getter = TypeTestingHelper.calculateSimpleGetter(fieldName) + "Property";
        Method get = getSchemaClass().getMethod(getter, new Class[0]);
        Object result = get.invoke(getSchema(), new Object[0]);
        Assert.assertTrue(type.getImplementingClass().isAssignableFrom(result.getClass()));
View Full Code Here

Examples of org.apache.xmpbox.type.AbstractSimpleProperty

                            type = TypeMapping.createPropertyType(Types.Text, Cardinality.Simple);
                        }
                                          
                        try
                        {
                            AbstractSimpleProperty sp = tm.instanciateSimpleProperty(namespace, schema.getPrefix(),
                                    attr.getLocalName(), attr.getValue(), type.type());
                            container.addProperty(sp);
                        }
                        catch( IllegalArgumentException exception)
                        {
View Full Code Here

Examples of org.apache.xmpbox.type.AbstractSimpleProperty

    {
        TypeMapping tm = xmp.getTypeMapping();
        String prefix = property.getPrefix();
        String name = property.getLocalName();
        String namespace = property.getNamespaceURI();
        AbstractSimpleProperty sp = tm.instanciateSimpleProperty(namespace, prefix, name, property.getTextContent(),
                type);
        loadAttributes(sp, property);
        container.addProperty(sp);
    }
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.