2023-06-13 14:57:39 +02:00
|
|
|
package eu.dnetlib.validatorapi.processors;
|
|
|
|
|
|
|
|
import eu.dnetlib.validatorapi.entities.ValidationJob;
|
|
|
|
import org.apache.camel.Exchange;
|
|
|
|
import org.apache.camel.Processor;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
public class DataBaseProcessor implements Processor {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void process(Exchange exchange) throws Exception {
|
2023-07-14 14:53:56 +02:00
|
|
|
ValidationJob validationJob = new ValidationJob();
|
|
|
|
validationJob.id = (Integer)exchange.getIn().getHeader("validationId");
|
2023-10-02 13:08:47 +02:00
|
|
|
validationJob.baseUrl = (String)(exchange.getIn().getHeader("baseUrl"));
|
|
|
|
validationJob.set = (String)(exchange.getIn().getHeader("set"));
|
2023-07-14 14:53:56 +02:00
|
|
|
validationJob.startDate = (Date) exchange.getIn().getHeader("startDate");
|
|
|
|
validationJob.guidelines = (String) exchange.getIn().getHeader("guidelines");
|
|
|
|
validationJob.status = (String)exchange.getIn().getHeader("status");
|
|
|
|
validationJob.recordsTested = (Integer) exchange.getIn().getHeader("recordsTested");
|
|
|
|
validationJob.numberOfRecords = Math.toIntExact((Long) exchange.getIn().getHeader("maxNumberOfRecords"));
|
|
|
|
validationJob.score = (Integer) exchange.getIn().getHeader("score");
|
2023-06-13 14:57:39 +02:00
|
|
|
validationJob.progress = "COMPLETED";
|
|
|
|
validationJob.endDate = new Date();
|
2023-07-14 13:21:21 +02:00
|
|
|
exchange.getIn().setBody(validationJob, ValidationJob.class);
|
2023-06-13 14:57:39 +02:00
|
|
|
}
|
|
|
|
}
|