diff --git a/core/src/main/java/org/verapdf/core/ModelParsingException.java b/core/src/main/java/org/verapdf/core/ModelParsingException.java index 0fa57f1e4..a14caebaa 100644 --- a/core/src/main/java/org/verapdf/core/ModelParsingException.java +++ b/core/src/main/java/org/verapdf/core/ModelParsingException.java @@ -21,7 +21,7 @@ package org.verapdf.core; /** - * Exception type for PDFParser problems. + * Exception type for PDFAParser problems. * * @author Carl Wilson */ diff --git a/core/src/main/java/org/verapdf/features/objects/AnnotationFeaturesObjectAdapter.java b/core/src/main/java/org/verapdf/features/objects/AnnotationFeaturesObjectAdapter.java index d480310f8..5e993f8fd 100644 --- a/core/src/main/java/org/verapdf/features/objects/AnnotationFeaturesObjectAdapter.java +++ b/core/src/main/java/org/verapdf/features/objects/AnnotationFeaturesObjectAdapter.java @@ -26,23 +26,137 @@ * @author Maksim Bezrukov */ public interface AnnotationFeaturesObjectAdapter extends FeaturesObjectAdapter { + + /** + * Gets annotation adapter id. + * + * @return an annotation adapter id + */ String getId(); + + /** + * Gets annotation adapter popup id. + * + * @return an annotation adapter popup id + */ String getPopupId(); + + /** + * Gets form XObject from annotation. + * + * @return a form XObject + */ Set getFormXObjectsResources(); + + /** + * Gets annotation subtype. + * + * @return an annotation subtype + */ String getSubtype(); + + /** + * Gets annotation rectangle. + * + * @return an annotation rectangle + */ double[] getRectangle(); + + /** + * Gets annotation contents. + * + * @return an annotation contents + */ String getContents(); + + /** + * Gets annotation name. + * + * @return an annotation name + */ String getAnnotationName(); + + /** + * Gets annotation modified date. + * + * @return an annotation modified date + */ String getModifiedDate(); + + /** + * Gets annotation color. + * + * @return an annotation color + */ double[] getColor(); + + /** + * Tells whether annotation is invisible. + * + * @return true if annotation is invisible + */ boolean isInvisible(); + + /** + * Tells whether annotation is hidden. + * + * @return true if annotation is hidden + */ boolean isHidden(); + + /** + * Tells whether annotation is printed. + * + * @return true if annotation is printed + */ boolean isPrinted(); + + /** + * Tells whether annotation is no zoom. + * + * @return true if annotation is no zoom + */ boolean isNoZoom(); + + /** + * Tells whether annotation is no rotate. + * + * @return true if annotation is no rotate + */ boolean isNoRotate(); + + /** + * Tells whether annotation is no view. + * + * @return true if annotation is no view + */ boolean isNoView(); + + /** + * Tells whether annotation is read only. + * + * @return true if annotation is read only + */ boolean isReadOnly(); + + /** + * Tells whether annotation is locked. + * + * @return true if annotation is locked + */ boolean isLocked(); + + /** + * Tells whether annotation is toggle no view. + * + * @return true if annotation is toggle no view + */ boolean isToggleNoView(); + + /** + * Tells whether annotation is locked content. + * + * @return true if annotation is locked content + */ boolean isLockedContents(); } diff --git a/core/src/main/java/org/verapdf/pdfa/VeraPDFFoundry.java b/core/src/main/java/org/verapdf/pdfa/VeraPDFFoundry.java index ae753dff6..273e4d86a 100644 --- a/core/src/main/java/org/verapdf/pdfa/VeraPDFFoundry.java +++ b/core/src/main/java/org/verapdf/pdfa/VeraPDFFoundry.java @@ -23,6 +23,9 @@ */ package org.verapdf.pdfa; +import java.io.File; +import java.io.InputStream; +import java.util.List; import org.verapdf.component.Component; import org.verapdf.core.EncryptedPdfException; import org.verapdf.core.ModelParsingException; @@ -30,21 +33,17 @@ import org.verapdf.pdfa.validation.profiles.ValidationProfile; import org.verapdf.pdfa.validation.validators.ValidatorConfig; -import java.io.File; -import java.io.InputStream; -import java.util.List; - /** * The veraPDFFoundry interface provides methods for creating implementations of - * the classes provided by a PDF Parser and Metadata Fixer implementations. + * the classes provided by a PDF/A Parser and Metadata Fixer implementations. * * @author Carl Wilson - * carlwilson AT github + * carlwilson AT github * @version 0.1 Created 21 Sep 2016:12:37:55 */ public interface VeraPDFFoundry extends Component { /** - * Method that returns a PDFParser instance, parsing the passed + * Method that returns a PDFAParser instance, parsing the passed * {@param pdfStream} parameter. The parser or parser provider will detect * the flavour of the PDF document stream and provide an appropriate parser. * @@ -60,7 +59,7 @@ public interface VeraPDFFoundry extends Component { public PDFAParser createParser(InputStream pdfStream) throws ModelParsingException, EncryptedPdfException; /** - * Method that returns a PDFParser instance, parsing the passed + * Method that returns a PDFAParser instance, parsing the passed * {@param pdfStream} parameter. The caller must explicitly state the flavour * of the PDF document stream. * @@ -68,8 +67,7 @@ public interface VeraPDFFoundry extends Component { * {@link java.io.InputStream} for the PDF document to be parsed. * @param flavour * a {@link PDFAFlavour} instance indicating parser configuration - * (PDF/A part and conformance level) to be assumed when parsing - * the document. + * to be assumed when parsing the document. * @return a {@link PDFAParser} instance created from the supplied * InputStream. * @throws ModelParsingException @@ -86,20 +84,22 @@ public PDFAParser createParser(InputStream pdfStream, PDFAFlavour flavour, PDFAF public PDFAParser createParser(InputStream pdfStream, PDFAFlavour flavour, String password) throws ModelParsingException, EncryptedPdfException; - public PDFAParser createParser(InputStream pdfStream, PDFAFlavour flavour, PDFAFlavour defaultFlavour, String password) + public PDFAParser createParser(InputStream pdfStream, PDFAFlavour flavour, PDFAFlavour defaultFlavour, + String password) throws ModelParsingException, EncryptedPdfException; /** - * Method that returns a PDFParser instance, parsing file passed as + * Method that returns a PDFAParser instance, parsing file passed as * {@param pdfFile} parameter. The caller must explicitly state the flavour * of the PDF document stream. * * @param pdfFile {@link File} with PDF document to be parsed. * @param flavour a {@link PDFAFlavour} instance indicating parser configuration - * (PDF/A part and conformance level) to be assumed when parsing - * the document. + * to be assumed when parsing the document. + * * @return a {@link PDFAParser} instance created from the supplied * InputStream. + * * @throws ModelParsingException when there's a problem parsing the PDF file * @throws EncryptedPdfException if the PDF to be parsed is encrypted */ @@ -116,7 +116,7 @@ public PDFAParser createParser(File pdfFile, PDFAFlavour flavour, PDFAFlavour de throws ModelParsingException, EncryptedPdfException; /** - * Method that returns a PDFParser instance, parsing file passed as + * Method that returns a PDFAParser instance, parsing file passed as * {@param pdfFile} parameter. The parser or parser provider will detect * the flavour of the PDF document stream and provide an appropriate parser. * @@ -130,16 +130,16 @@ public PDFAParser createParser(File pdfFile, PDFAFlavour flavour, PDFAFlavour de * if the PDF to be parsed is encrypted */ public PDFAParser createParser(File pdfFile) - throws ModelParsingException, EncryptedPdfException; + throws ModelParsingException, EncryptedPdfException; - /** - * Obtain a new {@link PDFAValidator} instance. - * - * @param config - * a {@link ValidatorConfig} instance used to configure the - * {@link PDFAValidator} - * @return an appropriately configured {@link PDFAValidator} instance. - */ + /** + * Obtain a new {@link PDFAValidator} instance. + * + * @param config + * a {@link ValidatorConfig} instance used to configure the + * {@link PDFAValidator} + * @return an appropriately configured {@link PDFAValidator} instance. + */ public PDFAValidator createValidator(ValidatorConfig config); /** @@ -149,7 +149,7 @@ public PDFAParser createParser(File pdfFile) * @param config * a {@link ValidatorConfig} instance used to configure the * {@link PDFAValidator} - * @param profile + * @param profile a validation profile * @return an appropriately configured {@link PDFAValidator} instance. */ public PDFAValidator createValidator(ValidatorConfig config, ValidationProfile profile); @@ -184,11 +184,7 @@ public PDFAParser createParser(File pdfFile) /** * Creates a new {@link PDFAValidator} instance that uses one of the - * {@link ValidationProfile}s packaged as a core library resource. While - * these profiles are not guaranteed to be up to date, they are available - * when offline. A {@link org.verapdf.pdfa.validation.profiles.ProfileDirectory} populated with the pre-loaded - * profiles can be obtained by calling - * {@link org.verapdf.pdfa.validation.profiles.Profiles#getVeraProfileDirectory()}. + * {@link ValidationProfile}s packaged as a core library resource. * * @param flavour * the {@link PDFAFlavour} that's associated with the @@ -205,14 +201,10 @@ public PDFAParser createParser(File pdfFile) /** * Creates a new {@link PDFAValidator} instance that uses - * {@link ValidationProfile}s packaged as a core library resource. While - * these profiles are not guaranteed to be up to date, they are available - * when offline. A {@link org.verapdf.pdfa.validation.profiles.ProfileDirectory} populated with the pre-loaded - * profiles can be obtained by calling - * {@link org.verapdf.pdfa.validation.profiles.Profiles#getVeraProfileDirectory()}. + * {@link ValidationProfile}s packaged as a core library resource. * * @param flavours - * list of the {@link PDFAFlavour} that are associated with the + * list of the {@link PDFAFlavour} that are associated with the * {@code ValidationProfile} to used to initialise the * {@code PDFAValidator}. * @return a {@link PDFAValidator} instance initialised from the passed @@ -236,56 +228,121 @@ public PDFAParser createParser(File pdfFile) */ public PDFAValidator createValidator(ValidationProfile profile, boolean logSuccess); + /** + * Creates a new {@link PDFAValidator} initialised with the passed profile and parameters. + * + * @param flavour the {@link PDFAFlavour} that's associated with the + * {@code ValidationProfile} to used to initialise the + * {@code PDFAValidator}. + * @param maxNumberOfDisplayedFailedChecks a max checks number to show + * @param logSuccess {@code boolean} used to configure logging of passed tests by + * the {@code PDFAValidator}. Pass {@code true} to log passed + * tests, {@code false} to only log tests that don't pass. + * @param showErrorMessages a flag to show error messages + * @param showProgress a flag to show validation progress + * + * @return a {@link PDFAValidator} instance initialised from the passed parameters + */ public PDFAValidator createValidator(PDFAFlavour flavour, int maxNumberOfDisplayedFailedChecks, - boolean logSuccess, boolean showErrorMessages, boolean showProgress); + boolean logSuccess, boolean showErrorMessages, boolean showProgress); + /** + * Creates a new {@link PDFAValidator} initialised with the passed profile and parameters. + * + * @param flavour the {@link PDFAFlavour} that's associated with the + * {@code ValidationProfile} to used to initialise the + * {@code PDFAValidator}. + * @param maxNumberOfDisplayedFailedChecks a max checks number to show + * @param logSuccess {@code boolean} used to configure logging of passed tests by + * the {@code PDFAValidator}. Pass {@code true} to log passed + * tests, {@code false} to only log tests that don't pass. + * @param showErrorMessages a flag to show error messages + * @param showProgress a flag to show validation progress + * + * @return a {@link PDFAValidator} instance initialised from the passed parameters + */ public PDFAValidator createValidator(List flavour, int maxNumberOfDisplayedFailedChecks, - boolean logSuccess, boolean showErrorMessages, boolean showProgress); + boolean logSuccess, boolean showErrorMessages, boolean showProgress); + /** + * Creates a new {@link PDFAValidator} initialised with the passed profile and parameters. + * + * @param profile the {@link ValidationProfile} to be enforced by the returned + * {@code PDFAValidator}. + * @param maxNumberOfDisplayedFailedChecks a max checks number to show + * @param logSuccess {@code boolean} used to configure logging of passed tests by + * the {@code PDFAValidator}. Pass {@code true} to log passed + * tests, {@code false} to only log tests that don't pass. + * @param showErrorMessages a flag to show error messages + * @param showProgress a flag to show validation progress + * + * @return a {@link PDFAValidator} instance initialised from the passed parameters + */ public PDFAValidator createValidator(ValidationProfile profile, int maxNumberOfDisplayedFailedChecks, - boolean logSuccess, boolean showErrorMessages, boolean showProgress); + boolean logSuccess, boolean showErrorMessages, boolean showProgress); /** - * Creates a new {@link PDFAValidator} initialised with the passed profile, - * requested fast failing behaviour and configured NOT to log passed checks. + * Creates a new {@link PDFAValidator} initialised with the passed profile and parameters. * - * @param flavour - * the {@link PDFAFlavour} that's associated with the - * {@code ValidationProfile} to used to initialise the - * {@code PDFAValidator}. - * @param maxFailures - * an {@code int} value that configures the {@code PDFAValidator} - * to abort validation after {@code maxFailures} failed tests. If - * {@code maxFailures} is less than 1 then the - * {@code PDFAValidator} will complete the full validation - * process. - * @return a {@link PDFAValidator} instance initialised from the passed - * parameters + * @param flavour the {@link PDFAFlavour} that's associated with the + * {@code ValidationProfile} to used to initialise the + * {@code PDFAValidator}. + * @param maxFailures an {@code int} value that configures the {@code PDFAValidator} to abort + * validation after {@code maxFailures} failed tests. If {@code + * maxFailures} is less than 1 then the {@code PDFAValidator} will + * complete the full validation process. + * @param maxNumberOfDisplayedFailedChecks a max checks number to show + * @param logSuccess a flag to show success logs + * @param showErrorMessages a flag to show error message + * @param showProgress a flag to show validation progress + * + * @return a {@link PDFAValidator} instance initialised from the passed parameters */ - public PDFAValidator createFailFastValidator(PDFAFlavour flavour, int maxFailures, int maxNumberOfDisplayedFailedChecks, - boolean logSuccess, boolean showErrorMessages, boolean showProgress); + public PDFAValidator createFailFastValidator(PDFAFlavour flavour, int maxFailures, + int maxNumberOfDisplayedFailedChecks, boolean logSuccess, + boolean showErrorMessages, boolean showProgress); - public PDFAValidator createFailFastValidator(List flavours, int maxFailures, int maxNumberOfDisplayedFailedChecks, - boolean logSuccess, boolean showErrorMessages, boolean showProgress); + /** + * Creates a new {@link PDFAValidator} initialised with the passed profile and parameters, requested fast failing + * behaviour. + * + * @param flavours the list of {@link PDFAFlavour} that's associated with the + * {@code ValidationProfile} to used to initialise th {@code PDFAValidator}. + * @param maxFailures an {@code int} value that configures the {@code PDFAValidator} to abort + * validation after {@code maxFailures} failed tests. If {@code + * maxFailures} is less than 1 then the {@code PDFAValidator} will + * complete the full validation process. + * @param maxNumberOfDisplayedFailedChecks a max checks number to show + * @param logSuccess a flag to show success logs + * @param showErrorMessages a flag to show error message + * @param showProgress a flag to show validation progress + * + * @return a {@link PDFAValidator} instance initialised from the passed parameters + */ + public PDFAValidator createFailFastValidator(List flavours, int maxFailures, + int maxNumberOfDisplayedFailedChecks, boolean logSuccess, + boolean showErrorMessages, boolean showProgress); /** - * Creates a new {@link PDFAValidator} initialised with the passed profile, - * requested fast failing behaviour and configured NOT to log passed checks. + * Creates a new {@link PDFAValidator} initialised with the passed profile and parameters, requested fast failing + * behaviour. * - * @param profile - * the {@link ValidationProfile} to be enforced by the returned - * {@code PDFAValidator}. - * @param maxFailures - * an {@code int} value that configures the {@code PDFAValidator} - * to abort validation after {@code maxFailures} failed tests. If - * {@code maxFailures} is less than 1 then the - * {@code PDFAValidator} will complete the full validation - * process. - * @return a {@link PDFAValidator} instance initialised from the passed - * parameters + * @param profile the {@link ValidationProfile} to be enforced by the returned + * {@code PDFAValidator}. + * @param maxFailures an {@code int} value that configures the {@code PDFAValidator} to abort + * validation after {@code maxFailures} failed tests. If {@code + * maxFailures} is less than 1 then the {@code PDFAValidator} will complete + * the full validation process. + * @param maxNumberOfDisplayedFailedChecks a max checks number to show + * @param logSuccess a flag to show success logs + * @param showErrorMessages a flag to show error message + * @param showProgress a flag to show validation progress + * + * @return a {@link PDFAValidator} instance initialised from the passed parameters */ - public PDFAValidator createFailFastValidator(ValidationProfile profile, int maxFailures, int maxNumberOfDisplayedFailedChecks, - boolean logSuccess, boolean showErrorMessages, boolean showProgress); + public PDFAValidator createFailFastValidator(ValidationProfile profile, int maxFailures, + int maxNumberOfDisplayedFailedChecks, boolean logSuccess, + boolean showErrorMessages, boolean showProgress); /** * Obtain a new {@link MetadataFixer} instance. diff --git a/core/src/main/java/org/verapdf/processor/reports/BatchJobSummary.java b/core/src/main/java/org/verapdf/processor/reports/BatchJobSummary.java index 1f5fdd351..387ef081b 100644 --- a/core/src/main/java/org/verapdf/processor/reports/BatchJobSummary.java +++ b/core/src/main/java/org/verapdf/processor/reports/BatchJobSummary.java @@ -18,30 +18,36 @@ * If a copy of the MPL was not distributed with this file, you can obtain one at * http://mozilla.org/MPL/2.0/. */ -/** - * - */ package org.verapdf.processor.reports; /** - * @author Carl Wilson - * carlwilson AT github - * + * @author Carl Wilson + * carlwilson AT github * @version 0.1 - * + *

* Created 18 Apr 2017:18:24:01 */ public interface BatchJobSummary { + /** + * Gets number of failed jobs. + * * @return the number of jobs that failed to execute due to an exception. */ int getFailedJobCount(); /** + * Gets total number of validation jobs. + * * @return the total number of validation jobs in the batch. */ int getTotalJobCount(); - + + /** + * Gets number of successful jobs. + * + * @return the number of successful jobs + */ int getSuccessfulJobCount(); }