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 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.static TestAssertion
defaultAssertion()
Returns an immutable default instance of a TestAssertion.static Location
defaultLocation()
Returns an immutable default instance of a Location.static ValidationResult
defaultResult()
Returns an immutable default instance of a ValidationResult.static Location
locationFromValues(String level, String context)
TODO: Better explanation of level and context.static ValidationResult
resultFromValues(ValidationProfile validationProfile, List<TestAssertion> assertions)
static ValidationResult
resultFromValues(ValidationProfile validationProfile, List<TestAssertion> assertions, boolean isCompliant)
static ValidationResult
resultFromValues(ValidationProfile validationProfile, List<TestAssertion> assertions, HashMap<RuleId,Integer> failedChecks, boolean isCompliant, int totalAssertions)
static ValidationResult
resultFromXmlString(String xmlSource)
static ValidationResult
stripPassedTests(ValidationResult toStrip)
Strips anyTestAssertion
s whereassertion.getStatus() == TestAssertion.Status.PASSED
fromtoStrip
and returns a newValidationResult
without the passed assertions.
-
-
-
Method Detail
-
resultFromValues
public static ValidationResult resultFromValues(ValidationProfile validationProfile, List<TestAssertion> assertions, boolean isCompliant)
- Parameters:
validationProfile
- aValidationProfile
instance 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, HashMap<RuleId,Integer> failedChecks, boolean isCompliant, int totalAssertions)
- Parameters:
validationProfile
- aValidationProfile
instance 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
- aValidationProfile
instance 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 aValidationResult
to 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
- theRuleId
value forRule
the assertion refers to.status
- theTestAssertion.Status
of the assertion.message
- any String message to be associated with the assertion.location
- aLocation
instance 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 immutableLocation
instance.- 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 anyTestAssertion
s whereassertion.getStatus() == TestAssertion.Status.PASSED
fromtoStrip
and returns a newValidationResult
without the passed assertions.- Parameters:
toStrip
- aValidationResult
to clone without passedTestAssertion
s- Returns:
- a ValidationResult instance identical to
toStrip
, but without passedTestAssertion
s.
-
-