mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-26 01:05:38 +00:00
Merge branch '34-ruckgabe-objekt-enthalt-keine-information-uber-verarbeitungs-erfolg' into 'master'
Resolve "Rückgabe-Objekt enthält keine Information über Verarbeitungs-Erfolg" See merge request kosit/validator!17
This commit is contained in:
commit
165ce94be9
3 changed files with 36 additions and 6 deletions
|
|
@ -14,22 +14,42 @@ import net.sf.saxon.s9api.XdmNode;
|
||||||
*/
|
*/
|
||||||
public interface Result {
|
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();
|
XdmNode getReport();
|
||||||
|
|
||||||
/** Das evaluierte Ergebnis. */
|
/**
|
||||||
|
* Das evaluierte Ergebnis.
|
||||||
|
*/
|
||||||
AcceptRecommendation getAcceptRecommendation();
|
AcceptRecommendation getAcceptRecommendation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt den Report als W3C-{@link Document} zurück.
|
* Gibt den Report als W3C-{@link Document} zurück.
|
||||||
*
|
*
|
||||||
* @return der Report
|
* @return der Report
|
||||||
*/
|
*/
|
||||||
Document getReportDocument();
|
Document getReportDocument();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schnellzugriff auf die Empfehlung zur Weiterverarbeitung des Dokuments.
|
* Schnellzugriff auf die Empfehlung zur Weiterverarbeitung des Dokuments.
|
||||||
*
|
*
|
||||||
* @return true wenn {@link AcceptRecommendation#ACCEPTABLE}
|
* @return true wenn {@link AcceptRecommendation#ACCEPTABLE}
|
||||||
*/
|
*/
|
||||||
boolean isAcceptable();
|
boolean isAcceptable();
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,10 @@ public class DefaultCheck implements Check {
|
||||||
if (t.getSchemaValidationResult() != null) {
|
if (t.getSchemaValidationResult() != null) {
|
||||||
result.setSchemaViolations(convertErrors(t.getSchemaValidationResult().getErrors()));
|
result.setSchemaViolations(convertErrors(t.getSchemaValidationResult().getErrors()));
|
||||||
}
|
}
|
||||||
|
result.setProcessingSuccessful(!t.isStopped() && t.isFinished());
|
||||||
|
if (t.getReportInput().getProcessingError() != null) {
|
||||||
|
result.getProcessingErrors().addAll(t.getReportInput().getProcessingError().getError());
|
||||||
|
}
|
||||||
result.setSchematronResult(t.getReportInput().getValidationResultsSchematron().stream()
|
result.setSchematronResult(t.getReportInput().getValidationResultsSchematron().stream()
|
||||||
.map(e -> e.getResults().getSchematronOutput()).collect(Collectors.toList()));
|
.map(e -> e.getResults().getSchematronOutput()).collect(Collectors.toList()));
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,17 @@ public class DefaultResult implements Result {
|
||||||
@Getter
|
@Getter
|
||||||
private List<XmlError> schemaViolations = new ArrayList<>();
|
private List<XmlError> schemaViolations = new ArrayList<>();
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private List<String> processingErrors = new ArrayList<>();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter(AccessLevel.PACKAGE)
|
@Setter(AccessLevel.PACKAGE)
|
||||||
private List<SchematronOutput> schematronResult;
|
private List<SchematronOutput> schematronResult;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private boolean processingSuccessful;
|
||||||
|
|
||||||
public DefaultResult(final XdmNode report, final AcceptRecommendation recommendation, final ContentRepository repository) {
|
public DefaultResult(final XdmNode report, final AcceptRecommendation recommendation, final ContentRepository repository) {
|
||||||
this.report = report;
|
this.report = report;
|
||||||
this.acceptRecommendation = recommendation;
|
this.acceptRecommendation = recommendation;
|
||||||
|
|
@ -76,10 +83,9 @@ public class DefaultResult implements Result {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isAcceptable() {
|
public boolean isAcceptable() {
|
||||||
return AcceptRecommendation.ACCEPTABLE.equals(this.acceptRecommendation);
|
return isProcessingSuccessful() && AcceptRecommendation.ACCEPTABLE.equals(this.acceptRecommendation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<String> extractHtmlAsString() {
|
public List<String> extractHtmlAsString() {
|
||||||
return extractHtml().stream().map(DefaultResult::convertToString).collect(Collectors.toList());
|
return extractHtml().stream().map(DefaultResult::convertToString).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue