src/org/ohmage/domain/campaign/Campaign.java
private static MultiChoiceCustomPrompt processMultiChoiceCustom(
			final String id,
			final String condition, 
			final String unit, 
			final String text,
			final String explanationText, 
			final boolean skippable, 
			final String skipLabel,
			final String displayLabel,
			final String defaultValue,
			final Map<String, LabelValuePair> properties, 
			final int index) 
			throws DomainException {
		
		Map<Integer, LabelValuePair> choices = 
			new HashMap<Integer, LabelValuePair>(properties.size());
		
		for(String key : properties.keySet()) {
			Integer keyInt;
			try {
				keyInt = Integer.decode(key);
				
				if(keyInt < 0) {
					throw new DomainException(
							"The key value cannot be negative: " +
								id);
				}
			}
			catch(NumberFormatException e) {
				throw new DomainException(
						"The key is not a valid integer: " +
							id, 
						e);
			}
			
			choices.put(keyInt, properties.get(key));
		}
		
		List<Integer> defaultValues = null;
		if((defaultValue != null) && (! "".equals(defaultValue))) {
			String[] values = defaultValue.split(InputKeys.LIST_ITEM_SEPARATOR);
			
			defaultValues = new ArrayList<Integer>(values.length);
			Integer defaultKey;
			
			for(int i = 0; i < values.length; i++) {
				String currValue = values[i];
				
				if(! "".equals(currValue)) {
					try {
						defaultKey = Integer.decode(currValue);
						defaultValues.add(defaultKey);
						if(defaultKey < 0) {
						    throw new DomainException("The default key value cannot be negative: " + id);
						}
					}
					catch(NumberFormatException e) {
						throw new DomainException(
							"One of the default values was not an integer.");
					}
				}
			}
		}

		return new MultiChoiceCustomPrompt(
			id,
			condition,
			unit,
			text,
			explanationText,
			skippable,
			skipLabel,
			displayLabel,
			choices,
			new HashMap<Integer, LabelValuePair>(),
			defaultValues,
			index);
	}
/**
	 * Processes a multi-choice custom prompt and returns a 
	 * MultiChoiceCustomPrompt object.
	 * 
	 * @param id The prompt's unique identifier.
	 * 
	 * @param condition The condition value.
	 * 
	 * @param unit The prompt's visualization unit.
	 * 
	 * @param text The prompt's text value.
	 * 
	 * @param explanationText The prompt's explanation text value.
	 * 
	 * @param skippable Whether or not this prompt is skippable.
	 * 
	 * @param skipLabel The label to show to skip this prompt.
	 * 
	 * @param displayLabel The label for this display type.
	 * 
	 * @param defaultValue The default value given in the XML.
	 * 
	 * @param properties The properties defined in the XML for this prompt.
	 * 
	 * @param index The index of this prompt in its collection of survey items.
	 * 
	 * @return A MultiChoiceCustomPrompt object.
	 * 
	 * @throws DomainException Thrown if the required properties are missing or 
	 * 						   if any of the parameters are invalid.
	 */
Processes a multi-choice custom prompt and returns a
MultiChoiceCustomPrompt object.

@param id The prompt's unique identifier.

@param condition The condition value.

@param unit The prompt's visualization unit.

@param text The prompt's text value.

@param explanationText The prompt's explanation text value.

@param skippable Whether or not this prompt is skippable.

@param skipLabel The label to show to skip this prompt.

@param displayLabel The label for this display type.

@param defaultValue The default value given in the XML.

@param properties The properties defined in the XML for this prompt.

@param index The index of this prompt in its collection of survey items.

@return A MultiChoiceCustomPrompt object.

