1 |
26600
|
sandro.lab
|
package eu.dnetlib.msro.workflows.nodes.transform;
|
2 |
|
|
|
3 |
32639
|
michele.ar
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
4 |
40094
|
michele.ar
|
import eu.dnetlib.msro.workflows.graph.Arc;
|
5 |
26600
|
sandro.lab
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
6 |
40099
|
michele.ar
|
import eu.dnetlib.msro.workflows.procs.Env;
|
7 |
41797
|
michele.ar
|
import eu.dnetlib.rmi.common.ResultSet;
|
8 |
41783
|
michele.ar
|
import eu.dnetlib.rmi.data.CleanerService;
|
9 |
42621
|
sandro.lab
|
import org.springframework.beans.factory.annotation.Autowired;
|
10 |
26600
|
sandro.lab
|
|
11 |
|
|
public class CleanJobNode extends SimpleJobNode {
|
12 |
|
|
|
13 |
|
|
private String inputEprParam;
|
14 |
|
|
private String outputEprParam;
|
15 |
|
|
private String ruleId;
|
16 |
|
|
|
17 |
42621
|
sandro.lab
|
@Autowired
|
18 |
32639
|
michele.ar
|
private UniqueServiceLocator serviceLocator;
|
19 |
26600
|
sandro.lab
|
|
20 |
|
|
@Override
|
21 |
40094
|
michele.ar
|
protected String execute(final Env env) throws Exception {
|
22 |
26600
|
sandro.lab
|
|
23 |
41797
|
michele.ar
|
@SuppressWarnings("unchecked")
|
24 |
|
|
final ResultSet<String> rsIn = env.getAttribute(this.inputEprParam, ResultSet.class);
|
25 |
|
|
final ResultSet<String> rsOut =
|
26 |
|
|
this.ruleId == null || this.ruleId.isEmpty() ? rsIn : this.serviceLocator.getService(CleanerService.class).clean(rsIn, this.ruleId);
|
27 |
26600
|
sandro.lab
|
|
28 |
41797
|
michele.ar
|
env.setAttribute(this.outputEprParam, rsOut);
|
29 |
26600
|
sandro.lab
|
|
30 |
|
|
return Arc.DEFAULT_ARC;
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
public String getInputEprParam() {
|
34 |
41783
|
michele.ar
|
return this.inputEprParam;
|
35 |
26600
|
sandro.lab
|
}
|
36 |
|
|
|
37 |
|
|
public void setInputEprParam(final String inputEprParam) {
|
38 |
|
|
this.inputEprParam = inputEprParam;
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
public String getOutputEprParam() {
|
42 |
41783
|
michele.ar
|
return this.outputEprParam;
|
43 |
26600
|
sandro.lab
|
}
|
44 |
|
|
|
45 |
|
|
public void setOutputEprParam(final String outputEprParam) {
|
46 |
|
|
this.outputEprParam = outputEprParam;
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
public String getRuleId() {
|
50 |
41783
|
michele.ar
|
return this.ruleId;
|
51 |
26600
|
sandro.lab
|
}
|
52 |
|
|
|
53 |
|
|
public void setRuleId(final String ruleId) {
|
54 |
|
|
this.ruleId = ruleId;
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
}
|