mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
(chore) cleanup logging
This commit is contained in:
parent
5e579dcd11
commit
0771f88f4d
3 changed files with 26 additions and 13 deletions
|
|
@ -0,0 +1,23 @@
|
||||||
|
package de.kosit.validationtool.impl;
|
||||||
|
|
||||||
|
import de.kosit.validationtool.impl.tasks.CheckAction;
|
||||||
|
import de.kosit.validationtool.model.reportInput.DocumentIdentificationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a document identification element for the report by using the generates hash.
|
||||||
|
*
|
||||||
|
* @author Andreas Penski
|
||||||
|
*/
|
||||||
|
class CreateDocumentIdentificationAction implements CheckAction {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void check(final Bag transporter) {
|
||||||
|
final DocumentIdentificationType i = new DocumentIdentificationType();
|
||||||
|
final DocumentIdentificationType.DocumentHash h = new DocumentIdentificationType.DocumentHash();
|
||||||
|
h.setHashAlgorithm(transporter.getInput().getDigestAlgorithm());
|
||||||
|
h.setHashValue(transporter.getInput().getHashCode());
|
||||||
|
i.setDocumentHash(h);
|
||||||
|
i.setDocumentReference(transporter.getInput().getName());
|
||||||
|
transporter.getReportInput().setDocumentIdentification(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -42,7 +42,6 @@ import de.kosit.validationtool.impl.tasks.SchemaValidationAction;
|
||||||
import de.kosit.validationtool.impl.tasks.SchematronValidationAction;
|
import de.kosit.validationtool.impl.tasks.SchematronValidationAction;
|
||||||
import de.kosit.validationtool.impl.tasks.ValidateReportInputAction;
|
import de.kosit.validationtool.impl.tasks.ValidateReportInputAction;
|
||||||
import de.kosit.validationtool.model.reportInput.CreateReportInput;
|
import de.kosit.validationtool.model.reportInput.CreateReportInput;
|
||||||
import de.kosit.validationtool.model.reportInput.DocumentIdentificationType;
|
|
||||||
import de.kosit.validationtool.model.reportInput.EngineType;
|
import de.kosit.validationtool.model.reportInput.EngineType;
|
||||||
import de.kosit.validationtool.model.reportInput.ProcessingError;
|
import de.kosit.validationtool.model.reportInput.ProcessingError;
|
||||||
import de.kosit.validationtool.model.reportInput.XMLSyntaxError;
|
import de.kosit.validationtool.model.reportInput.XMLSyntaxError;
|
||||||
|
|
@ -82,7 +81,7 @@ public class DefaultCheck implements Check {
|
||||||
this.repository = new ScenarioRepository(this.contentRepository);
|
this.repository = new ScenarioRepository(this.contentRepository);
|
||||||
this.repository.initialize(configuration);
|
this.repository.initialize(configuration);
|
||||||
this.checkSteps = new ArrayList<>();
|
this.checkSteps = new ArrayList<>();
|
||||||
this.checkSteps.add(DefaultCheck::createDocumentIdentification);
|
this.checkSteps.add(new CreateDocumentIdentificationAction());
|
||||||
this.checkSteps.add(new DocumentParseAction());
|
this.checkSteps.add(new DocumentParseAction());
|
||||||
this.checkSteps.add(new ScenarioSelectionAction(this.repository));
|
this.checkSteps.add(new ScenarioSelectionAction(this.repository));
|
||||||
this.checkSteps.add(new SchemaValidationAction());
|
this.checkSteps.add(new SchemaValidationAction());
|
||||||
|
|
@ -116,7 +115,7 @@ public class DefaultCheck implements Check {
|
||||||
if (!action.isSkipped(t)) {
|
if (!action.isSkipped(t)) {
|
||||||
action.check(t);
|
action.check(t);
|
||||||
}
|
}
|
||||||
log.info("Step {} finished in {}ms", action.getClass().getSimpleName(), System.currentTimeMillis() - start);
|
log.debug("Step {} finished in {}ms", action.getClass().getSimpleName(), System.currentTimeMillis() - start);
|
||||||
if (t.isStopped()) {
|
if (t.isStopped()) {
|
||||||
final ProcessingError processingError = t.getReportInput().getProcessingError();
|
final ProcessingError processingError = t.getReportInput().getProcessingError();
|
||||||
log.error("Error processing input {}: {}", t.getInput().getName(),
|
log.error("Error processing input {}: {}", t.getInput().getName(),
|
||||||
|
|
@ -147,13 +146,5 @@ public class DefaultCheck implements Check {
|
||||||
return (List<XmlError>) (List<?>) errors;
|
return (List<XmlError>) (List<?>) errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createDocumentIdentification(final CheckAction.Bag transporter) {
|
|
||||||
final DocumentIdentificationType i = new DocumentIdentificationType();
|
|
||||||
final DocumentIdentificationType.DocumentHash h = new DocumentIdentificationType.DocumentHash();
|
|
||||||
h.setHashAlgorithm(transporter.getInput().getDigestAlgorithm());
|
|
||||||
h.setHashValue(transporter.getInput().getHashCode());
|
|
||||||
i.setDocumentHash(h);
|
|
||||||
i.setDocumentReference(transporter.getInput().getName());
|
|
||||||
transporter.getReportInput().setDocumentIdentification(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ public class DocumentParseAction implements CheckAction {
|
||||||
v.getXmlSyntaxError().addAll(parserResult.getErrors());
|
v.getXmlSyntaxError().addAll(parserResult.getErrors());
|
||||||
results.getReportInput().setValidationResultsWellformedness(v);
|
results.getReportInput().setValidationResultsWellformedness(v);
|
||||||
if (parserResult.isInvalid()) {
|
if (parserResult.isInvalid()) {
|
||||||
log.info("Parsing war nicht erfolgreich: {} -> {}", parserResult.getObject(), parserResult.getErrors());
|
|
||||||
results.stopProcessing(parserResult.getErrors().stream().map(XMLSyntaxError::getMessage).collect(Collectors.toList()));
|
results.stopProcessing(parserResult.getErrors().stream().map(XMLSyntaxError::getMessage).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue