Package org.apache.padaf.xmpbox.schema

Examples of org.apache.padaf.xmpbox.schema.PDFAValueTypeDescription


    String prefType = "tst";
    String descType = "Test Own type";
    desc2.addValueType(valType, nsType, prefType, "must be replaced", null);
    desc2.addValueType(valType, nsType, prefType, descType, null);
    Assert.assertEquals(1, desc2.getValueTypes().size());
    PDFAValueTypeDescription value = desc2.getValueTypes().get(0);
    Assert.assertEquals(valType, value.getTypeNameValue());
    Assert.assertEquals(nsType, value.getNamespaceURIValue());
    Assert.assertEquals(prefType, value.getPrefixValue());
    Assert.assertEquals(descType, value.getDescriptionValue());

    // SaveMetadataHelper.serialize(metadata, true, System.out);

    // valuetype test
View Full Code Here


    parent = new XMPMetadata();
  }

  @Test
  public void testCreateOnePdfaProperty() throws TransformerException {
    PDFAValueTypeDescription pdfvalueType = new PDFAValueTypeDescription(
        parent);
    String type = "value Test";
    String namespaceURI = "Text";
    String prefix = "test";
    String description = "it's a test property";

    String fieldName1 = "field1";
    String fieldValueType1 = "Text";
    String fieldDescription1 = "Field one";

    String fieldName2 = "field2";
    String fieldValueType2 = "Text";
    String fieldDescription2 = "Field two";

    pdfvalueType.setTypeNameValue(type);
    pdfvalueType.setNamespaceURIValue(namespaceURI);
    pdfvalueType.setPrefixValue(prefix);
    pdfvalueType.setDescriptionValue(description);

    Assert.assertEquals("pdfaType:type", pdfvalueType.getTypeName()
        .getQualifiedName());
    Assert.assertEquals(type, pdfvalueType.getTypeNameValue());

    Assert.assertEquals("pdfaType:namespaceURI", pdfvalueType
        .getNamespaceURI().getQualifiedName());
    Assert.assertEquals(namespaceURI, pdfvalueType.getNamespaceURIValue());

    Assert.assertEquals("pdfaType:prefix", pdfvalueType.getPrefix()
        .getQualifiedName());
    Assert.assertEquals(prefix, pdfvalueType.getPrefixValue());

    Assert.assertEquals("pdfaType:description", pdfvalueType
        .getDescription().getQualifiedName());
    Assert.assertEquals(description, pdfvalueType.getDescriptionValue());

    pdfvalueType.addField(fieldName1, fieldValueType1, fieldDescription1);
    pdfvalueType.addField(fieldName2, fieldValueType2, fieldDescription2);

    PDFAFieldDescription field1, field2;
    Assert.assertEquals(2, pdfvalueType.getFields().size());
    field1 = pdfvalueType.getFields().get(0);
    field2 = pdfvalueType.getFields().get(1);

    Assert.assertEquals("pdfaField:name", field1.getName()
        .getQualifiedName());
    Assert.assertEquals(fieldName1, field1.getNameValue());
    Assert.assertEquals("pdfaField:valueType", field1.getValueType()
        .getQualifiedName());
    Assert.assertEquals(fieldValueType1, field1.getValueTypeValue());
    Assert.assertEquals("pdfaField:description", field1.getDescription()
        .getQualifiedName());
    Assert.assertEquals(fieldDescription1, field1.getDescriptionValue());

    Assert.assertEquals("pdfaField:name", field2.getName()
        .getQualifiedName());
    Assert.assertEquals(fieldName2, field2.getNameValue());
    Assert.assertEquals("pdfaField:valueType", field2.getValueType()
        .getQualifiedName());
    Assert.assertEquals(fieldValueType2, field2.getValueTypeValue());
    Assert.assertEquals("pdfaField:description", field2.getDescription()
        .getQualifiedName());
    Assert.assertEquals(fieldDescription2, field2.getDescriptionValue());

    // test add same field
    pdfvalueType.addField(field1);

    /*
     * Element e=parent.getFuturOwner().createElement("test");
     * e.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:rdf",
     * "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
 
View Full Code Here

        .getDescriptionValue());

    // Check valuetype
    // Check numbers of valuetype defined
    Assert.assertTrue(desc.getValueTypes().size() == 1);
    PDFAValueTypeDescription tmpValType = desc.getValueTypes().get(0);
    Assert.assertEquals("mailaddress", tmpValType.getTypeNameValue());
    Assert.assertEquals("http://www.acme.com/ns/email/1/mailaddress/",
        tmpValType.getNamespaceURIValue());
    Assert.assertEquals("mailaddress value", tmpValType
        .getDescriptionValue());

    // Check fields associated to this value type
    Assert.assertTrue(tmpValType.getFields().size() == 2);

    PDFAFieldDescription tmpField = tmpValType.getFields().get(0);
    Assert.assertEquals("name", tmpField.getNameValue());
    Assert.assertEquals("Text", tmpField.getValueTypeValue());
    Assert.assertEquals("plaintext name", tmpField.getDescriptionValue());

    tmpField = tmpValType.getFields().get(1);
    Assert.assertEquals("mailto", tmpField.getNameValue());
    Assert.assertEquals("Text", tmpField.getValueTypeValue());
    Assert.assertEquals("email address", tmpField.getDescriptionValue());

    // Check PDFA Conformance schema
View Full Code Here

        .getDescriptionValue());

    // Check valuetype
    // Check numbers of valuetype defined
    Assert.assertTrue(desc.getValueTypes().size() == 1);
    PDFAValueTypeDescription tmpValType = desc.getValueTypes().get(0);
    Assert.assertEquals("mailaddress", tmpValType.getTypeNameValue());
    Assert.assertEquals("http://www.acme.com/ns/email/1/mailaddress/",
        tmpValType.getNamespaceURIValue());
    Assert.assertEquals("mailaddress value", tmpValType
        .getDescriptionValue());

    // Check fields associated to this value type
    Assert.assertTrue(tmpValType.getFields().size() == 2);

    PDFAFieldDescription tmpField = tmpValType.getFields().get(0);
    Assert.assertEquals("name", tmpField.getNameValue());
    Assert.assertEquals("Text", tmpField.getValueTypeValue());
    Assert.assertEquals("plaintext name", tmpField.getDescriptionValue());

    tmpField = tmpValType.getFields().get(1);
    Assert.assertEquals("mailto", tmpField.getNameValue());
    Assert.assertEquals("Text", tmpField.getValueTypeValue());
    Assert.assertEquals("email address", tmpField.getDescriptionValue());

    // Check PDFA Conformance schema
View Full Code Here

    private String getValueTypeEquivalence(SchemaDescription desc,
            String definedValueType) throws XmpUnknownValueTypeException {
        if (isBasicType(definedValueType)) {
            return definedValueType;
        }
        PDFAValueTypeDescription val = findValueTypeDescription(desc,
                definedValueType);
        if (val.getFields().isEmpty()) {
            // if fields value are note defined we suppose the property is a
            // Text type
            return "Text";
        }
        return "Field";
View Full Code Here

     */
    private void declareAssociatedFieldType(SchemaDescription desc,
            String valueType, PropMapping prop)
    throws XmpUnknownValueTypeException {

        PDFAValueTypeDescription val = findValueTypeDescription(desc, valueType);
        for (PDFAFieldDescription field : val.getFields()) {
            // TODO case where a field call another nspace property ???
            String fieldType = getValueTypeEquivalence(desc, field
                    .getValueTypeValue());
            if (fieldType.equals("Field")) {
                throw new XmpUnknownValueTypeException(
View Full Code Here

TOP

Related Classes of org.apache.padaf.xmpbox.schema.PDFAValueTypeDescription

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.