Package org.apache.padaf.xmpbox.schema

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


    // 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

    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

    // 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

    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

     * 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

   * @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

TOP

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

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.