1
|
package eu.dnetlib.msro.workflows.nodes.dedup;
|
2
|
|
3
|
import eu.dnetlib.msro.workflows.graph.Arc;
|
4
|
import eu.dnetlib.msro.workflows.nodes.AsyncJobNode;
|
5
|
import eu.dnetlib.msro.workflows.nodes.dedup.utils.DedupConfigurationOrchestration;
|
6
|
import eu.dnetlib.msro.workflows.nodes.dedup.utils.DedupConfigurationOrchestrationLoader;
|
7
|
import eu.dnetlib.msro.workflows.procs.Env;
|
8
|
import org.apache.commons.lang3.StringUtils;
|
9
|
import org.springframework.beans.factory.annotation.Autowired;
|
10
|
|
11
|
public class DedupConfigurationSetterJobNode extends AsyncJobNode {
|
12
|
|
13
|
private String dedupConfigSequence;
|
14
|
|
15
|
private String dedupConfigSequenceParam;
|
16
|
|
17
|
private String entityTypeNameParam;
|
18
|
|
19
|
private String entityTypeIdParam;
|
20
|
|
21
|
@Autowired
|
22
|
private DedupConfigurationOrchestrationLoader dedupOrchestrationLoader;
|
23
|
|
24
|
@Override
|
25
|
protected String execute(final Env env) throws Exception {
|
26
|
|
27
|
if (StringUtils.isBlank(getDedupConfigSequence())) throw new IllegalArgumentException("missing configuration sequence");
|
28
|
|
29
|
final DedupConfigurationOrchestration dedupOrchestration = dedupOrchestrationLoader.loadByActionSetId(getDedupConfigSequence());
|
30
|
|
31
|
env.setAttribute(getEntityTypeNameParam(), dedupOrchestration.getEntity().getName());
|
32
|
env.setAttribute(getEntityTypeIdParam(), dedupOrchestration.getEntity().getCode());
|
33
|
env.setAttribute(getDedupConfigSequenceParam(), dedupOrchestration);
|
34
|
|
35
|
return Arc.DEFAULT_ARC;
|
36
|
}
|
37
|
|
38
|
public String getDedupConfigSequence() {
|
39
|
return dedupConfigSequence;
|
40
|
}
|
41
|
|
42
|
public void setDedupConfigSequence(final String dedupConfigSequence) {
|
43
|
this.dedupConfigSequence = dedupConfigSequence;
|
44
|
}
|
45
|
|
46
|
public String getDedupConfigSequenceParam() {
|
47
|
return dedupConfigSequenceParam;
|
48
|
}
|
49
|
|
50
|
public void setDedupConfigSequenceParam(final String dedupConfigSequenceParam) {
|
51
|
this.dedupConfigSequenceParam = dedupConfigSequenceParam;
|
52
|
}
|
53
|
|
54
|
public String getEntityTypeNameParam() {
|
55
|
return entityTypeNameParam;
|
56
|
}
|
57
|
|
58
|
public void setEntityTypeNameParam(final String entityTypeNameParam) {
|
59
|
this.entityTypeNameParam = entityTypeNameParam;
|
60
|
}
|
61
|
|
62
|
public String getEntityTypeIdParam() {
|
63
|
return entityTypeIdParam;
|
64
|
}
|
65
|
|
66
|
public void setEntityTypeIdParam(final String entityTypeIdParam) {
|
67
|
this.entityTypeIdParam = entityTypeIdParam;
|
68
|
}
|
69
|
}
|