Revision 51108
Added by Alessia Bardi over 6 years ago
modules/dnet-openaireplus-workflows/branches/solr7/src/main/java/eu/dnetlib/msro/openaireplus/workflows/nodes/IncrementalTransformationJobNode.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.msro.openaireplus.workflows.nodes; |
2 | 2 |
|
3 |
import java.util.Iterator; |
|
4 |
import java.util.List; |
|
5 |
import java.util.Map; |
|
6 |
|
|
3 | 7 |
import com.googlecode.sarasvati.Arc; |
4 | 8 |
import com.googlecode.sarasvati.NodeToken; |
5 | 9 |
import eu.dnetlib.common.logging.DnetLogger; |
... | ... | |
14 | 18 |
import org.apache.commons.logging.Log; |
15 | 19 |
import org.apache.commons.logging.LogFactory; |
16 | 20 |
import org.springframework.beans.factory.annotation.Autowired; |
17 |
import org.springframework.beans.factory.annotation.Required; |
|
18 | 21 |
|
19 |
import java.util.Iterator; |
|
20 |
import java.util.List; |
|
21 |
import java.util.Map; |
|
22 |
|
|
23 | 22 |
public class IncrementalTransformationJobNode extends SimpleJobNode { |
24 | 23 |
|
25 | 24 |
private static final Log log = LogFactory.getLog(IncrementalTransformationJobNode.class); |
... | ... | |
41 | 40 |
final String currentWfProfileId = findCurrentWfProfileId(nodeToken); |
42 | 41 |
final Long lastSuccessEndDate = findLastSuccessEndDate(currentWfProfileId); |
43 | 42 |
if (lastSuccessEndDate<0) { |
44 |
nodeToken.getFullEnv().setAttribute("TransformationTypeInfo", "Last success date <0, the transformation will be forced to REFRESH");
|
|
43 |
nodeToken.getFullEnv().setAttribute("TransformationTypeInfo", "Last success date < 0, transformation forced to REFRESH");
|
|
45 | 44 |
nodeToken.getFullEnv().setAttribute("transformationType", "REFRESH"); |
46 | 45 |
return Arc.DEFAULT_ARC; |
47 | 46 |
} |
48 |
log.info("Last succes date "+ lastSuccessEndDate); |
|
49 |
final long lastUpdateDate = getLastTransformationRuleUpdate(getTransformationId(currentWfProfileId)); |
|
50 |
log.info("last update date of the trId is "+lastUpdateDate); |
|
47 |
log.info("Last success date "+ lastSuccessEndDate); |
|
48 |
String trRuleId = getTransformationId(currentWfProfileId); |
|
49 |
final long lastUpdateDate = getLastTransformationRuleUpdate(trRuleId); |
|
50 |
log.info(String.format("Last update date of the transformation rule with id %s is %s", trRuleId, DateUtils.calculate_ISO8601(lastUpdateDate))); |
|
51 | 51 |
|
52 |
if (lastUpdateDate> lastSuccessEndDate) { |
|
53 |
nodeToken.getFullEnv().setAttribute("TransformationTypeInfo", "Transformation Rule has been updated, hence the transformation process will be forced to REFRESH");
|
|
52 |
if (lastUpdateDate > lastSuccessEndDate) {
|
|
53 |
nodeToken.getFullEnv().setAttribute("TransformationTypeInfo", "Transformation Rule has been updated, transformation forced to REFRESH");
|
|
54 | 54 |
nodeToken.getFullEnv().setAttribute("transformationType", "REFRESH"); |
55 | 55 |
return Arc.DEFAULT_ARC; |
56 | 56 |
} |
57 |
nodeToken.getFullEnv().setAttribute("TransformationTypeInfo", "Transformation type setted to INCREMENTAL with dateFROMFIlter "+lastSuccessEndDate);
|
|
57 |
nodeToken.getFullEnv().setAttribute("TransformationTypeInfo", "Transformation type set to INCREMENTAL with date "+DateUtils.calculate_ISO8601(lastSuccessEndDate));
|
|
58 | 58 |
nodeToken.getFullEnv().setAttribute("transformationType", "INCREMENTAL"); |
59 | 59 |
nodeToken.getFullEnv().setAttribute("DateFromFilter", lastSuccessEndDate); |
60 | 60 |
return Arc.DEFAULT_ARC; |
61 | 61 |
} |
62 | 62 |
nodeToken.getFullEnv().setAttribute("transformationType", "REFRESH"); |
63 |
nodeToken.getFullEnv().setAttribute("TransformationTypeInfo", "Transformation type setted to REFRESH");
|
|
63 |
nodeToken.getFullEnv().setAttribute("TransformationTypeInfo", "Transformation type manually set to REFRESH");
|
|
64 | 64 |
return Arc.DEFAULT_ARC; |
65 | 65 |
} |
66 | 66 |
|
Also available in: Unified diff
Fixed values of output params and logs.