src/org/ohmage/validator/CampaignValidators.java
public static String validateCampaignId(final String campaignId) 
			throws ValidationException {
		
		// If the value is null or whitespace only, return null.
		if(StringUtils.isEmptyOrWhitespaceOnly(campaignId)) {
			return null;
		}
		
		// If the value is a valid URN, meaning that it is a plausible campaign 
		// ID, return the campaign ID back to the caller.
		if(StringUtils.isValidUrn(campaignId.trim())) {
			return campaignId.trim();
		}
		// If the campaign ID is not null, not whitespace only, and not a valid
		// URN, set the request as failed and throw a ValidationException to
		// warn the caller.
		else {
			throw new ValidationException(
					ErrorCode.CAMPAIGN_INVALID_ID, 
					"The campaign identifier is invalid: " + campaignId);
		}
	}
/**
	 * Validates that a campaign ID is a valid campaign identifier even if the
	 * campaign may not exist.
	 * 
	 * @param request The request that is performing this validation.
	 * 
	 * @param campaignId The campaign identifier being validated.
	 * 
	 * @return If the campaign ID is null or whitespace, null is returned.
	 * 		   Otherwise, the campaign ID is returned.
	 * 
	 * @throws ValidationException Thrown if the campaign ID is not null, not
	 * 							   whitespace only, and not a valid campaign
	 * 							   identifier.
	 */
Validates that a campaign ID is a valid campaign identifier even if the
campaign may not exist.

@param request The request that is performing this validation.

@param campaignId The campaign identifier being validated.

@return If the campaign ID is null or whitespace, null is returned.
Otherwise, the campaign ID is returned.

@throws ValidationException Thrown if the campaign ID is not null, not
whitespace only, and not a valid campaign
identifier.
Validates that a campaign ID is a valid campaign identifier even if the campaign may not exist . @param request The request that is performing this validation . @param campaignId The campaign identifier being validated . @return If the campaign ID is null or whitespace null is returned . Otherwise the campaign ID is returned . @throws ValidationException Thrown if the campaign ID is not null not whitespace only and not a valid campaign identifier .
public static String validateCampaignId(final String campaignId) 
			throws ValidationException {
		if(StringUtils.isEmptyOrWhitespaceOnly(campaignId)) {
			return null;
		}
		if(StringUtils.isValidUrn(campaignId.trim())) {
			return campaignId.trim();
		}
		else {
			throw new ValidationException(
					ErrorCode.CAMPAIGN_INVALID_ID, 
					"The campaign identifier is invalid: " + campaignId);
		}
	}
public static String validateCampaignId ( final String campaignId ) throws ValidationException { if ( StringUtils . isEmptyOrWhitespaceOnly ( campaignId ) ) { return null ; } if ( StringUtils . isValidUrn ( campaignId . trim ( ) ) ) { return campaignId . trim ( ) ; } else { throw new ValidationException ( ErrorCode . CAMPAIGN_INVALID_ID , "The campaign identifier is invalid: " + campaignId ) ; } }
Validates that a campaign ID is a valid campaign identifier even if the
 campaign may not exist.
Validates that a campaign ID is a valid campaign identifier even if the campaign may not exist .
// If the value is null or whitespace only, return null. // If the value is a valid URN, meaning that it is a plausible campaign  // ID, return the campaign ID back to the caller. // If the campaign ID is not null, not whitespace only, and not a valid // URN, set the request as failed and throw a ValidationException to // warn the caller.