Project

General

Profile

« Previous | Next » 

Revision 6725

set/update the obsoletes/obsoletedBy fields in system metadata so that we always have a complete revision history for each object.
Note: ORE maps do not have revision history...yet(?)

View differences:

src/edu/ucsb/nceas/metacat/dataone/SystemMetadataFactory.java
263 263
				break;
264 264
			}
265 265
		}
266
		// set them
266
		// set them on our object
267 267
		sysMeta.setObsoletedBy(obsoletedBy);
268 268
		sysMeta.setObsoletes(obsoletes);
269 269
		
270
		// update the system metadata for the object[s] we are revising
271
		if (obsoletedBy != null) {
272
			SystemMetadata obsoletedBySysMeta = HazelcastService.getInstance().getSystemMetadataMap().get(obsoletedBy);
273
			if (obsoletedBySysMeta != null) {
274
				obsoletedBySysMeta.setObsoletes(identifier);
275
				HazelcastService.getInstance().getSystemMetadataMap().put(obsoletedBy, obsoletedBySysMeta);
276
			}
277
		}
278
		if (obsoletes != null) {
279
			SystemMetadata obsoletesSysMeta = HazelcastService.getInstance().getSystemMetadataMap().get(obsoletes);
280
			if (obsoletesSysMeta != null) {
281
				obsoletesSysMeta.setObsoletedBy(identifier);
282
				HazelcastService.getInstance().getSystemMetadataMap().put(obsoletes, obsoletesSysMeta);
283
			}
284
		}
285
		
270 286
		// look up the access control policy we have in metacat already to make sure it is in the SM
271 287
		AccessPolicy accessPolicy = IdentifierManager.getInstance().getAccessPolicyByLocalId(docidWithoutRev);
272 288
		sysMeta.setAccessPolicy(accessPolicy);
......
442 458
			            ObjectFormatIdentifier formatId = ObjectFormatCache.getInstance().getFormat("http://www.openarchives.org/ore/terms").getFormatId();
443 459
						resourceMapSysMeta.setFormatId(formatId);
444 460
			            // TODO: other fields to update?
461
						resourceMapSysMeta.setObsoletes(null);
462
						resourceMapSysMeta.setObsoletedBy(null);
445 463
			            
446 464
						// save it locally
447 465
						Session session = new Session();

Also available in: Unified diff