src/org/ohmage/domain/Document.java
public Role addCampaignRole(String campaignId, Role role) 
			throws DomainException {
		
		if(campaignId == null) {
			throw new DomainException(
					ErrorCode.CAMPAIGN_INVALID_ID,
					"The campaign ID is null.");
		}
		else if(role == null) {
			throw new DomainException(
					ErrorCode.CAMPAIGN_INVALID_ROLE,
					"The role is null.");
		}

		if(maxRole == null) {
			maxRole = role;
		}
		else if(maxRole.compare(role) == 1) {
			maxRole = role;
		}
		
		return campaignAndRole.put(campaignId, role);
	}
/**
	 * Adds the campaign if it didn't already exist and then associates a
	 * document role with that campaign. If the campaign was already associated
	 * with this document, it removes the old role and replaces it with this
	 * new one, returning the old role.
	 * 
	 * @param campaignId A unique identifier for the campaign.
	 * 
	 * @param role A new role to be associated with this campaign for this 
	 * 			   document.
	 * 
	 * @return Returns the old role if one existed; otherwise, null.
	 * 
	 * @throws DomainException Thrown if the campaign ID or role are null.
	 */
Adds the campaign if it didn't already exist and then associates a
document role with that campaign. If the campaign was already associated
with this document, it removes the old role and replaces it with this
new one, returning the old role.

@param campaignId A unique identifier for the campaign.

@param role A new role to be associated with this campaign for this
document.

@return Returns the old role if one existed; otherwise, null.

@throws DomainException Thrown if the campaign ID or role are null.
Adds the campaign if it didn ' t already exist and then associates a document role with that campaign . If the campaign was already associated with this document it removes the old role and replaces it with this new one returning the old role . @param campaignId A unique identifier for the campaign . @param role A new role to be associated with this campaign for this document . @return Returns the old role if one existed ; otherwise null . @throws DomainException Thrown if the campaign ID or role are null .
public Role addCampaignRole(String campaignId, Role role) 
			throws DomainException {
		if(campaignId == null) {
			throw new DomainException(
					ErrorCode.CAMPAIGN_INVALID_ID,
					"The campaign ID is null.");
		}
		else if(role == null) {
			throw new DomainException(
					ErrorCode.CAMPAIGN_INVALID_ROLE,
					"The role is null.");
		}
		if(maxRole == null) {
			maxRole = role;
		}
		else if(maxRole.compare(role) == 1) {
			maxRole = role;
		}
		return campaignAndRole.put(campaignId, role);
	}
public Role addCampaignRole ( String campaignId , Role role ) throws DomainException { if ( campaignId == null ) { throw new DomainException ( ErrorCode . CAMPAIGN_INVALID_ID , "The campaign ID is null." ) ; } else if ( role == null ) { throw new DomainException ( ErrorCode . CAMPAIGN_INVALID_ROLE , "The role is null." ) ; } if ( maxRole == null ) { maxRole = role ; } else if ( maxRole . compare ( role ) == 1 ) { maxRole = role ; } return campaignAndRole . put ( campaignId , role ) ; }
Adds the campaign if it didn't already exist and then associates a
 document role with that campaign.
Adds the campaign if it didn ' t already exist and then associates a document role with that campaign .