org.apache.pdfbox.preflight.metadata

## Class SynchronizedMetaDataValidation

- java.lang.Object
- - org.apache.pdfbox.preflight.metadata.SynchronizedMetaDataValidation

    public class SynchronizedMetaDataValidation
    extends Object

Class which checks if document information available in a document is synchronized with XMP

Author:
  Germain Costenobel

### Constructor Summary

Constructors
Constructor and Description
`SynchronizedMetaDataValidation()`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected ValidationResult.ValidationError` `absentSchemaMetaDataError(String target, String schema)` Return a formatted validation error when a specific metadata schema can't be found
`protected ValidationResult.ValidationError` `absentXMPPropertyError(String target, String details)` Return a formatted validation error when a specific XMP property can't be found
`protected void` `analyzeAuthorProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico, org.apache.xmpbox.schema.DublinCoreSchema dc, List<ValidationResult.ValidationError> ve)` Analyze if Author(s) embedded in Document Information dictionary and in XMP properties are synchronized
`protected void` `analyzeCreationDateProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico, org.apache.xmpbox.schema.XMPBasicSchema xmp, List<ValidationResult.ValidationError> ve)` Analyze if the CreationDate embedded in Document Information dictionary and in XMP properties are synchronized
`protected void` `analyzeCreatorToolProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico, org.apache.xmpbox.schema.XMPBasicSchema xmp, List<ValidationResult.ValidationError> ve)` Analyze if the creator tool embedded in Document Information dictionary and in XMP properties are synchronized
`protected void` `analyzeKeywordsProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico, org.apache.xmpbox.schema.AdobePDFSchema pdf, List<ValidationResult.ValidationError> ve)` Analyze if Keyword(s) embedded in Document Information dictionary and in XMP properties are synchronized
`protected void` `analyzeModifyDateProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico, org.apache.xmpbox.schema.XMPBasicSchema xmp, List<ValidationResult.ValidationError> ve)` Analyze if the ModifyDate embedded in Document Information dictionary and in XMP properties are synchronized
`protected void` `analyzeProducerProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico, org.apache.xmpbox.schema.AdobePDFSchema pdf, List<ValidationResult.ValidationError> ve)` Analyze if Producer embedded in Document Information dictionary and in XMP properties are synchronized
`protected void` `analyzeSubjectProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico, org.apache.xmpbox.schema.DublinCoreSchema dc, List<ValidationResult.ValidationError> ve)` Analyze if Subject(s) embedded in Document Information dictionary and in XMP properties are synchronized
`protected void` `analyzeTitleProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico, org.apache.xmpbox.schema.DublinCoreSchema dc, List<ValidationResult.ValidationError> ve)` Analyze if Title embedded in Document Information dictionary and in XMP properties are synchronized
`protected ValidationException` `schemaAccessException(String target, Throwable cause)` Return an exception formatted on IOException when accessing on metadata schema
`protected ValidationResult.ValidationError` `unexpectedPrefixFoundError(String prefFound, String prefExpected, String schema)` Return a validationError formatted when a schema has not the expected prefix
`protected ValidationResult.ValidationError` `unsynchronizedMetaDataError(String target)` Return a formatted validation error when metadata are not synchronized
`List<ValidationResult.ValidationError>` `validateMetadataSynchronization(org.apache.pdfbox.pdmodel.PDDocument document, org.apache.xmpbox.XMPMetadata metadata)` Check if document information entries and XMP information are synchronized

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SynchronizedMetaDataValidation

    public SynchronizedMetaDataValidation()

### Method Detail

#### analyzeTitleProperty

    protected void analyzeTitleProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico,
                                        org.apache.xmpbox.schema.DublinCoreSchema dc,
                                        List<ValidationResult.ValidationError> ve)

Analyze if Title embedded in Document Information dictionary and in XMP properties are synchronized

Parameters:
  `dico` - the Document Information Dictionary.
  `dc` - the Dublin Core Schema.
  `ve` - the list of validation errors.

#### analyzeAuthorProperty

    protected void analyzeAuthorProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico,
                                         org.apache.xmpbox.schema.DublinCoreSchema dc,
                                         List<ValidationResult.ValidationError> ve)

Analyze if Author(s) embedded in Document Information dictionary and in XMP properties are synchronized

Parameters:
  `dico` - Document Information Dictionary
  `dc` - Dublin Core Schema
  `ve` - The list of validation errors

#### analyzeSubjectProperty

    protected void analyzeSubjectProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico,
                                          org.apache.xmpbox.schema.DublinCoreSchema dc,
                                          List<ValidationResult.ValidationError> ve)

Analyze if Subject(s) embedded in Document Information dictionary and in XMP properties are synchronized

Parameters:
  `dico` - Document Information Dictionary
  `dc` - Dublin Core Schema
  `ve` - The list of validation errors

#### analyzeKeywordsProperty

    protected void analyzeKeywordsProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico,
                                           org.apache.xmpbox.schema.AdobePDFSchema pdf,
                                           List<ValidationResult.ValidationError> ve)

Analyze if Keyword(s) embedded in Document Information dictionary and in XMP properties are synchronized

Parameters:
  `dico` - Document Information Dictionary
  `pdf` - PDF Schema
  `ve` - The list of validation errors

#### analyzeProducerProperty

    protected void analyzeProducerProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico,
                                           org.apache.xmpbox.schema.AdobePDFSchema pdf,
                                           List<ValidationResult.ValidationError> ve)

Analyze if Producer embedded in Document Information dictionary and in XMP properties are synchronized

Parameters:
  `dico` - Document Information Dictionary
  `pdf` - PDF Schema
  `ve` - The list of validation errors

#### analyzeCreatorToolProperty

    protected void analyzeCreatorToolProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico,
                                              org.apache.xmpbox.schema.XMPBasicSchema xmp,
                                              List<ValidationResult.ValidationError> ve)

Analyze if the creator tool embedded in Document Information dictionary and in XMP properties are synchronized

Parameters:
  `dico` - Document Information Dictionary
  `xmp` - XMP Basic Schema
  `ve` - The list of validation errors

#### analyzeCreationDateProperty

    protected void analyzeCreationDateProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico,
                                               org.apache.xmpbox.schema.XMPBasicSchema xmp,
                                               List<ValidationResult.ValidationError> ve)
                                        throws ValidationException

Analyze if the CreationDate embedded in Document Information dictionary and in XMP properties are synchronized

Parameters:
  `dico` - Document Information Dictionary
  `xmp` - XMP Basic Schema
  `ve` - The list of validation errors
Throws:
  `ValidationException`

#### analyzeModifyDateProperty

    protected void analyzeModifyDateProperty(org.apache.pdfbox.pdmodel.PDDocumentInformation dico,
                                             org.apache.xmpbox.schema.XMPBasicSchema xmp,
                                             List<ValidationResult.ValidationError> ve)
                                      throws ValidationException

Analyze if the ModifyDate embedded in Document Information dictionary and in XMP properties are synchronized

Parameters:
  `dico` - Document Information Dictionary
  `xmp` - XMP Basic Schema
  `ve` - The list of validation errors
Throws:
  `ValidationException`

#### validateMetadataSynchronization

    public List<ValidationResult.ValidationError> validateMetadataSynchronization(org.apache.pdfbox.pdmodel.PDDocument document,
                                                                                  org.apache.xmpbox.XMPMetadata metadata)
                                                                           throws ValidationException

Check if document information entries and XMP information are synchronized

Parameters:
  `document` - the PDF Document
  `metadata` - the XMP MetaData
Returns:
  List of validation errors
Throws:
  `ValidationException`

#### unexpectedPrefixFoundError

    protected ValidationResult.ValidationError unexpectedPrefixFoundError(String prefFound,
                                                                          String prefExpected,
                                                                          String schema)

Return a validationError formatted when a schema has not the expected prefix

Parameters:
  `prefFound` -
  `prefExpected` -
  `schema` -
Returns:
  the generated validation error.

#### schemaAccessException

    protected ValidationException schemaAccessException(String target,
                                                        Throwable cause)

Return an exception formatted on IOException when accessing on metadata schema

Parameters:
  `target` - the name of the schema
  `cause` - the raised IOException
Returns:
  the generated exception

#### unsynchronizedMetaDataError

    protected ValidationResult.ValidationError unsynchronizedMetaDataError(String target)

Return a formatted validation error when metadata are not synchronized

Parameters:
  `target` - the concerned property
Returns:
  the generated validation error

#### absentSchemaMetaDataError

    protected ValidationResult.ValidationError absentSchemaMetaDataError(String target,
                                                                         String schema)

Return a formatted validation error when a specific metadata schema can't be found

Parameters:
  `target` - the concerned property
  `schema` - the XMP schema which can't be found
Returns:
  the generated validation error

#### absentXMPPropertyError

    protected ValidationResult.ValidationError absentXMPPropertyError(String target,
                                                                      String details)

Return a formatted validation error when a specific XMP property can't be found

Parameters:
  `target` - the concerned property
  `details` - comments about the XMP property
Returns:
  the generated validation error