Project

General

Profile

« Previous | Next » 

Revision 53486

added a condition to reduce the number of updates

View differences:

modules/dnet-openaireplus-workflows/trunk/src/main/java/eu/dnetlib/msro/openaireplus/workflows/nodes/consistency/FixRepoMdstoreSizesJobNode.java
62 62
	private ISRegistryService registry;
63 63
	private ISLookUpService lookup;
64 64

  
65
	private boolean alwaysUpdate = false;
66

  
65 67
	public void init(final int total) {
66 68
		this.current = 0;
67 69
		this.total = total;
......
96 98
			final String mdId = doc.valueOf("//RESOURCE_IDENTIFIER/@value");
97 99
			final int actualSize = NumberUtils.toInt(doc.valueOf("//NUMBER_OF_RECORDS"), 0);
98 100
			final int size = mdstoreDao.getMDStore(mdId).getSize();
99
			if (size != actualSize) {
101
			if (alwaysUpdate || size != actualSize) {
100 102
				updateMdStoreProfile(mdId, doc, size);
101 103
				dsManager.setLastCollectionInfo(dsId, api.getId(), mdId, size, calculateLastDate(doc));
102 104
			}
......
106 108
			final String mdId = doc.valueOf("//RESOURCE_IDENTIFIER/@value");
107 109
			final int actualSize = NumberUtils.toInt(doc.valueOf("//NUMBER_OF_RECORDS"), 0);
108 110
			final int size = mdstoreDao.getMDStore(mdId).getSize();
109
			if (size != actualSize) {
111
			if (alwaysUpdate || size != actualSize) {
110 112
				updateMdStoreProfile(mdId, doc, size);
111 113
				dsManager.setLastAggregationInfo(dsId, api.getId(), mdId, size, calculateLastDate(doc));
112 114
			}
......
116 118
			final String objId = doc.valueOf("//RESOURCE_IDENTIFIER/@value");
117 119
			final int actualSize = NumberUtils.toInt(doc.valueOf("//STORE_SIZE"), 0);
118 120
			final int size = objectStoreDao.getObjectStore(objId).getSize();
119
			if (size != actualSize) {
121
			if (alwaysUpdate || size != actualSize) {
120 122
				updateObjStoreProfile(objId, doc, size);
121 123
				dsManager.setLastDownloadInfo(dsId, api.getId(), objId, size, calculateLastDate(doc));
122 124
			}
......
187 189
		return false;
188 190
	}
189 191

  
192
	public boolean isAlwaysUpdate() {
193
		return alwaysUpdate;
194
	}
195

  
196
	public void setAlwaysUpdate(final boolean alwaysUpdate) {
197
		this.alwaysUpdate = alwaysUpdate;
198
	}
199

  
190 200
}
modules/dnet-openaireplus-workflows/trunk/src/main/resources/eu/dnetlib/test/profiles/openaireplus/workflows/consistency/reposStoresConsistency.xml
13 13
		<CONFIGURATION start="manual">
14 14
			<NODE name="fixReposAndStores" type="FixRepoMdstoreSizes" isStart="true">
15 15
				<DESCRIPTION>Fix repos-stores sizes</DESCRIPTION>
16
				<PARAMETERS/>
16
				<PARAMETERS>
17
					<PARAM name="alwaysUpdate"  managedBy="user" required="true" type="boolean">false</PARAM>
18
				</PARAMETERS>
17 19
				<ARCS>
18 20
					<ARC to="success"/>
19 21
				</ARCS>

Also available in: Unified diff