Package org.verapdf.pdfa.results
Class ValidationResults
- java.lang.Object
-
- org.verapdf.pdfa.results.ValidationResults
-
public class ValidationResults extends Object
- Author:
- Carl Wilson
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TestAssertionassertionFromValues(int ordinal, RuleId ruleId, TestAssertion.Status status, String message, Location location, String context, String errorMessage, List<String> errorArguments)Creates an immutable TestAssertion instance from the passed parameter values.static TestAssertiondefaultAssertion()Returns an immutable default instance of a TestAssertion.static LocationdefaultLocation()Returns an immutable default instance of a Location.static ValidationResultdefaultResult()Returns an immutable default instance of a ValidationResult.static LocationlocationFromValues(String level, String context)TODO: Better explanation of level and context.static ValidationResultresultFromValues(ValidationProfile validationProfile, List<TestAssertion> assertions)static ValidationResultresultFromValues(ValidationProfile validationProfile, List<TestAssertion> assertions, boolean isCompliant)static ValidationResultresultFromValues(ValidationProfile validationProfile, List<TestAssertion> assertions, boolean isCompliant, int totalAssertions)static ValidationResultresultFromXmlString(String xmlSource)static ValidationResultstripPassedTests(ValidationResult toStrip)Strips anyTestAssertions whereassertion.getStatus() == TestAssertion.Status.PASSEDfromtoStripand returns a newValidationResultwithout the passed assertions.
-
-
-
Method Detail
-
resultFromValues
public static ValidationResult resultFromValues(ValidationProfile validationProfile, List<TestAssertion> assertions, boolean isCompliant)
- Parameters:
validationProfile- aValidationProfileinstance indicating the validation type performedassertions- the Set of TestAssertions reported by during validationisCompliant- a boolean that indicating whether the validated PDF/A data was compliant with the indicated flavour- Returns:
- a new ValidationResult instance populated from the values
-
resultFromValues
public static ValidationResult resultFromValues(ValidationProfile validationProfile, List<TestAssertion> assertions, boolean isCompliant, int totalAssertions)
- Parameters:
validationProfile- aValidationProfileinstance indicating the validation type performedassertions- the Set of TestAssertions reported by during validationisCompliant- a boolean that indicating whether the validated PDF/A data was compliant with the indicated flavourtotalAssertions-- Returns:
- a new ValidationResult instance populated from the values
-
resultFromValues
public static ValidationResult resultFromValues(ValidationProfile validationProfile, List<TestAssertion> assertions)
- Parameters:
validationProfile- aValidationProfileinstance indicating the validation type performedassertions- the Set of TestAssertions reported by during validation- Returns:
- a new ValidationResult instance populated from the values
-
resultFromXmlString
public static ValidationResult resultFromXmlString(String xmlSource) throws JAXBException
- Parameters:
xmlSource- XML representation of aValidationResultto deserialise- Returns:
- a new ValidationResult instance deserialised from the passed String
- Throws:
JAXBException- when the passed String is not a valid XML representation
-
defaultResult
public static ValidationResult defaultResult()
Returns an immutable default instance of a ValidationResult. This is a static single instance, i.e.ValidationResults.defaultResult() == ValidationResults.defaultResult()is always true.- Returns:
- the default ValidationResult instance
-
assertionFromValues
public static TestAssertion assertionFromValues(int ordinal, RuleId ruleId, TestAssertion.Status status, String message, Location location, String context, String errorMessage, List<String> errorArguments)
Creates an immutable TestAssertion instance from the passed parameter values.- Parameters:
ordinal- the integer ordinal for the instanceruleId- theRuleIdvalue forRulethe assertion refers to.status- theTestAssertion.Statusof the assertion.message- any String message to be associated with the assertion.location- aLocationinstance indicating the location within the PDF document where the test was performed.- Returns:
- an immutable TestAssertion instance initialised using the passed values
-
defaultAssertion
public static TestAssertion defaultAssertion()
Returns an immutable default instance of a TestAssertion. This is a static single instance, i.e.ValidationResults.defaultAssertion() == ValidationResults.defaultAssertion()is always true.- Returns:
- the default TestAssertion instance
-
locationFromValues
public static Location locationFromValues(String level, String context)
TODO: Better explanation of level and context. Creates an immutableLocationinstance.- Parameters:
level- the Locations level, represented as a Stringcontext- the Locations context, represented as a String- Returns:
- and immutable Location instance initialised with the passed values.
-
defaultLocation
public static Location defaultLocation()
Returns an immutable default instance of a Location. This is a static single instance, i.e.ValidationResults.defaultLocation() == ValidationResults.defaultLocation()is always true.- Returns:
- the default Location instance
-
stripPassedTests
public static ValidationResult stripPassedTests(ValidationResult toStrip)
Strips anyTestAssertions whereassertion.getStatus() == TestAssertion.Status.PASSEDfromtoStripand returns a newValidationResultwithout the passed assertions.- Parameters:
toStrip- aValidationResultto clone without passedTestAssertions- Returns:
- a ValidationResult instance identical to
toStrip, but without passedTestAssertions.
-
-