Revision 56873
Added by Alessia Bardi over 4 years ago
IncrementalOperationJobNode.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
if ("incremental".equalsIgnoreCase(operationType)) { |
32 | 32 |
final String currentWfProfileId = findCurrentWfProfileId(nodeToken); |
33 |
final Long lastSuccessEndDate = findLastSuccessEndDate(currentWfProfileId);
|
|
34 |
if(forceRefresh(nodeToken, lastSuccessEndDate, currentWfProfileId)) return Arc.DEFAULT_ARC;
|
|
35 |
log.info("Last success date "+ lastSuccessEndDate);
|
|
33 |
final Long lastSuccessStartDate = findLastSuccessStartDate(currentWfProfileId);
|
|
34 |
if(forceRefresh(nodeToken, lastSuccessStartDate, currentWfProfileId)) return Arc.DEFAULT_ARC;
|
|
35 |
log.info("Last success start date "+ lastSuccessStartDate);
|
|
36 | 36 |
|
37 |
nodeToken.getFullEnv().setAttribute("OperationTypeInfo", "Operation type set to INCREMENTAL with date "+DateUtils.calculate_ISO8601(lastSuccessEndDate));
|
|
37 |
nodeToken.getFullEnv().setAttribute("OperationTypeInfo", "Operation type set to INCREMENTAL with date "+DateUtils.calculate_ISO8601(lastSuccessStartDate));
|
|
38 | 38 |
nodeToken.getFullEnv().setAttribute("operationType", "INCREMENTAL"); |
39 |
nodeToken.getFullEnv().setAttribute("DateFromFilter", lastSuccessEndDate);
|
|
39 |
nodeToken.getFullEnv().setAttribute("DateFromFilter", lastSuccessStartDate);
|
|
40 | 40 |
return Arc.DEFAULT_ARC; |
41 | 41 |
} |
42 | 42 |
nodeToken.getFullEnv().setAttribute("operationType", "REFRESH"); |
... | ... | |
44 | 44 |
return Arc.DEFAULT_ARC; |
45 | 45 |
} |
46 | 46 |
|
47 |
protected boolean forceRefresh(final NodeToken nodeToken, final Long lastSuccessEndDate, final String currentWfProfileId) throws Exception {
|
|
48 |
if (lastSuccessEndDate < 0) {
|
|
49 |
nodeToken.getFullEnv().setAttribute("OperationTypeInfo", "Last success date < 0, operation forced to REFRESH"); |
|
47 |
protected boolean forceRefresh(final NodeToken nodeToken, final Long lastSuccessStartDate, final String currentWfProfileId) throws Exception {
|
|
48 |
if (lastSuccessStartDate < 0) {
|
|
49 |
nodeToken.getFullEnv().setAttribute("OperationTypeInfo", "Last success start date < 0, operation forced to REFRESH");
|
|
50 | 50 |
nodeToken.getFullEnv().setAttribute("operationType", "REFRESH"); |
51 | 51 |
return true; |
52 | 52 |
} |
53 | 53 |
return false; |
54 | 54 |
} |
55 | 55 |
|
56 |
private Long findLastSuccessEndDate(String profId) {
|
|
56 |
private Long findLastSuccessStartDate(String profId) {
|
|
57 | 57 |
long res = -1; |
58 | 58 |
|
59 | 59 |
final Iterator<Map<String, String>> iter = dnetLogger.find(WorkflowsConstants.SYSTEM_WF_PROFILE_ID, profId); |
60 | 60 |
while (iter.hasNext()) { |
61 | 61 |
final Map<String, String> map = iter.next(); |
62 | 62 |
if ("true".equalsIgnoreCase(map.get(WorkflowsConstants.SYSTEM_COMPLETED_SUCCESSFULLY))) { |
63 |
final long curr = NumberUtils.toLong(map.get(WorkflowsConstants.SYSTEM_END_DATE), -1);
|
|
63 |
final long curr = NumberUtils.toLong(map.get(WorkflowsConstants.SYSTEM_START_DATE), -1);
|
|
64 | 64 |
if (curr > res) { |
65 | 65 |
res = curr; |
66 | 66 |
} |
Also available in: Unified diff
Fixes #3191#note-20: incremental transformation