@throws DomainException Thrown if the required properties are missing or
if any of the parameters are invalid.
Processes a multi - choice custom prompt and returns a MultiChoiceCustomPrompt object . @param id The prompt ' s unique identifier . @param condition The condition value . @param unit The prompt ' s visualization unit . @param text The prompt ' s text value . @param explanationText The prompt ' s explanation text value . @param skippable Whether or not this prompt is skippable . @param skipLabel The label to show to skip this prompt . @param displayLabel The label for this display type . @param defaultValue The default value given in the XML . @param properties The properties defined in the XML for this prompt . @param index The index of this prompt in its collection of survey items . @return A MultiChoiceCustomPrompt object . @throws DomainException Thrown if the required properties are missing or if any of the parameters are invalid .
private static MultiChoiceCustomPrompt processMultiChoiceCustom(
			final String id,
			final String condition, 
			final String unit, 
			final String text,
			final String explanationText, 
			final boolean skippable, 
			final String skipLabel,
			final String displayLabel,
			final String defaultValue,
			final Map<String, LabelValuePair> properties, 
			final int index) 
			throws DomainException {
		Map<Integer, LabelValuePair> choices = 
			new HashMap<Integer, LabelValuePair>(properties.size());
		for(String key : properties.keySet()) {
			Integer keyInt;
			try {
				keyInt = Integer.decode(key);
				if(keyInt < 0) {
					throw new DomainException(
							"The key value cannot be negative: " +
								id);
				}
			}
			catch(NumberFormatException e) {
				throw new DomainException(
						"The key is not a valid integer: " +
							id, 
						e);
			}
			choices.put(keyInt, properties.get(key));
		}
		List<Integer> defaultValues = null;
		if((defaultValue != null) && (! "".equals(defaultValue))) {
			String[] values = defaultValue.split(InputKeys.LIST_ITEM_SEPARATOR);
			defaultValues = new ArrayList<Integer>(values.length);
			Integer defaultKey;
			for(int i = 0; i < values.length; i++) {
				String currValue = values[i];
				if(! "".equals(currValue)) {
					try {
						defaultKey = Integer.decode(currValue);
						defaultValues.add(defaultKey);
						if(defaultKey < 0) {
						    throw new DomainException("The default key value cannot be negative: " + id);
						}
					}
					catch(NumberFormatException e) {
						throw new DomainException(
							"One of the default values was not an integer.");
					}
				}
			}
		}
		return new MultiChoiceCustomPrompt(
			id,
			condition,
			unit,
			text,
			explanationText,
			skippable,
			skipLabel,
			displayLabel,
			choices,
			new HashMap<Integer, LabelValuePair>(),
			defaultValues,
			index);
	}
private static MultiChoiceCustomPrompt processMultiChoiceCustom ( final String id , final String condition , final String unit , final String text , final String explanationText , final boolean skippable , final String skipLabel , final String displayLabel , final String defaultValue , final Map < String , LabelValuePair > properties , final int index ) throws DomainException { Map < Integer , LabelValuePair > choices = new HashMap < Integer , LabelValuePair > ( properties . size ( ) ) ; for ( String key : properties . keySet ( ) ) { Integer keyInt ; try { keyInt = Integer . decode ( key ) ; if ( keyInt < 0 ) { throw new DomainException ( "The key value cannot be negative: " + id ) ; } } catch ( NumberFormatException e ) { throw new DomainException ( "The key is not a valid integer: " + id , e ) ; } choices . put ( keyInt , properties . get ( key ) ) ; } List < Integer > defaultValues = null ; if ( ( defaultValue != null ) && ( ! "" . equals ( defaultValue ) ) ) { String [ ] values = defaultValue . split ( InputKeys . LIST_ITEM_SEPARATOR ) ; defaultValues = new ArrayList < Integer > ( values . length ) ; Integer defaultKey ; for ( int i = 0 ; i < values . length ; i ++ ) { String currValue = values [ i ] ; if ( ! "" . equals ( currValue ) ) { try { defaultKey = Integer . decode ( currValue ) ; defaultValues . add ( defaultKey ) ; if ( defaultKey < 0 ) { throw new DomainException ( "The default key value cannot be negative: " + id ) ; } } catch ( NumberFormatException e ) { throw new DomainException ( "One of the default values was not an integer." ) ; } } } } return new MultiChoiceCustomPrompt ( id , condition , unit , text , explanationText , skippable , skipLabel , displayLabel , choices , new HashMap < Integer , LabelValuePair > ( ) , defaultValues , index ) ; }
Processes a multi-choice custom prompt and returns a
 MultiChoiceCustomPrompt object.
Processes a multi - choice custom prompt and returns a MultiChoiceCustomPrompt object .