From afeb08302edf44ea46beab7dbb881f65b74f1f33 Mon Sep 17 00:00:00 2001 From: Katerina Date: Fri, 21 Jun 2024 14:47:24 +0300 Subject: [PATCH] cleaning log messages --- .../controllers/ValidationController.java | 4 ---- .../validatorapi/processors/XmlProcessor.java | 17 ++++++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main/java/eu/dnetlib/validatorapi/controllers/ValidationController.java b/src/main/java/eu/dnetlib/validatorapi/controllers/ValidationController.java index 90d470b..94586c1 100644 --- a/src/main/java/eu/dnetlib/validatorapi/controllers/ValidationController.java +++ b/src/main/java/eu/dnetlib/validatorapi/controllers/ValidationController.java @@ -208,10 +208,6 @@ public class ValidationController { validationJob.guidelines = profile.name(); validationJobRepository.save(validationJob); - - log.info("Initial validation job id "+ validationJob.id); - log.info("\n\n\n\n\n" + numberOfRecords + "\n\n\n\n"); - int record = 0; double resultSum = 0; diff --git a/src/main/java/eu/dnetlib/validatorapi/processors/XmlProcessor.java b/src/main/java/eu/dnetlib/validatorapi/processors/XmlProcessor.java index d200308..87eb027 100644 --- a/src/main/java/eu/dnetlib/validatorapi/processors/XmlProcessor.java +++ b/src/main/java/eu/dnetlib/validatorapi/processors/XmlProcessor.java @@ -8,6 +8,8 @@ import eu.dnetlib.validatorapi.entities.ValidationJob; import eu.dnetlib.validatorapi.entities.ValidationRuleResult; import org.apache.camel.Exchange; import org.apache.camel.Processor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -22,13 +24,15 @@ import java.util.List; import java.util.Map; public class XmlProcessor implements Processor { + + private static final Logger log = LoggerFactory.getLogger(XmlProcessor.class); + private final AbstractOpenAireProfile profile; private ValidationJob validationJob; // private final ValidationIssueRepository validationIssueRepository; private final long maxNumberOfRecords; private int processedRecords; private String status = "SUCCESS"; - // private int resultSum; private int scoreSum; @@ -44,11 +48,12 @@ public class XmlProcessor implements Processor { @Override public void process(Exchange exchange) throws Exception { String recordXml = exchange.getIn().getBody(String.class); + final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); final DocumentBuilder documentBuilder = dbf.newDocumentBuilder(); Document doc = documentBuilder.parse(new InputSource(new StringReader(recordXml))); String recordUrl = extractRecordUrl(doc, "identifier"); - System.out.println("Record url: " + recordUrl); + List validationRuleResults = new ArrayList<>(); List validationIssues = new ArrayList<>(); @@ -96,9 +101,6 @@ public class XmlProcessor implements Processor { resultsMap.put("issues", validationIssues); exchange.getIn().setBody(resultsMap, Map.class); - // System.out.println("Validation Issues: " + validationIssues); - - System.out.println("processed records: " + processedRecords); if (processedRecords > maxNumberOfRecords) { exchange.getIn().setHeader("MyHeader", "stop"); exchange.getIn().setHeader("validationId", validationJob.id); @@ -125,8 +127,9 @@ public class XmlProcessor implements Processor { } - private void constructValidationRuleResult(ValidationRuleResult validationRuleResult, int validationJobId, String guidelines, String recordUrl, String ruleName, - AbstractOpenAireProfile profile, Guideline.Result engineResult) { + private void constructValidationRuleResult(ValidationRuleResult validationRuleResult, int validationJobId, + String guidelines, String recordUrl, String ruleName, + AbstractOpenAireProfile profile, Guideline.Result engineResult) { validationRuleResult.validationJobId = validationJobId; validationRuleResult.guidelines = guidelines;