Examples of PDFAIdentificationSchema


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

  }

  @Test
  public void testPDFAIdentification() throws Exception {
    PDFAIdentificationSchema pdfaid = metadata
        .createAndAddPFAIdentificationSchema();

    Integer versionId = 1;
    String amdId = "2005";
    String conformance = "B";

    pdfaid.setPartValueWithInt(versionId);
    pdfaid.setAmdValue(amdId);
    pdfaid.setConformanceValue(conformance);

    Assert.assertEquals(versionId, pdfaid.getPartValue());
    Assert.assertEquals(amdId, pdfaid.getAmendmentValue());
    Assert.assertEquals(conformance, pdfaid.getConformanceValue());

    Assert.assertEquals("" + versionId, pdfaid.getPart().getStringValue());
    Assert.assertEquals(amdId, pdfaid.getAmd().getStringValue());
    Assert.assertEquals(conformance, pdfaid.getConformance()
        .getStringValue());

    // check retrieve this schema in metadata
    Assert.assertEquals(pdfaid, metadata.getPDFIdentificationSchema());
View Full Code Here

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

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

  @Test(expected = BadFieldValueException.class)
  public void testBadPDFAConformanceId() throws BadFieldValueException {
    PDFAIdentificationSchema pdfaid = metadata
        .createAndAddPFAIdentificationSchema();
    String conformance = "kiohiohiohiohio";
    pdfaid.setConformanceValue(conformance);
  }
View Full Code Here

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

    pdfaid.setConformanceValue(conformance);
  }

  @Test(expected = IllegalArgumentException.class)
  public void testBadVersionIdValueType() throws Exception {
    PDFAIdentificationSchema pdfaid = metadata
        .createAndAddPFAIdentificationSchema();
    pdfaid.setPartValueWithString("1");
    pdfaid.setPartValueWithString("ojoj");
  }
View Full Code Here

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

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

  @Test(expected = BadFieldValueException.class)
  public void testBadPDFAConformanceId() throws Exception {
    PDFAIdentificationSchema pdfaid = metadata
        .createAndAddPFAIdentificationSchema();
    String conformance = "kiohiohiohiohio";
    pdfaid.setConformanceValue(conformance);
  }
View Full Code Here

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

    pdfaid.setConformanceValue(conformance);
  }

  @Test(expected = IllegalArgumentException.class)
  public void testBadVersionIdValueType() throws Exception {
    PDFAIdentificationSchema pdfaid = metadata
        .createAndAddPFAIdentificationSchema();
    pdfaid.setPartValueWithString("1");
    pdfaid.setPartValueWithString("ojoj");
  }
View Full Code Here

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

     * method return the created schema to enter information
     *
     * @return schema added in order to work on it
     */
    public PDFAIdentificationSchema createAndAddPFAIdentificationSchema() {
        PDFAIdentificationSchema pdfAId = new PDFAIdentificationSchema(this);
        pdfAId.setAboutAsSimple("");
        addSchema(pdfAId);
        return pdfAId;
    }
View Full Code Here

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

   * @throws ValidationException
   */
  public List<ValidationError> validatePDFAIdentifer(XMPMetadata metadata)
      throws ValidationException {
    List<ValidationError> ve = new ArrayList<ValidationError>();
    PDFAIdentificationSchema id = metadata.getPDFIdentificationSchema();
    if (id == null) {
      ve.add(new ValidationError(ValidationConstants.ERROR_METADATA_PDFA_ID_MISSING));
      return ve;
    }

    // According to the PDF/A specification, the prefix must be pdfaid for this schema.
    if (!id.getPrefix().equals(PDFAIdentificationSchema.IDPREFIX)) {
      if (metadata.getSchema(PDFAIdentificationSchema.IDPREFIX, XMPBasicSchema.XMPBASICURI) == null) {
        ve.add(UnexpectedPrefixFoundError(id.getPrefix(),
            PDFAIdentificationSchema.IDPREFIX, PDFAIdentificationSchema.class.getName()));
      } else {
        id = (PDFAIdentificationSchema) metadata.getSchema(
            PDFAIdentificationSchema.IDPREFIX, PDFAIdentificationSchema.IDURI);
      }
    }
    checkConformanceLevel(ve, id.getConformanceValue());
    checkPartNumber(ve, id.getPartValue());
    return ve;
  }
View Full Code Here

Examples of org.apache.xmpbox.schema.PDFAIdentificationSchema

            cat.setMetadata(metadata);

            XMPMetadata xmp = XMPMetadata.createXMPMetadata();
            try
            {
                PDFAIdentificationSchema pdfaid = xmp.createAndAddPFAIdentificationSchema();
                pdfaid.setConformance("B");
                pdfaid.setPart(1);
                pdfaid.setAboutAsSimple("PDFBox PDFA sample");
                XmpSerializer serializer = new XmpSerializer();
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                serializer.serialize(xmp, baos, false);
                metadata.importXMPMetadata( baos.toByteArray() );
            }
View Full Code Here

Examples of org.apache.xmpbox.schema.PDFAIdentificationSchema

     *
     * @return schema added in order to work on it
     */
    public PDFAIdentificationSchema createAndAddPFAIdentificationSchema()
    {
        PDFAIdentificationSchema pdfAId = new PDFAIdentificationSchema(this);
        pdfAId.setAboutAsSimple("");
        addSchema(pdfAId);
        return pdfAId;
    }
View Full Code Here

Examples of org.apache.xmpbox.schema.PDFAIdentificationSchema

     * @throws ValidationException
     */
    public List<ValidationError> validatePDFAIdentifer(XMPMetadata metadata) throws ValidationException
    {
        List<ValidationError> ve = new ArrayList<ValidationError>();
        PDFAIdentificationSchema id = metadata.getPDFIdentificationSchema();
        if (id == null)
        {
            ve.add(new ValidationError(ERROR_METADATA_PDFA_ID_MISSING));
            return ve;
        }

        // According to the PDF/A specification, the prefix must be pdfaid for this schema.
        StructuredType stBasic = XMPBasicSchema.class.getAnnotation(StructuredType.class);
        StructuredType stPdfaIdent = PDFAIdentificationSchema.class.getAnnotation(StructuredType.class);
        if (!id.getPrefix().equals(stPdfaIdent.preferedPrefix()))
        {
            if (metadata.getSchema(stPdfaIdent.preferedPrefix(), stBasic.namespace()) == null)
            {
                ve.add(unexpectedPrefixFoundError(id.getPrefix(), stPdfaIdent.preferedPrefix(),
                        PDFAIdentificationSchema.class.getName()));
            }
            else
            {
                id = (PDFAIdentificationSchema) metadata.getSchema(stPdfaIdent.preferedPrefix(),
                        stPdfaIdent.namespace());
            }
        }
        checkConformanceLevel(ve, id.getConformance());
        checkPartNumber(ve, id.getPart());
        return ve;
    }
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.