Skip to content

Commit

Permalink
Added support for assert id attribut -> errorId
Browse files Browse the repository at this point in the history
Sets the errorId in IError from the failed-assert id attribute from XSLT
and assert id attribute from schematron.
  • Loading branch information
magnusg-scancloud committed Apr 27, 2020
1 parent fd1099d commit f5d4fb6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 <DiagnosticReference> 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);
Expand Down Expand Up @@ -99,13 +102,20 @@ public IErrorLevel getFlag ()
return m_aFlag;
}

@Nullable
public String getId()
{
return m_sId;
}

@Nonnull
public SVRLResourceError getAsResourceError (@Nullable final String sResourceName)
{
return new SVRLErrorBuilder (m_sTest).setErrorLevel (m_aFlag)
.setErrorFieldName (m_sLocation)
.setErrorLocation (new SimpleLocation (sResourceName))
.setErrorText (m_sText)
.setErrorID(m_sId)
.build ();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit f5d4fb6

Please sign in to comment.