src/org/ohmage/domain/UserInformation.java
public void addCampaign(
			final String campaignId, 
			final Set<Campaign.Role> roles) 
			throws DomainException {
		
		if(campaignId == null) {
			throw new DomainException("The campaign ID is null.");
		}
		
		if(roles == null) {
			throw new DomainException("The list of roles is null.");
		}
		else if(roles.size() == 0) {
			throw new DomainException("The list of roles is empty.");
		}
		
		if(campaigns == null) {
			campaigns = new HashMap<String, Set<Campaign.Role>>();
		}
		
		Set<Campaign.Role> oldRoles = campaigns.get(campaignId);
		
		if(oldRoles == null) {
			campaigns.put(campaignId, roles);
		}
		else {
			oldRoles.addAll(roles);
		}
	}
/**
	 * Adds a campaign, if it doesn't already exist, and a set of roles for the
	 * user.
	 * 
	 * @param campaignId The campaign's unique identifier.
	 * 
	 * @param roles The user's roles in that campaign. This cannot be empty.
	 * 
	 * @throws DomainException The campaign ID or list of roles was null or the
	 * 						   list of roles was empty.
	 */
Adds a campaign, if it doesn't already exist, and a set of roles for the
user.

@param campaignId The campaign's unique identifier.

@param roles The user's roles in that campaign. This cannot be empty.

@throws DomainException The campaign ID or list of roles was null or the
list of roles was empty.
Adds a campaign if it doesn ' t already exist and a set of roles for the user . @param campaignId The campaign ' s unique identifier . @param roles The user ' s roles in that campaign . This cannot be empty . @throws DomainException The campaign ID or list of roles was null or the list of roles was empty .
public void addCampaign(
			final String campaignId, 
			final Set<Campaign.Role> roles) 
			throws DomainException {
		if(campaignId == null) {
			throw new DomainException("The campaign ID is null.");
		}
		if(roles == null) {
			throw new DomainException("The list of roles is null.");
		}
		else if(roles.size() == 0) {
			throw new DomainException("The list of roles is empty.");
		}
		if(campaigns == null) {
			campaigns = new HashMap<String, Set<Campaign.Role>>();
		}
		Set<Campaign.Role> oldRoles = campaigns.get(campaignId);
		if(oldRoles == null) {
			campaigns.put(campaignId, roles);
		}
		else {
			oldRoles.addAll(roles);
		}
	}
public void addCampaign ( final String campaignId , final Set < Campaign . Role > roles ) throws DomainException { if ( campaignId == null ) { throw new DomainException ( "The campaign ID is null." ) ; } if ( roles == null ) { throw new DomainException ( "The list of roles is null." ) ; } else if ( roles . size ( ) == 0 ) { throw new DomainException ( "The list of roles is empty." ) ; } if ( campaigns == null ) { campaigns = new HashMap < String , Set < Campaign . Role > > ( ) ; } Set < Campaign . Role > oldRoles = campaigns . get ( campaignId ) ; if ( oldRoles == null ) { campaigns . put ( campaignId , roles ) ; } else { oldRoles . addAll ( roles ) ; } }
Adds a campaign, if it doesn't already exist, and a set of roles for the
 user.
Adds a campaign if it doesn ' t already exist and a set of roles for the user .