1 |
34996
|
michele.ar
|
package eu.dnetlib.msro.openaireplus.workflows.nodes.contexts;
|
2 |
|
|
|
3 |
|
|
import javax.annotation.Resource;
|
4 |
|
|
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
5 |
|
|
|
6 |
|
|
import com.google.common.collect.Iterables;
|
7 |
|
|
import com.googlecode.sarasvati.Arc;
|
8 |
|
|
import com.googlecode.sarasvati.NodeToken;
|
9 |
|
|
import eu.dnetlib.enabling.resultset.IterableResultSetFactory;
|
10 |
|
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
11 |
48139
|
alessia.ba
|
import org.apache.commons.logging.Log;
|
12 |
|
|
import org.apache.commons.logging.LogFactory;
|
13 |
34996
|
michele.ar
|
|
14 |
|
|
public class PrepareContextDbEntriesJobNode extends SimpleJobNode {
|
15 |
|
|
|
16 |
|
|
private String contextObj;
|
17 |
|
|
private String eprParam;
|
18 |
|
|
|
19 |
|
|
private static final Log log = LogFactory.getLog(PrepareContextDbEntriesJobNode.class);
|
20 |
|
|
|
21 |
|
|
@Resource
|
22 |
|
|
private IterableResultSetFactory iterableResultSetFactory;
|
23 |
|
|
|
24 |
|
|
@Override
|
25 |
|
|
protected String execute(final NodeToken token) throws Exception {
|
26 |
|
|
|
27 |
|
|
final ContextDesc desc = (ContextDesc) token.getEnv().getTransientAttribute(contextObj);
|
28 |
|
|
|
29 |
41483
|
claudio.at
|
final Iterable<String> iter = Iterables.transform(desc.getDbEntries().entrySet(), ContextUtils.getContextRowTransformer());
|
30 |
34996
|
michele.ar
|
final W3CEndpointReference epr = iterableResultSetFactory.createIterableResultSet(iter);
|
31 |
|
|
|
32 |
|
|
token.getEnv().setAttribute(eprParam, epr.toString());
|
33 |
|
|
|
34 |
|
|
return Arc.DEFAULT_ARC;
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
public String getContextObj() {
|
38 |
|
|
return contextObj;
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
public void setContextObj(final String contextObj) {
|
42 |
|
|
this.contextObj = contextObj;
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
public String getEprParam() {
|
46 |
|
|
return eprParam;
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
public void setEprParam(final String eprParam) {
|
50 |
|
|
this.eprParam = eprParam;
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
}
|