1
|
package eu.dnetlib.msro.workflows.nodes.oai;
|
2
|
|
3
|
import eu.dnetlib.enabling.resultset.client.ResultSetClient;
|
4
|
import eu.dnetlib.enabling.tools.blackboard.BlackboardJob;
|
5
|
import eu.dnetlib.miscutils.datetime.DateUtils;
|
6
|
import eu.dnetlib.msro.workflows.procs.Token;
|
7
|
import eu.dnetlib.msro.workflows.util.ResultsetProgressProvider;
|
8
|
import eu.dnetlib.oai.utils.OAIParameterNames;
|
9
|
import eu.dnetlib.rmi.common.ResultSet;
|
10
|
import eu.dnetlib.rmi.common.ResultSetException;
|
11
|
import org.apache.commons.logging.Log;
|
12
|
import org.apache.commons.logging.LogFactory;
|
13
|
import org.springframework.beans.factory.annotation.Autowired;
|
14
|
|
15
|
public class SyncOAIStoreJobNode extends AbstractOAIJobNode {
|
16
|
|
17
|
private static final Log log = LogFactory.getLog(SyncOAIStoreJobNode.class); // NOPMD by marko on 11/24/08 5:02 PM
|
18
|
|
19
|
private String eprParam;
|
20
|
|
21
|
@Autowired
|
22
|
private ResultSetClient resultSetClient;
|
23
|
|
24
|
private boolean alwaysNewRecord = false;
|
25
|
private boolean skipDuplicates = false;
|
26
|
private String duplicateXPath;
|
27
|
|
28
|
|
29
|
@Override
|
30
|
void completePrepareJob(final BlackboardJob job, final Token token) throws ResultSetException {
|
31
|
final ResultSet<?> rs = token.getEnv().getAttribute(getEprParam(), ResultSet.class);
|
32
|
token.setProgressProvider(new ResultsetProgressProvider(rs, this.resultSetClient));
|
33
|
|
34
|
job.setAction("SYNC");
|
35
|
job.getParameters().put(OAIParameterNames.OAI_FEED_DATE, DateUtils.now_ISO8601());
|
36
|
job.getParameters().put(OAIParameterNames.OAI_SKIP_DUPLICATES, String.valueOf(skipDuplicates));
|
37
|
if(skipDuplicates) job.getParameters().put(OAIParameterNames.OAI_DUPLICATE_XPATH, duplicateXPath);
|
38
|
job.getParameters().put(OAIParameterNames.OAI_SYNC_EPR, rs.toJson());
|
39
|
job.getParameters().put(OAIParameterNames.OAI_ALWAYS_NEW_RECORD, String.valueOf(alwaysNewRecord));
|
40
|
}
|
41
|
|
42
|
public String getEprParam() {
|
43
|
return eprParam;
|
44
|
}
|
45
|
|
46
|
public void setEprParam(final String eprParam) {
|
47
|
this.eprParam = eprParam;
|
48
|
}
|
49
|
|
50
|
public boolean isAlwaysNewRecord() {
|
51
|
return alwaysNewRecord;
|
52
|
}
|
53
|
|
54
|
public void setAlwaysNewRecord(boolean alwaysNewRecord) {
|
55
|
this.alwaysNewRecord = alwaysNewRecord;
|
56
|
}
|
57
|
|
58
|
public boolean isSkipDuplicates() {
|
59
|
return skipDuplicates;
|
60
|
}
|
61
|
|
62
|
public void setSkipDuplicates(final boolean skipDuplicates) {
|
63
|
this.skipDuplicates = skipDuplicates;
|
64
|
}
|
65
|
|
66
|
public String getDuplicateXPath() {
|
67
|
return duplicateXPath;
|
68
|
}
|
69
|
|
70
|
public void setDuplicateXPath(final String duplicateXPath) {
|
71
|
this.duplicateXPath = duplicateXPath;
|
72
|
}
|
73
|
|
74
|
}
|