cleaning log messages
This commit is contained in:
parent
7b06c8b97f
commit
afeb08302e
|
@ -208,10 +208,6 @@ public class ValidationController {
|
||||||
validationJob.guidelines = profile.name();
|
validationJob.guidelines = profile.name();
|
||||||
validationJobRepository.save(validationJob);
|
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;
|
int record = 0;
|
||||||
double resultSum = 0;
|
double resultSum = 0;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ import eu.dnetlib.validatorapi.entities.ValidationJob;
|
||||||
import eu.dnetlib.validatorapi.entities.ValidationRuleResult;
|
import eu.dnetlib.validatorapi.entities.ValidationRuleResult;
|
||||||
import org.apache.camel.Exchange;
|
import org.apache.camel.Exchange;
|
||||||
import org.apache.camel.Processor;
|
import org.apache.camel.Processor;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
@ -22,13 +24,15 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class XmlProcessor implements Processor {
|
public class XmlProcessor implements Processor {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(XmlProcessor.class);
|
||||||
|
|
||||||
private final AbstractOpenAireProfile profile;
|
private final AbstractOpenAireProfile profile;
|
||||||
private ValidationJob validationJob;
|
private ValidationJob validationJob;
|
||||||
// private final ValidationIssueRepository validationIssueRepository;
|
// private final ValidationIssueRepository validationIssueRepository;
|
||||||
private final long maxNumberOfRecords;
|
private final long maxNumberOfRecords;
|
||||||
private int processedRecords;
|
private int processedRecords;
|
||||||
private String status = "SUCCESS";
|
private String status = "SUCCESS";
|
||||||
// private int resultSum;
|
|
||||||
private int scoreSum;
|
private int scoreSum;
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,11 +48,12 @@ public class XmlProcessor implements Processor {
|
||||||
@Override
|
@Override
|
||||||
public void process(Exchange exchange) throws Exception {
|
public void process(Exchange exchange) throws Exception {
|
||||||
String recordXml = exchange.getIn().getBody(String.class);
|
String recordXml = exchange.getIn().getBody(String.class);
|
||||||
|
|
||||||
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||||
final DocumentBuilder documentBuilder = dbf.newDocumentBuilder();
|
final DocumentBuilder documentBuilder = dbf.newDocumentBuilder();
|
||||||
Document doc = documentBuilder.parse(new InputSource(new StringReader(recordXml)));
|
Document doc = documentBuilder.parse(new InputSource(new StringReader(recordXml)));
|
||||||
String recordUrl = extractRecordUrl(doc, "identifier");
|
String recordUrl = extractRecordUrl(doc, "identifier");
|
||||||
System.out.println("Record url: " + recordUrl);
|
|
||||||
List<ValidationRuleResult> validationRuleResults = new ArrayList<>();
|
List<ValidationRuleResult> validationRuleResults = new ArrayList<>();
|
||||||
List<ValidationIssue> validationIssues = new ArrayList<>();
|
List<ValidationIssue> validationIssues = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -96,9 +101,6 @@ public class XmlProcessor implements Processor {
|
||||||
resultsMap.put("issues", validationIssues);
|
resultsMap.put("issues", validationIssues);
|
||||||
exchange.getIn().setBody(resultsMap, Map.class);
|
exchange.getIn().setBody(resultsMap, Map.class);
|
||||||
|
|
||||||
// System.out.println("Validation Issues: " + validationIssues);
|
|
||||||
|
|
||||||
System.out.println("processed records: " + processedRecords);
|
|
||||||
if (processedRecords > maxNumberOfRecords) {
|
if (processedRecords > maxNumberOfRecords) {
|
||||||
exchange.getIn().setHeader("MyHeader", "stop");
|
exchange.getIn().setHeader("MyHeader", "stop");
|
||||||
exchange.getIn().setHeader("validationId", validationJob.id);
|
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,
|
private void constructValidationRuleResult(ValidationRuleResult validationRuleResult, int validationJobId,
|
||||||
AbstractOpenAireProfile profile, Guideline.Result engineResult) {
|
String guidelines, String recordUrl, String ruleName,
|
||||||
|
AbstractOpenAireProfile profile, Guideline.Result engineResult) {
|
||||||
|
|
||||||
validationRuleResult.validationJobId = validationJobId;
|
validationRuleResult.validationJobId = validationJobId;
|
||||||
validationRuleResult.guidelines = guidelines;
|
validationRuleResult.guidelines = guidelines;
|
||||||
|
|
Loading…
Reference in New Issue