1
|
package eu.dnetlib.msro.openaireplus.workflows.nodes.contexts;
|
2
|
|
3
|
import javax.annotation.Resource;
|
4
|
|
5
|
import com.googlecode.sarasvati.Arc;
|
6
|
import com.googlecode.sarasvati.NodeToken;
|
7
|
import eu.dnetlib.enabling.resultset.client.ResultSetClientFactory;
|
8
|
import eu.dnetlib.msro.workflows.nodes.ProgressJobNode;
|
9
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
10
|
import eu.dnetlib.msro.workflows.resultset.ProcessCountingResultSetFactory;
|
11
|
import eu.dnetlib.msro.workflows.util.ProgressProvider;
|
12
|
import eu.dnetlib.msro.workflows.util.ResultsetProgressProvider;
|
13
|
import org.apache.commons.logging.Log;
|
14
|
import org.apache.commons.logging.LogFactory;
|
15
|
|
16
|
public class ProcessContextsJobNode extends SimpleJobNode implements ProgressJobNode {
|
17
|
|
18
|
private static final Log log = LogFactory.getLog(ProcessContextsJobNode.class);
|
19
|
|
20
|
private String eprParam;
|
21
|
private String contextObj;
|
22
|
private ResultsetProgressProvider progressProvider;
|
23
|
private String contextId;
|
24
|
private String contextLabel;
|
25
|
private String contextType;
|
26
|
|
27
|
private String contextParams;
|
28
|
private String dashboardVisibility;
|
29
|
|
30
|
@Resource
|
31
|
private ResultSetClientFactory resultSetClientFactory;
|
32
|
|
33
|
@Resource
|
34
|
private ProcessCountingResultSetFactory processCountingResultSetFactory;
|
35
|
|
36
|
@Override
|
37
|
protected String execute(final NodeToken token) throws Exception {
|
38
|
|
39
|
final String epr = token.getEnv().getAttribute(eprParam);
|
40
|
|
41
|
this.progressProvider = processCountingResultSetFactory.createProgressProvider(token.getProcess(), epr);
|
42
|
|
43
|
final Iterable<String> iter = resultSetClientFactory.getClient(progressProvider.getEpr());
|
44
|
|
45
|
final ContextDesc context = ContextUtils.getContext(iter, getContextId(), getContextLabel(), getContextType(), getContextParams(), getDashboardVisibility());
|
46
|
|
47
|
token.getEnv().setTransientAttribute(contextObj, context);
|
48
|
|
49
|
return Arc.DEFAULT_ARC;
|
50
|
}
|
51
|
|
52
|
public String getEprParam() {
|
53
|
return eprParam;
|
54
|
}
|
55
|
|
56
|
public void setEprParam(final String eprParam) {
|
57
|
this.eprParam = eprParam;
|
58
|
}
|
59
|
|
60
|
public String getContextObj() {
|
61
|
return contextObj;
|
62
|
}
|
63
|
|
64
|
public void setContextObj(final String contextObj) {
|
65
|
this.contextObj = contextObj;
|
66
|
}
|
67
|
|
68
|
@Override
|
69
|
public ProgressProvider getProgressProvider() {
|
70
|
return progressProvider;
|
71
|
}
|
72
|
|
73
|
public String getContextId() {
|
74
|
return contextId;
|
75
|
}
|
76
|
|
77
|
public void setContextId(final String contextId) {
|
78
|
this.contextId = contextId;
|
79
|
}
|
80
|
|
81
|
public String getContextLabel() {
|
82
|
return contextLabel;
|
83
|
}
|
84
|
|
85
|
public void setContextLabel(final String contextLabel) {
|
86
|
this.contextLabel = contextLabel;
|
87
|
}
|
88
|
|
89
|
public String getContextType() {
|
90
|
return contextType;
|
91
|
}
|
92
|
|
93
|
public void setContextType(final String contextType) {
|
94
|
this.contextType = contextType;
|
95
|
}
|
96
|
|
97
|
public String getContextParams() {
|
98
|
return contextParams;
|
99
|
}
|
100
|
|
101
|
public void setContextParams(final String contextParams) {
|
102
|
this.contextParams = contextParams;
|
103
|
}
|
104
|
|
105
|
public String getDashboardVisibility() {
|
106
|
return dashboardVisibility;
|
107
|
}
|
108
|
|
109
|
public void setDashboardVisibility(final String dashboardVisibility) {
|
110
|
this.dashboardVisibility = dashboardVisibility;
|
111
|
}
|
112
|
}
|