Project

General

Profile

« Previous | Next » 

Revision 7083

Don't check for populated obsoletes and obsoletedBy fields during CN.create(), only MN.create(). The CN should expect that the MN has populated this field because of existing revision information, and should trust the MN information. Addresses https://redmine.dataone.org/issues/2507.

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
342 342
        
343 343
        // set the serial version
344 344
        sysmeta.setSerialVersion(BigInteger.ZERO);
345

  
346
        // check that we are not attempting to subvert versioning
347
        if (sysmeta.getObsoletes() != null && sysmeta.getObsoletes().getValue() != null) {
348
            throw new InvalidSystemMetadata("1180", 
349
              "The supplied system metadata is invalid. " +
350
              "The obsoletes field cannot have a value when creating entries.");
351
        }
345 352
        
353
        if (sysmeta.getObsoletedBy() != null && sysmeta.getObsoletedBy().getValue() != null) {
354
            throw new InvalidSystemMetadata("1180", 
355
              "The supplied system metadata is invalid. " +
356
              "The obsoletedBy field cannot have a value when creating entries.");
357
        }
358
        
359

  
346 360
        // call the shared impl
347 361
        return super.create(session, pid, object, sysmeta);
348 362
    }
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
345 345
    	
346 346
    }
347 347
    
348
    // check that we are not attempting to subvert versioning
349
    if (sysmeta.getObsoletes() != null && sysmeta.getObsoletes().getValue() != null) {
350
    	throw new InvalidSystemMetadata("1180", 
351
    			"The supplied system metadata is invalid. " +
352
    			"The obsoletes field cannot have a value when creating entries.");
353
    }
354
    if (sysmeta.getObsoletedBy() != null && sysmeta.getObsoletedBy().getValue() != null) {
355
    	throw new InvalidSystemMetadata("1180", 
356
    			"The supplied system metadata is invalid. " +
357
    			"The obsoletedBy field cannot have a value when creating entries.");
358
	}
359
    
360 348
    // TODO: this probably needs to be refined more
361 349
    try {
362 350
      allowed = isAuthorized(session, pid, Permission.WRITE);

Also available in: Unified diff