Search in sources :

Example 16 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class XMPSchemaTest method testArrayList.

@Test
public void testArrayList() throws Exception {
    XMPMetadata meta = XMPMetadata.createXMPMetadata();
    ArrayProperty newSeq = meta.getTypeMapping().createArrayProperty(null, "nsSchem", "seqType", Cardinality.Seq);
    TypeMapping tm = meta.getTypeMapping();
    TextType li1 = tm.createText(null, "rdf", "li", "valeur1");
    TextType li2 = tm.createText(null, "rdf", "li", "valeur2");
    newSeq.getContainer().addProperty(li1);
    newSeq.getContainer().addProperty(li2);
    schem.addProperty(newSeq);
    List<AbstractField> list = schem.getUnqualifiedArrayList("seqType");
    Assert.assertTrue(list.contains(li1));
    Assert.assertTrue(list.contains(li2));
}
Also used : ArrayProperty(org.apache.xmpbox.type.ArrayProperty) AbstractField(org.apache.xmpbox.type.AbstractField) XMPMetadata(org.apache.xmpbox.XMPMetadata) TypeMapping(org.apache.xmpbox.type.TypeMapping) TextType(org.apache.xmpbox.type.TextType) Test(org.junit.Test)

Example 17 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class XMPSchemaTest method testSpecifiedSimplePropertyFormer.

@Test
public void testSpecifiedSimplePropertyFormer() throws Exception {
    String prop = "testprop";
    String val = "value";
    String val2 = "value2";
    schem.setTextPropertyValueAsSimple(prop, val);
    TextType text = schem.getMetadata().getTypeMapping().createText(null, schem.getPrefix(), prop, "value2");
    schem.setTextProperty(text);
    Assert.assertEquals(val2, schem.getUnqualifiedTextPropertyValue(prop));
    Assert.assertEquals(text, schem.getUnqualifiedTextProperty(prop));
}
Also used : TextType(org.apache.xmpbox.type.TextType) Test(org.junit.Test)

Example 18 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class AbstractXMPSchemaTest method testGetSetURIProperty.

protected void testGetSetURIProperty() throws Exception {
    String setName = setMethod(property);
    String getName = getMethod(property);
    URIType tt = metadata.getTypeMapping().createURI(null, schema.getPrefix(), property, (String) value);
    Method setMethod = schemaClass.getMethod(setName, URIType.class);
    Method getMethod = schemaClass.getMethod(getName);
    setMethod.invoke(schema, tt);
    String found = ((TextType) getMethod.invoke(schema)).getStringValue();
    Assert.assertEquals(value, found);
}
Also used : Method(java.lang.reflect.Method) URIType(org.apache.xmpbox.type.URIType) TextType(org.apache.xmpbox.type.TextType)

Example 19 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class AbstractXMPSchemaTest method testGetSetURLProperty.

protected void testGetSetURLProperty() throws Exception {
    String setName = setMethod(property);
    String getName = getMethod(property);
    URLType tt = metadata.getTypeMapping().createURL(null, schema.getPrefix(), property, (String) value);
    Method setMethod = schemaClass.getMethod(setName, URLType.class);
    Method getMethod = schemaClass.getMethod(getName);
    setMethod.invoke(schema, tt);
    String found = ((TextType) getMethod.invoke(schema)).getStringValue();
    Assert.assertEquals(value, found);
}
Also used : Method(java.lang.reflect.Method) URLType(org.apache.xmpbox.type.URLType) TextType(org.apache.xmpbox.type.TextType)

Example 20 with TextType

use of org.apache.xmpbox.type.TextType in project pdfbox by apache.

the class AdobePDFSchema method setProducer.

/**
 * Set the PDFProducer
 *
 * @param value
 *            Value to set
 */
public void setProducer(String value) {
    TextType producer;
    producer = createTextType(PRODUCER, value);
    addProperty(producer);
}
Also used : TextType(org.apache.xmpbox.type.TextType)

Aggregations

TextType (org.apache.xmpbox.type.TextType)37 AbstractField (org.apache.xmpbox.type.AbstractField)5 ArrayProperty (org.apache.xmpbox.type.ArrayProperty)5 Test (org.junit.Test)4 Method (java.lang.reflect.Method)3 Attribute (org.apache.xmpbox.type.Attribute)3 XMPMetadata (org.apache.xmpbox.XMPMetadata)2 InputStream (java.io.InputStream)1 Calendar (java.util.Calendar)1 ValidationError (org.apache.pdfbox.preflight.ValidationResult.ValidationError)1 DublinCoreSchema (org.apache.xmpbox.schema.DublinCoreSchema)1 BadFieldValueException (org.apache.xmpbox.type.BadFieldValueException)1 BooleanType (org.apache.xmpbox.type.BooleanType)1 DateType (org.apache.xmpbox.type.DateType)1 IntegerType (org.apache.xmpbox.type.IntegerType)1 TypeMapping (org.apache.xmpbox.type.TypeMapping)1 URIType (org.apache.xmpbox.type.URIType)1 URLType (org.apache.xmpbox.type.URLType)1 DomXmpParser (org.apache.xmpbox.xml.DomXmpParser)1