public class SynchronizedMetaDataValidation
extends java.lang.Object
Constructor and Description |
---|
SynchronizedMetaDataValidation() |
Modifier and Type | Method and Description |
---|---|
protected ValidationResult.ValidationError |
absentSchemaMetaDataError(java.lang.String target,
java.lang.String schema)
Return a formatted validation error when a specific metadata schema can't be found
|
protected ValidationResult.ValidationError |
absentXMPPropertyError(java.lang.String target,
java.lang.String details)
Return a formatted validation error when a specific XMP property can't be found
|
protected void |
analyzeAuthorProperty(PDDocumentInformation dico,
DublinCoreSchema dc,
java.util.List<ValidationResult.ValidationError> ve)
Analyze if Author(s) embedded in Document Information dictionary and in XMP properties are
synchronized
|
protected void |
analyzeCreationDateProperty(PDDocumentInformation dico,
XMPBasicSchema xmp,
java.util.List<ValidationResult.ValidationError> ve)
Analyze if the CreationDate embedded in Document Information dictionary and in XMP properties
are synchronized
|
protected void |
analyzeCreatorToolProperty(PDDocumentInformation dico,
XMPBasicSchema xmp,
java.util.List<ValidationResult.ValidationError> ve)
Analyze if the creator tool embedded in Document Information dictionary and in XMP properties
are synchronized
|
protected void |
analyzeKeywordsProperty(PDDocumentInformation dico,
AdobePDFSchema pdf,
java.util.List<ValidationResult.ValidationError> ve)
Analyze if Keyword(s) embedded in Document Information dictionary and in XMP properties are
synchronized
|
protected void |
analyzeModifyDateProperty(PDDocumentInformation dico,
XMPBasicSchema xmp,
java.util.List<ValidationResult.ValidationError> ve)
Analyze if the ModifyDate embedded in Document Information dictionary and in XMP properties
are synchronized
|
protected void |
analyzeProducerProperty(PDDocumentInformation dico,
AdobePDFSchema pdf,
java.util.List<ValidationResult.ValidationError> ve)
Analyze if Producer embedded in Document Information dictionary and in XMP properties are
synchronized
|
protected void |
analyzeSubjectProperty(PDDocumentInformation dico,
DublinCoreSchema dc,
java.util.List<ValidationResult.ValidationError> ve)
Analyze if Subject(s) embedded in Document Information dictionary and in XMP properties are
synchronized
|
protected void |
analyzeTitleProperty(PDDocumentInformation dico,
DublinCoreSchema dc,
java.util.List<ValidationResult.ValidationError> ve)
Analyze if Title embedded in Document Information dictionary and in XMP properties are synchronized
|
private boolean |
hasTimeZone(java.lang.Object date)
Verify if the date string has time zone information.
|
private boolean |
isValidPDFDateFormat(COSBase item)
Verifies that a date item is a COSString and has the format "D:YYYYMMDDHHmmSSOHH'mm'", where
D:YYYY is mandatory and the next fields optional, but only if all of their preceding fields
are also present.
|
private java.lang.String |
removeTrailingNul(java.lang.String string)
A given string from the DocumentInformation dictionary may have some trailing Nul values
which have to be stripped.
|
protected ValidationException |
schemaAccessException(java.lang.String target,
java.lang.Throwable cause)
Return an exception formatted on IOException when accessing on metadata schema
|
protected ValidationResult.ValidationError |
unexpectedPrefixFoundError(java.lang.String prefFound,
java.lang.String prefExpected,
java.lang.String schema)
Return a validationError formatted when a schema has not the expected prefix
|
protected ValidationResult.ValidationError |
unsynchronizedMetaDataError(java.lang.String target)
Return a formatted validation error when metadata are not synchronized
|
java.util.List<ValidationResult.ValidationError> |
validateMetadataSynchronization(PDDocument document,
XMPMetadata metadata)
Check if document information entries and XMP information are synchronized
|
protected void analyzeTitleProperty(PDDocumentInformation dico, DublinCoreSchema dc, java.util.List<ValidationResult.ValidationError> ve)
dico
- the Document Information Dictionary.dc
- the Dublin Core Schema.ve
- the list of validation errors.protected void analyzeAuthorProperty(PDDocumentInformation dico, DublinCoreSchema dc, java.util.List<ValidationResult.ValidationError> ve)
dico
- Document Information Dictionarydc
- Dublin Core Schemave
- The list of validation errorsprotected void analyzeSubjectProperty(PDDocumentInformation dico, DublinCoreSchema dc, java.util.List<ValidationResult.ValidationError> ve)
dico
- Document Information Dictionarydc
- Dublin Core Schemave
- The list of validation errorsprotected void analyzeKeywordsProperty(PDDocumentInformation dico, AdobePDFSchema pdf, java.util.List<ValidationResult.ValidationError> ve)
dico
- Document Information Dictionarypdf
- PDF Schemave
- The list of validation errorsprotected void analyzeProducerProperty(PDDocumentInformation dico, AdobePDFSchema pdf, java.util.List<ValidationResult.ValidationError> ve)
dico
- Document Information Dictionarypdf
- PDF Schemave
- The list of validation errorsprotected void analyzeCreatorToolProperty(PDDocumentInformation dico, XMPBasicSchema xmp, java.util.List<ValidationResult.ValidationError> ve)
dico
- Document Information Dictionaryxmp
- XMP Basic Schemave
- The list of validation errorsprotected void analyzeCreationDateProperty(PDDocumentInformation dico, XMPBasicSchema xmp, java.util.List<ValidationResult.ValidationError> ve) throws ValidationException
dico
- Document Information Dictionaryxmp
- XMP Basic Schemave
- The list of validation errorsValidationException
protected void analyzeModifyDateProperty(PDDocumentInformation dico, XMPBasicSchema xmp, java.util.List<ValidationResult.ValidationError> ve) throws ValidationException
dico
- Document Information Dictionaryxmp
- XMP Basic Schemave
- The list of validation errorsValidationException
public java.util.List<ValidationResult.ValidationError> validateMetadataSynchronization(PDDocument document, XMPMetadata metadata) throws ValidationException
document
- the PDF Documentmetadata
- the XMP MetaDataValidationException
protected ValidationResult.ValidationError unexpectedPrefixFoundError(java.lang.String prefFound, java.lang.String prefExpected, java.lang.String schema)
prefFound
- prefExpected
- schema
- protected ValidationException schemaAccessException(java.lang.String target, java.lang.Throwable cause)
target
- the name of the schemacause
- the raised IOExceptionprotected ValidationResult.ValidationError unsynchronizedMetaDataError(java.lang.String target)
target
- the concerned propertyprotected ValidationResult.ValidationError absentSchemaMetaDataError(java.lang.String target, java.lang.String schema)
target
- the concerned propertyschema
- the XMP schema which can't be foundprotected ValidationResult.ValidationError absentXMPPropertyError(java.lang.String target, java.lang.String details)
target
- the concerned propertydetails
- comments about the XMP propertyprivate java.lang.String removeTrailingNul(java.lang.String string)
string
- to be strippedprivate boolean hasTimeZone(java.lang.Object date)
This method doesn't do a complete parsing as this is a helper AFTER a date has proven to be valid
date
- private boolean isValidPDFDateFormat(COSBase item)
item
- the date item that is to be checked.