src/org/ohmage/domain/campaign/Campaign.java
private static List<Survey> processSurveys(
			final Nodes surveys) 
			throws DomainException {
		
		int numSurveys = surveys.size();
		List<Survey> result = new ArrayList<Survey>(numSurveys);
		
		// Create a set for all of the surveys' items' ID.
		Set<String> itemIds = new HashSet<String>();
		
		// Cycle through the nodes and create Survey objects.
		for(int i = 0; i < numSurveys; i++) {
			// Create the Survey.
			Survey survey = processSurvey(surveys.get(i));
			
			// Add the survey to the list.
			result.add(survey);
			
			// Cycle through the items and check if any duplicate item IDs
			// exist.
			for(SurveyItem surveyItem : survey.getSurveyItems().values()) {
				if(! itemIds.add(surveyItem.getId())) {
					throw
						new DomainException(
							"Multiple survey items have the same ID: " + 
								surveyItem.getId());
				}
			}
		}
		
		return result;
	}
/**
	 * Processes the survey Nodes and returns a list of Survey objects.
	 * 
	 * @param surveys A Nodes object pointing to all of the surveys.
	 * 
	 * @return A list of Survey objects for each survey in the XML.
	 * 
	 * @throws DomainException Thrown if one of the surveys is malformed.
	 */
Processes the survey Nodes and returns a list of Survey objects.

@param surveys A Nodes object pointing to all of the surveys.

@return A list of Survey objects for each survey in the XML.

@throws DomainException Thrown if one of the surveys is malformed.
Processes the survey Nodes and returns a list of Survey objects . @param surveys A Nodes object pointing to all of the surveys . @return A list of Survey objects for each survey in the XML . @throws DomainException Thrown if one of the surveys is malformed .
private static List<Survey> processSurveys(
			final Nodes surveys) 
			throws DomainException {
		int numSurveys = surveys.size();
		List<Survey> result = new ArrayList<Survey>(numSurveys);
		Set<String> itemIds = new HashSet<String>();
		for(int i = 0; i < numSurveys; i++) {
			Survey survey = processSurvey(surveys.get(i));
			result.add(survey);
			for(SurveyItem surveyItem : survey.getSurveyItems().values()) {
				if(! itemIds.add(surveyItem.getId())) {
					throw
						new DomainException(
							"Multiple survey items have the same ID: " + 
								surveyItem.getId());
				}
			}
		}
		return result;
	}
private static List < Survey > processSurveys ( final Nodes surveys ) throws DomainException { int numSurveys = surveys . size ( ) ; List < Survey > result = new ArrayList < Survey > ( numSurveys ) ; Set < String > itemIds = new HashSet < String > ( ) ; for ( int i = 0 ; i < numSurveys ; i ++ ) { Survey survey = processSurvey ( surveys . get ( i ) ) ; result . add ( survey ) ; for ( SurveyItem surveyItem : survey . getSurveyItems ( ) . values ( ) ) { if ( ! itemIds . add ( surveyItem . getId ( ) ) ) { throw new DomainException ( "Multiple survey items have the same ID: " + surveyItem . getId ( ) ) ; } } } return result ; }
Processes the survey Nodes and returns a list of Survey objects.
Processes the survey Nodes and returns a list of Survey objects .
// Create a set for all of the surveys' items' ID. // Cycle through the nodes and create Survey objects. // Create the Survey. // Add the survey to the list. // Cycle through the items and check if any duplicate item IDs // exist.