Revision 46596
Added by Alessia Bardi about 7 years ago
OAISetsCountJobNode.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.msro.oai.workflows.nodes; |
2 | 2 |
|
3 |
import org.apache.commons.lang.StringUtils; |
|
4 |
|
|
5 | 3 |
import com.googlecode.sarasvati.NodeToken; |
6 |
|
|
4 |
import eu.dnetlib.data.information.oai.utils.OAIParameterNames; |
|
7 | 5 |
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob; |
8 | 6 |
|
9 | 7 |
public class OAISetsCountJobNode extends AbstractOAIJobNode { |
10 | 8 |
|
11 | 9 |
private String configuredOnly; |
12 |
private String oaiStoreCollectionParam; |
|
13 |
// overrides the value in the env param oaiStoreCollectionParam |
|
14 |
private String oaiStoreCollection; |
|
15 | 10 |
|
16 | 11 |
@Override |
17 | 12 |
void completePrepareJob(final BlackboardJob job, final NodeToken token) { |
18 | 13 |
job.setAction("COUNT_SETS"); |
19 |
job.getParameters().put("configuredOnly", configuredOnly); |
|
20 |
job.getParameters().put("collection", getCollectionName(token)); |
|
21 |
job.getParameters().put("oai_dbName", token.getEnv().getAttribute("oai_dbName")); |
|
14 |
job.getParameters().put(OAIParameterNames.OAI_CONFIGURED_SETS_ONLY, getConfiguredOnly()); |
|
22 | 15 |
} |
23 | 16 |
|
24 |
private String getCollectionName(final NodeToken token) { |
|
25 |
if (StringUtils.isNotBlank(oaiStoreCollection)) return oaiStoreCollection; |
|
26 |
else { |
|
27 |
String collName = token.getEnv().getAttribute(getOaiStoreCollectionParam()); |
|
28 |
if (collName == null) { |
|
29 |
collName = ""; |
|
30 |
} |
|
31 |
return collName; |
|
32 |
} |
|
33 |
} |
|
34 |
|
|
35 | 17 |
public String getConfiguredOnly() { |
36 | 18 |
return configuredOnly; |
37 | 19 |
} |
... | ... | |
40 | 22 |
this.configuredOnly = configuredOnly; |
41 | 23 |
} |
42 | 24 |
|
43 |
public String getOaiStoreCollectionParam() { |
|
44 |
return oaiStoreCollectionParam; |
|
45 |
} |
|
46 |
|
|
47 |
public void setOaiStoreCollectionParam(final String oaiStoreCollectionParam) { |
|
48 |
this.oaiStoreCollectionParam = oaiStoreCollectionParam; |
|
49 |
} |
|
50 |
|
|
51 |
public String getOaiStoreCollection() { |
|
52 |
return oaiStoreCollection; |
|
53 |
} |
|
54 |
|
|
55 |
public void setOaiStoreCollection(final String oaiStoreCollection) { |
|
56 |
this.oaiStoreCollection = oaiStoreCollection; |
|
57 |
} |
|
58 |
|
|
59 | 25 |
} |
Also available in: Unified diff
integrated changes from 'refactoring' branch