src/org/ohmage/validator/DocumentValidators.java
public static Document.Role validateRole(final String role) 
			throws ValidationException {
		
		if(StringUtils.isEmptyOrWhitespaceOnly(role)) {
			return null;
		}
		
		try {
			return Document.Role.getValue(role);
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.DOCUMENT_INVALID_ROLE, 
					"Invalid document role: " + role,
					e);
		}
	}
/**
	 * Validates that a document role is known.
	 * 
	 * @param role The document role to validate.
	 * 
	 * @return If the role is null or whitespace only, null is returned. 
	 * 		   Otherwise, the role is returned.
	 * 
	 * @throws ValidationException Thrown if the role is no null nor whitespace
	 * 							   only and is an unknown role.
	 */
Validates that a document role is known.

@param role The document role to validate.

@return If the role is null or whitespace only, null is returned.
Otherwise, the role is returned.

@throws ValidationException Thrown if the role is no null nor whitespace
only and is an unknown role.
Validates that a document role is known . @param role The document role to validate . @return If the role is null or whitespace only null is returned . Otherwise the role is returned . @throws ValidationException Thrown if the role is no null nor whitespace only and is an unknown role .
public static Document.Role validateRole(final String role) 
			throws ValidationException {
		if(StringUtils.isEmptyOrWhitespaceOnly(role)) {
			return null;
		}
		try {
			return Document.Role.getValue(role);
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.DOCUMENT_INVALID_ROLE, 
					"Invalid document role: " + role,
					e);
		}
	}
public static Document . Role validateRole ( final String role ) throws ValidationException { if ( StringUtils . isEmptyOrWhitespaceOnly ( role ) ) { return null ; } try { return Document . Role . getValue ( role ) ; } catch ( IllegalArgumentException e ) { throw new ValidationException ( ErrorCode . DOCUMENT_INVALID_ROLE , "Invalid document role: " + role , e ) ; } }
Validates that a document role is known.
Validates that a document role is known .