1
|
package eu.dnetlib.efg.workflows.nodes;
|
2
|
|
3
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
4
|
import eu.dnetlib.msro.workflows.graph.Arc;
|
5
|
import eu.dnetlib.msro.workflows.nodes.SimpleJobNode;
|
6
|
import eu.dnetlib.msro.workflows.procs.Env;
|
7
|
import eu.dnetlib.rmi.enabling.ISLookUpService;
|
8
|
import org.springframework.beans.factory.annotation.Autowired;
|
9
|
|
10
|
/**
|
11
|
* Created by sandro on 5/26/16.
|
12
|
*/
|
13
|
public class ObtainDataSourceParamsJobNode extends SimpleJobNode {
|
14
|
|
15
|
private String providerId;
|
16
|
|
17
|
private String OAIformat;
|
18
|
|
19
|
private String OAILayout;
|
20
|
|
21
|
private String OAIInterpretation;
|
22
|
|
23
|
@Autowired
|
24
|
private UniqueServiceLocator serviceLocator;
|
25
|
|
26
|
@Override
|
27
|
protected String execute(final Env env) throws Exception {
|
28
|
|
29
|
final String query = "let $x := /*[.//RESOURCE_IDENTIFIER/@value='" + providerId + "']//EXTRA_FIELDS\n"
|
30
|
+ "return concat($x/FIELD[./key='OpenAireDataSourceId']/value, ' @@@ ', $x/FIELD[./key='NamespacePrefix']/value)";
|
31
|
|
32
|
final String[] arr = serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(query).split("@@@");
|
33
|
|
34
|
final String nsPrefix = arr[1].trim();
|
35
|
env.setAttribute("datasource_namespacePrefix", nsPrefix);
|
36
|
|
37
|
env.setAttribute("OAIformat", OAIformat);
|
38
|
env.setAttribute("OAILayout", OAILayout);
|
39
|
env.setAttribute("OAIInterpretation", OAIInterpretation);
|
40
|
|
41
|
return Arc.DEFAULT_ARC;
|
42
|
}
|
43
|
|
44
|
public String getProviderId() {
|
45
|
return providerId;
|
46
|
}
|
47
|
|
48
|
public void setProviderId(final String providerId) {
|
49
|
this.providerId = providerId;
|
50
|
}
|
51
|
|
52
|
public String getOAIformat() {
|
53
|
return OAIformat;
|
54
|
}
|
55
|
|
56
|
public void setOAIformat(final String OAIformat) {
|
57
|
this.OAIformat = OAIformat;
|
58
|
}
|
59
|
|
60
|
public String getOAILayout() {
|
61
|
return OAILayout;
|
62
|
}
|
63
|
|
64
|
public void setOAILayout(final String OAILayout) {
|
65
|
this.OAILayout = OAILayout;
|
66
|
}
|
67
|
|
68
|
public String getOAIInterpretation() {
|
69
|
return OAIInterpretation;
|
70
|
}
|
71
|
|
72
|
public void setOAIInterpretation(final String OAIInterpretation) {
|
73
|
this.OAIInterpretation = OAIInterpretation;
|
74
|
}
|
75
|
}
|