From f5d4fb6fe827d5a808c9f9cf996668c3515c289f Mon Sep 17 00:00:00 2001 From: Magnus Gideryd Date: Mon, 27 Apr 2020 23:54:52 +0200 Subject: [PATCH] Added support for assert id attribut -> errorId Sets the errorId in IError from the failed-assert id attribute from XSLT and assert id attribute from schematron. --- .../helger/schematron/svrl/AbstractSVRLMessage.java | 12 +++++++++++- .../com/helger/schematron/svrl/SVRLFailedAssert.java | 3 ++- .../helger/schematron/svrl/SVRLSuccessfulReport.java | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ph-schematron/src/main/java/com/helger/schematron/svrl/AbstractSVRLMessage.java b/ph-schematron/src/main/java/com/helger/schematron/svrl/AbstractSVRLMessage.java index ecf992b62..b18304d47 100644 --- a/ph-schematron/src/main/java/com/helger/schematron/svrl/AbstractSVRLMessage.java +++ b/ph-schematron/src/main/java/com/helger/schematron/svrl/AbstractSVRLMessage.java @@ -46,13 +46,16 @@ public abstract class AbstractSVRLMessage implements Serializable protected String m_sTest; protected String m_sRole; protected IErrorLevel m_aFlag; + protected String m_sId; + public AbstractSVRLMessage (@Nullable final List aDiagnosticReferences, @Nullable final String sText, @Nullable final String sLocation, @Nullable final String sTest, @Nullable final String sRole, - @Nullable final IErrorLevel aFlag) + @Nullable final IErrorLevel aFlag, + @Nullable final String sId) { m_aDiagnosticReferences = new CommonsArrayList <> (aDiagnosticReferences); m_sText = StringHelper.trim (sText); @@ -99,6 +102,12 @@ public IErrorLevel getFlag () return m_aFlag; } + @Nullable + public String getId() + { + return m_sId; + } + @Nonnull public SVRLResourceError getAsResourceError (@Nullable final String sResourceName) { @@ -106,6 +115,7 @@ public SVRLResourceError getAsResourceError (@Nullable final String sResourceNam .setErrorFieldName (m_sLocation) .setErrorLocation (new SimpleLocation (sResourceName)) .setErrorText (m_sText) + .setErrorID(m_sId) .build (); } diff --git a/ph-schematron/src/main/java/com/helger/schematron/svrl/SVRLFailedAssert.java b/ph-schematron/src/main/java/com/helger/schematron/svrl/SVRLFailedAssert.java index 0f06dbb72..cc34e50a3 100644 --- a/ph-schematron/src/main/java/com/helger/schematron/svrl/SVRLFailedAssert.java +++ b/ph-schematron/src/main/java/com/helger/schematron/svrl/SVRLFailedAssert.java @@ -52,6 +52,7 @@ public SVRLFailedAssert (@Nonnull final FailedAssert aFailedAssert, aLocationProvider.apply (aFailedAssert), aFailedAssert.getTest (), aFailedAssert.getRole (), - aErrLevelProvider.apply (aFailedAssert)); + aErrLevelProvider.apply (aFailedAssert), + aFailedAssert.getId()); } } diff --git a/ph-schematron/src/main/java/com/helger/schematron/svrl/SVRLSuccessfulReport.java b/ph-schematron/src/main/java/com/helger/schematron/svrl/SVRLSuccessfulReport.java index 3eb235cb4..519f7e41c 100644 --- a/ph-schematron/src/main/java/com/helger/schematron/svrl/SVRLSuccessfulReport.java +++ b/ph-schematron/src/main/java/com/helger/schematron/svrl/SVRLSuccessfulReport.java @@ -52,6 +52,7 @@ public SVRLSuccessfulReport (@Nonnull final SuccessfulReport aSuccessfulReport, aLocationProvider.apply (aSuccessfulReport), aSuccessfulReport.getTest (), aSuccessfulReport.getRole (), - aErrLevelProvider.apply (aSuccessfulReport)); + aErrLevelProvider.apply (aSuccessfulReport), + aSuccessfulReport.getId()); } }