mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
(wip) Rückgabe von Informationen für den Fehlerfall
This commit is contained in:
parent
dc3f62670c
commit
88b3f01276
3 changed files with 34 additions and 6 deletions
|
|
@ -14,22 +14,42 @@ import net.sf.saxon.s9api.XdmNode;
|
|||
*/
|
||||
public interface Result {
|
||||
|
||||
/** Der generierte Report. */
|
||||
/**
|
||||
* Zeigt an, ob die Verarbeitung durch den Validator erfolgreich durchlaufen wurde. Diese Funktion macht ausdrücklich
|
||||
* keine Aussage über die zur Akzeptanz.
|
||||
*
|
||||
* @return true, wenn die Verarbeitung komplett und erfolgreich durchlaufen wurde
|
||||
* @see #getAcceptRecommendation()
|
||||
*/
|
||||
boolean isProcessingSuccessful();
|
||||
|
||||
/**
|
||||
* Gibt eine Liste mit Verarbeitungsfehlermeldungen zurück.
|
||||
*
|
||||
* @return Liste mit Fehlermeldungen
|
||||
*/
|
||||
List<String> getProcessingErrors();
|
||||
|
||||
/**
|
||||
* Der generierte Report.
|
||||
*/
|
||||
XdmNode getReport();
|
||||
|
||||
/** Das evaluierte Ergebnis. */
|
||||
/**
|
||||
* Das evaluierte Ergebnis.
|
||||
*/
|
||||
AcceptRecommendation getAcceptRecommendation();
|
||||
|
||||
/**
|
||||
* Gibt den Report als W3C-{@link Document} zurück.
|
||||
*
|
||||
*
|
||||
* @return der Report
|
||||
*/
|
||||
Document getReportDocument();
|
||||
|
||||
/**
|
||||
* Schnellzugriff auf die Empfehlung zur Weiterverarbeitung des Dokuments.
|
||||
*
|
||||
*
|
||||
* @return true wenn {@link AcceptRecommendation#ACCEPTABLE}
|
||||
*/
|
||||
boolean isAcceptable();
|
||||
|
|
|
|||
|
|
@ -135,6 +135,8 @@ public class DefaultCheck implements Check {
|
|||
if (t.getSchemaValidationResult() != null) {
|
||||
result.setSchemaViolations(convertErrors(t.getSchemaValidationResult().getErrors()));
|
||||
}
|
||||
result.setProcessingSuccessful(!t.isStopped() && t.isFinished());
|
||||
result.getProcessingErrors().addAll(t.getReportInput().getProcessingError().getError());
|
||||
result.setSchematronResult(t.getReportInput().getValidationResultsSchematron().stream()
|
||||
.map(e -> e.getResults().getSchematronOutput()).collect(Collectors.toList()));
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -49,10 +49,17 @@ public class DefaultResult implements Result {
|
|||
@Getter
|
||||
private List<XmlError> schemaViolations = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
private List<String> processingErrors = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private List<SchematronOutput> schematronResult;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean processingSuccessful;
|
||||
|
||||
public DefaultResult(final XdmNode report, final AcceptRecommendation recommendation, final ContentRepository repository) {
|
||||
this.report = report;
|
||||
this.acceptRecommendation = recommendation;
|
||||
|
|
@ -76,10 +83,9 @@ public class DefaultResult implements Result {
|
|||
*/
|
||||
@Override
|
||||
public boolean isAcceptable() {
|
||||
return AcceptRecommendation.ACCEPTABLE.equals(this.acceptRecommendation);
|
||||
return isProcessingSuccessful() && AcceptRecommendation.ACCEPTABLE.equals(this.acceptRecommendation);
|
||||
}
|
||||
|
||||
|
||||
public List<String> extractHtmlAsString() {
|
||||
return extractHtml().stream().map(DefaultResult::convertToString).collect(Collectors.toList());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue