Project

General

Profile

« Previous | Next » 

Revision 6216

implement getChecksum (retrieves from system metadata)

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
222 222
	}
223 223
	
224 224
	/**
225
	 * Return a checksum of the object given the object identifier and the name
226
	 * of the checksum algorithm (the default being SHA-1)
225
	 * Return a checksum of the object given the object identifier 
227 226
	 * 
228 227
	 * @param session - the Session object containing the credentials for the Subject
229 228
	 * @param pid - the object identifier for the given object
......
242 241
	  throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, 
243 242
	  InvalidRequest, NotImplemented {
244 243
		
245
		return null;
244
		if (!isAuthorized(session, pid, Permission.READ)) {
245
			throw new NotAuthorized("1400", Permission.READ + " not allowed on " + pid.getValue());	
246
		}
247
		SystemMetadata systemMetadata = null;
248
		try {
249
			systemMetadata = IdentifierManager.getInstance().getSystemMetadata(pid.getValue());
250
		} catch (McdbDocNotFoundException e) {
251
			throw new NotFound("1420", "No record found for: " + pid.getValue());
252
		}
253
		Checksum checksum = systemMetadata.getChecksum();
254
		
255
		return checksum;
246 256
	}
247 257

  
248 258
	/**

Also available in: Unified diff