src/org/ohmage/service/UserCampaignServices.java
public void verifyUsersExistInCampaign(final String campaignId, 
			final Collection<String> usernameList) throws ServiceException {
		
		// check for logical errors
		if(StringUtils.isEmptyOrWhitespaceOnly(campaignId) || usernameList == null) {
			throw new IllegalArgumentException("null request, empty campaignId, or null usernameList");
		}
		
		// check each username in usernameList
		try {
			for(String username : usernameList) {
				if(! userCampaignQueries.userBelongsToCampaign(username, campaignId)) {
					StringBuilder sb = new StringBuilder();
					sb.append("User in usernameList does not belong to campaign. Username: ");
					sb.append(username);
					sb.append(" Campaign ID: ");
					sb.append(campaignId);
					String msg = sb.toString();
					throw new ServiceException(ErrorCode.USER_NOT_IN_CAMPAIGN, msg);
				}
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
/**
	 * Verifies that each username in usernameList belongs to the campaign
	 * specified by the campaignId.
	 * 
	 * @param campaignId  The campaign to check each user against.
	 * @param usernameList  The users in question
	 * @throws ServiceException  If any user in usernameList does not belong
	 * to the campaign or if an IO problem occurs.
	 * @throws IllegalArgumentException if the request is null; if the 
	 * campaignId is empty or null; or if the usernameList is null.
	 */
Verifies that each username in usernameList belongs to the campaign
specified by the campaignId.

@param campaignId  The campaign to check each user against.
@param usernameList  The users in question
@throws ServiceException  If any user in usernameList does not belong
to the campaign or if an IO problem occurs.
@throws IllegalArgumentException if the request is null; if the
campaignId is empty or null; or if the usernameList is null.
Verifies that each username in usernameList belongs to the campaign specified by the campaignId . @param campaignId The campaign to check each user against . @param usernameList The users in question @throws ServiceException If any user in usernameList does not belong to the campaign or if an IO problem occurs . @throws IllegalArgumentException if the request is null ; if the campaignId is empty or null ; or if the usernameList is null .
public void verifyUsersExistInCampaign(final String campaignId, 
			final Collection<String> usernameList) throws ServiceException {
		if(StringUtils.isEmptyOrWhitespaceOnly(campaignId) || usernameList == null) {
			throw new IllegalArgumentException("null request, empty campaignId, or null usernameList");
		}
		try {
			for(String username : usernameList) {
				if(! userCampaignQueries.userBelongsToCampaign(username, campaignId)) {
					StringBuilder sb = new StringBuilder();
					sb.append("User in usernameList does not belong to campaign. Username: ");
					sb.append(username);
					sb.append(" Campaign ID: ");
					sb.append(campaignId);
					String msg = sb.toString();
					throw new ServiceException(ErrorCode.USER_NOT_IN_CAMPAIGN, msg);
				}
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
public void verifyUsersExistInCampaign ( final String campaignId , final Collection < String > usernameList ) throws ServiceException { if ( StringUtils . isEmptyOrWhitespaceOnly ( campaignId ) || usernameList == null ) { throw new IllegalArgumentException ( "null request, empty campaignId, or null usernameList" ) ; } try { for ( String username : usernameList ) { if ( ! userCampaignQueries . userBelongsToCampaign ( username , campaignId ) ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "User in usernameList does not belong to campaign. Username: " ) ; sb . append ( username ) ; sb . append ( " Campaign ID: " ) ; sb . append ( campaignId ) ; String msg = sb . toString ( ) ; throw new ServiceException ( ErrorCode . USER_NOT_IN_CAMPAIGN , msg ) ; } } } catch ( DataAccessException e ) { throw new ServiceException ( e ) ; } }
Verifies that each username in usernameList belongs to the campaign
 specified by the campaignId.
Verifies that each username in usernameList belongs to the campaign specified by the campaignId .
// check for logical errors // check each username in usernameList