1
|
package eu.dnetlib.parthenos.workflows.nodes;
|
2
|
|
3
|
import java.util.Map;
|
4
|
|
5
|
import com.google.gson.Gson;
|
6
|
import eu.dnetlib.msro.workflows.graph.Arc;
|
7
|
import eu.dnetlib.msro.workflows.nodes.AsyncJobNode;
|
8
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
9
|
import eu.dnetlib.msro.workflows.procs.Env;
|
10
|
import eu.dnetlib.msro.workflows.util.WorkflowsConstants;
|
11
|
import org.apache.commons.logging.Log;
|
12
|
import org.apache.commons.logging.LogFactory;
|
13
|
|
14
|
/**
|
15
|
* Created by Alessia Bardi on 05/04/17.
|
16
|
*
|
17
|
* @author Alessia Bardi
|
18
|
*/
|
19
|
public class ReportReaderJobNode extends AsyncJobNode {
|
20
|
|
21
|
private static final Log log = LogFactory.getLog(ReportReaderJobNode.class);
|
22
|
private String reportEnvParam = "validationReport";
|
23
|
private String outputParam = reportEnvParam;
|
24
|
|
25
|
@Override
|
26
|
protected String execute(final Env env) throws Exception {
|
27
|
Map<String, String> report = env.getAttribute(reportEnvParam, Map.class);
|
28
|
Gson gson = new Gson();
|
29
|
String theReport = gson.toJson(report);
|
30
|
env.setAttribute( WorkflowsConstants.MAIN_LOG_PREFIX+outputParam, theReport);
|
31
|
log.debug("Found the report: "+theReport);
|
32
|
return Arc.DEFAULT_ARC;
|
33
|
}
|
34
|
|
35
|
public String getReportEnvParam() {
|
36
|
return reportEnvParam;
|
37
|
}
|
38
|
|
39
|
public void setReportEnvParam(final String reportEnvParam) {
|
40
|
this.reportEnvParam = reportEnvParam;
|
41
|
}
|
42
|
|
43
|
public String getOutputParam() {
|
44
|
return outputParam;
|
45
|
}
|
46
|
|
47
|
public void setOutputParam(final String outputParam) {
|
48
|
this.outputParam = outputParam;
|
49
|
}
|
50
|
}
|