src/org/ohmage/domain/campaign/Campaign.java
private static SingleChoicePrompt processSingleChoice(
			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));
		}
		
		Integer defaultKey = null;
		if(defaultValue != null) {
			try {
				defaultKey = Integer.decode(defaultValue);
				
				if(defaultKey < 0) {
					throw new DomainException("The default key value cannot be negative: " + id);
				}
			}
			catch(NumberFormatException e) {
				throw new DomainException("The default key is not an integer.");
			}
		}

		return new SingleChoicePrompt(
			id,
			condition,
			unit,
			text,
			explanationText,
			skippable,
			skipLabel,
			displayLabel,
			choices,
			defaultKey,
			index);
	}
/**
	 * Processes a single choice prompt and returns a SingleChoicePrompt
	 * 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 SingleChoicePrompt object.
	 * 
	 * @throws DomainException Thrown if the required properties are missing or
	 * 						   if any of the parameters are invalid.
	 */
Processes a single choice prompt and returns a SingleChoicePrompt
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 SingleChoicePrompt object.

@throws DomainException Thrown if the required properties are missing or
if any of the parameters are invalid.
Processes a single choice prompt and returns a SingleChoicePrompt 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 SingleChoicePrompt object . @throws DomainException Thrown if the required properties are missing or if any of the parameters are invalid .
private static SingleChoicePrompt processSingleChoice(
			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));
		}
		Integer defaultKey = null;
		if(defaultValue != null) {
			try {
				defaultKey = Integer.decode(defaultValue);
				if(defaultKey < 0) {
					throw new DomainException("The default key value cannot be negative: " + id);
				}
			}
			catch(NumberFormatException e) {
				throw new DomainException("The default key is not an integer.");
			}
		}
		return new SingleChoicePrompt(
			id,
			condition,
			unit,
			text,
			explanationText,
			skippable,
			skipLabel,
			displayLabel,
			choices,
			defaultKey,
			index);
	}
private static SingleChoicePrompt processSingleChoice ( 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 ) ) ; } Integer defaultKey = null ; if ( defaultValue != null ) { try { defaultKey = Integer . decode ( defaultValue ) ; if ( defaultKey < 0 ) { throw new DomainException ( "The default key value cannot be negative: " + id ) ; } } catch ( NumberFormatException e ) { throw new DomainException ( "The default key is not an integer." ) ; } } return new SingleChoicePrompt ( id , condition , unit , text , explanationText , skippable , skipLabel , displayLabel , choices , defaultKey , index ) ; }
Processes a single choice prompt and returns a SingleChoicePrompt
 object.
Processes a single choice prompt and returns a SingleChoicePrompt object .