src/org/ohmage/validator/CampaignValidators.java
public static Campaign.Role validateRole(final String role) 
			throws ValidationException {
		
		if(StringUtils.isEmptyOrWhitespaceOnly(role)) {
			return null;
		}
		
		try {
			return Campaign.Role.getValue(role);
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.CAMPAIGN_INVALID_ROLE, 
					"The campaign role is unknown: " + role, 
					e
				);
		}
	}
/**
	 * Validates that a campaign role is a valid campaign role.
	 * 
	 * @param role The role to be validated.
	 * 
	 * @return Returns null if the role is null or whitespace only; otherwise,
	 * 		   the role is returned.
	 * 
	 * @throws ValidationException Thrown if the role is not a valid campaign
	 * 							   role.
	 */
Validates that a campaign role is a valid campaign role.

@param role The role to be validated.

@return Returns null if the role is null or whitespace only; otherwise,
the role is returned.

@throws ValidationException Thrown if the role is not a valid campaign
role.
Validates that a campaign role is a valid campaign role . @param role The role to be validated . @return Returns null if the role is null or whitespace only ; otherwise the role is returned . @throws ValidationException Thrown if the role is not a valid campaign role .
public static Campaign.Role validateRole(final String role) 
			throws ValidationException {
		if(StringUtils.isEmptyOrWhitespaceOnly(role)) {
			return null;
		}
		try {
			return Campaign.Role.getValue(role);
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.CAMPAIGN_INVALID_ROLE, 
					"The campaign role is unknown: " + role, 
					e
				);
		}
	}
public static Campaign . Role validateRole ( final String role ) throws ValidationException { if ( StringUtils . isEmptyOrWhitespaceOnly ( role ) ) { return null ; } try { return Campaign . Role . getValue ( role ) ; } catch ( IllegalArgumentException e ) { throw new ValidationException ( ErrorCode . CAMPAIGN_INVALID_ROLE , "The campaign role is unknown: " + role , e ) ; } }
Validates that a campaign role is a valid campaign role.
Validates that a campaign role is a valid campaign role .