src/org/ohmage/service/UserCampaignDocumentServices.java
public void userCanAssociateDocumentsWithCampaign(
			final String username, final String campaignId) 
			throws ServiceException {
		
		try {
			List<Campaign.Role> roles = userCampaignQueries.getUserCampaignRoles(username, campaignId);
			
			if(roles.size() == 0) {
				throw new ServiceException(ErrorCode.DOCUMENT_INSUFFICIENT_PERMISSIONS, "The user is not a member of the following campaign and, therefore, cannot associate documents with it: " + campaignId);
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
/**
	 * Verifies that a user can associate documents with a campaign. The only 
	 * restriction is that the user must belong to the campaign in some 
	 * capacity.
	 * 
	 * @param username The username of the user in question.
	 * 
	 * @param campaignId The campaign ID of the campaign in question.
	 * 
	 * @throws ServiceException Thrown if there is an error or if the user is
	 * 							not allowed to associate documents with this
	 * 							campaign.
	 */
Verifies that a user can associate documents with a campaign. The only
restriction is that the user must belong to the campaign in some
capacity.

@param username The username of the user in question.

@param campaignId The campaign ID of the campaign in question.

@throws ServiceException Thrown if there is an error or if the user is
not allowed to associate documents with this
campaign.
Verifies that a user can associate documents with a campaign . The only restriction is that the user must belong to the campaign in some capacity . @param username The username of the user in question . @param campaignId The campaign ID of the campaign in question . @throws ServiceException Thrown if there is an error or if the user is not allowed to associate documents with this campaign .
public void userCanAssociateDocumentsWithCampaign(
			final String username, final String campaignId) 
			throws ServiceException {
		try {
			List<Campaign.Role> roles = userCampaignQueries.getUserCampaignRoles(username, campaignId);
			if(roles.size() == 0) {
				throw new ServiceException(ErrorCode.DOCUMENT_INSUFFICIENT_PERMISSIONS, "The user is not a member of the following campaign and, therefore, cannot associate documents with it: " + campaignId);
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
public void userCanAssociateDocumentsWithCampaign ( final String username , final String campaignId ) throws ServiceException { try { List < Campaign . Role > roles = userCampaignQueries . getUserCampaignRoles ( username , campaignId ) ; if ( roles . size ( ) == 0 ) { throw new ServiceException ( ErrorCode . DOCUMENT_INSUFFICIENT_PERMISSIONS , "The user is not a member of the following campaign and, therefore, cannot associate documents with it: " + campaignId ) ; } } catch ( DataAccessException e ) { throw new ServiceException ( e ) ; } }
Verifies that a user can associate documents with a campaign.
Verifies that a user can associate documents with a campaign .