Project

General

Profile

« Previous | Next » 

Revision 53485

added a condition to reduce the number of updates

View differences:

FixRepoMdstoreSizesJobNode.java
12 12

  
13 13
import org.antlr.stringtemplate.StringTemplate;
14 14
import org.apache.commons.io.IOUtils;
15
import org.apache.commons.lang.math.NumberUtils;
15 16
import org.apache.commons.lang3.StringUtils;
16 17
import org.dom4j.Document;
17 18
import org.dom4j.DocumentException;
......
93 94

  
94 95
		for (final Document doc : listCollectionMdStores(dsId, api.getId())) {
95 96
			final String mdId = doc.valueOf("//RESOURCE_IDENTIFIER/@value");
97
			final int actualSize = NumberUtils.toInt(doc.valueOf("//NUMBER_OF_RECORDS"), 0);
96 98
			final int size = mdstoreDao.getMDStore(mdId).getSize();
97
			updateMdStoreProfile(mdId, doc, size);
98
			dsManager.setLastCollectionInfo(dsId, api.getId(), mdId, size, calculateLastDate(doc));
99
			if (size != actualSize) {
100
				updateMdStoreProfile(mdId, doc, size);
101
				dsManager.setLastCollectionInfo(dsId, api.getId(), mdId, size, calculateLastDate(doc));
102
			}
99 103
		}
100 104

  
101 105
		for (final Document doc : listTransformationMdStores(dsId, api.getId())) {
102 106
			final String mdId = doc.valueOf("//RESOURCE_IDENTIFIER/@value");
107
			final int actualSize = NumberUtils.toInt(doc.valueOf("//NUMBER_OF_RECORDS"), 0);
103 108
			final int size = mdstoreDao.getMDStore(mdId).getSize();
104
			updateMdStoreProfile(mdId, doc, size);
105
			dsManager.setLastAggregationInfo(dsId, api.getId(), mdId, size, calculateLastDate(doc));
109
			if (size != actualSize) {
110
				updateMdStoreProfile(mdId, doc, size);
111
				dsManager.setLastAggregationInfo(dsId, api.getId(), mdId, size, calculateLastDate(doc));
112
			}
106 113
		}
107 114

  
108 115
		for (final Document doc : listDownloadObjectStores(dsId, api.getId())) {
109 116
			final String objId = doc.valueOf("//RESOURCE_IDENTIFIER/@value");
117
			final int actualSize = NumberUtils.toInt(doc.valueOf("//STORE_SIZE"), 0);
110 118
			final int size = objectStoreDao.getObjectStore(objId).getSize();
111
			updateObjStoreProfile(objId, doc, size);
112
			dsManager.setLastDownloadInfo(dsId, api.getId(), objId, size, calculateLastDate(doc));
119
			if (size != actualSize) {
120
				updateObjStoreProfile(objId, doc, size);
121
				dsManager.setLastDownloadInfo(dsId, api.getId(), objId, size, calculateLastDate(doc));
122
			}
113 123
		}
114 124
	}
115 125

  

Also available in: Unified diff