1
|
package eu.dnetlib.msro.workflows.nodes;
|
2
|
|
3
|
import java.util.List;
|
4
|
|
5
|
import eu.dnetlib.enabling.locators.UniqueServiceLocator;
|
6
|
import eu.dnetlib.msro.workflows.graph.Arc;
|
7
|
import eu.dnetlib.msro.workflows.procs.Env;
|
8
|
import eu.dnetlib.rmi.enabling.ISLookUpService;
|
9
|
import org.apache.commons.io.IOUtils;
|
10
|
import org.springframework.beans.factory.annotation.Required;
|
11
|
import org.springframework.core.io.Resource;
|
12
|
|
13
|
public class FindVocabularyEntriesJobNode extends SimpleJobNode {
|
14
|
|
15
|
private String outputEprParam = "epr";
|
16
|
|
17
|
@javax.annotation.Resource
|
18
|
private UniqueServiceLocator serviceLocator;
|
19
|
|
20
|
private Resource xquery;
|
21
|
|
22
|
@Override
|
23
|
protected String execute(final Env env) throws Exception {
|
24
|
final String query = IOUtils.toString(this.xquery.getInputStream());
|
25
|
final List<String> epr = this.serviceLocator.getService(ISLookUpService.class).quickSearchProfile(query);
|
26
|
env.setAttribute(getOutputEprParam(), epr);
|
27
|
|
28
|
return Arc.DEFAULT_ARC;
|
29
|
}
|
30
|
|
31
|
public String getOutputEprParam() {
|
32
|
return this.outputEprParam;
|
33
|
}
|
34
|
|
35
|
public void setOutputEprParam(final String outputEprParam) {
|
36
|
this.outputEprParam = outputEprParam;
|
37
|
}
|
38
|
|
39
|
public Resource getXquery() {
|
40
|
return this.xquery;
|
41
|
}
|
42
|
|
43
|
@Required
|
44
|
public void setXquery(final Resource xquery) {
|
45
|
this.xquery = xquery;
|
46
|
}
|
47
|
|
48
|
}
|