src/org/ohmage/domain/campaign/Campaign.java
private static RemoteActivityPrompt processRemoteActivity(
			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 {

		LabelValuePair packageVlp = 
				properties.get(RemoteActivityPrompt.XML_KEY_PACKAGE);
		if(packageVlp == null) {
			throw new DomainException(
					"Missing the '" + 
						RemoteActivityPrompt.XML_KEY_PACKAGE + 
						"' property: " +
						id);
		}
		String packagee = packageVlp.getLabel();
		
		LabelValuePair activityVlp = 
				properties.get(RemoteActivityPrompt.XML_KEY_ACTIVITY);
		if(activityVlp == null) {
			throw new DomainException(
					"Missing the '" + 
						RemoteActivityPrompt.XML_KEY_ACTIVITY + 
						"' property: " +
						id);
		}
		String activity = activityVlp.getLabel();
		
		LabelValuePair actionVlp = 
				properties.get(RemoteActivityPrompt.XML_KEY_ACTION);
		if(actionVlp == null) {
			throw new DomainException(
					"Missing the '" + 
						RemoteActivityPrompt.XML_KEY_ACTION + 
						"' property: " +
						id);
		}
		String action = actionVlp.getLabel();
		
		LabelValuePair autolaunchVlp = 
				properties.get(RemoteActivityPrompt.XML_KEY_AUTOLAUNCH);
		if(autolaunchVlp == null) {
			throw new DomainException(
					"Missing the '" + 
						RemoteActivityPrompt.XML_KEY_ACTION + 
						"' property: " +
						id);
		}
		Boolean autolaunch = 
				StringUtils.decodeBoolean(autolaunchVlp.getLabel());
		if(autolaunch == null) {
			throw new DomainException(
					"The property '" + 
						RemoteActivityPrompt.XML_KEY_AUTOLAUNCH + 
						"' is not a valid boolean: " +
						id);
		}
		
		int retries;
		try {
			LabelValuePair retriesVlp = 
					properties.get(RemoteActivityPrompt.XML_KEY_RETRIES);
			if(retriesVlp == null) {
				throw new DomainException(
						"Missing the '" + 
							RemoteActivityPrompt.XML_KEY_RETRIES + 
							"' property: " +
							id);	
			}
			retries = Integer.decode(retriesVlp.getLabel());
		}
		catch(NumberFormatException e) {
			throw new DomainException(
					"The '" +
						RemoteActivityPrompt.XML_KEY_RETRIES +
						"' property is not an integer: " +
						id, 
					e);
		}
		
		int minRuns;
		try {
			LabelValuePair minRunsVlp = 
					properties.get(RemoteActivityPrompt.XML_KEY_MIN_RUNS);
			if(minRunsVlp == null) {
				throw new DomainException(
						"Missing the '" + 
							RemoteActivityPrompt.XML_KEY_MIN_RUNS + 
							"' property: " +
							id);	
			}
			minRuns = Integer.decode(minRunsVlp.getLabel());
		}
		catch(NumberFormatException e) {
			throw new DomainException(
					"The '" +
						RemoteActivityPrompt.XML_KEY_MIN_RUNS +
						"' property is not an integer: " +
						id, 
					e);
		}
		
		String input = null;
		LabelValuePair inputVlp = properties.get(RemoteActivityPrompt.XML_KEY_INPUT);
		if(inputVlp != null) {
			input = inputVlp.getLabel();
		}
		
		if(defaultValue != null) {
			throw new DomainException(
					"Default values aren't allowed for remote activity prompts: " +
					id);
		}

		return new RemoteActivityPrompt(
			id,
			condition,
			unit,
			text,
			explanationText,
			skippable,
			skipLabel,
			displayLabel,
			packagee,
			activity,
			action,
			autolaunch,
			retries,
			minRuns,
			input,
			index);
	}
/**
	 * Processes a remote activity prompt and returns a RemoteActivityPrompt
	 * 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 RemoteActivityPrompt object.
	 * 
	 * @throws DomainException Thrown if the required properties are missing or
	 * 						   if any of the parameters are invalid.
	 */
Processes a remote activity prompt and returns a RemoteActivityPrompt
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 RemoteActivityPrompt object.

@throws DomainException Thrown if the required properties are missing or
if any of the parameters are invalid.
Processes a remote activity prompt and returns a RemoteActivityPrompt 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 RemoteActivityPrompt object . @throws DomainException Thrown if the required properties are missing or if any of the parameters are invalid .
private static RemoteActivityPrompt processRemoteActivity(
			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 {
		LabelValuePair packageVlp = 
				properties.get(RemoteActivityPrompt.XML_KEY_PACKAGE);
		if(packageVlp == null) {
			throw new DomainException(
					"Missing the '" + 
						RemoteActivityPrompt.XML_KEY_PACKAGE + 
						"' property: " +
						id);
		}
		String packagee = packageVlp.getLabel();
		LabelValuePair activityVlp = 
				properties.get(RemoteActivityPrompt.XML_KEY_ACTIVITY);
		if(activityVlp == null) {
			throw new DomainException(
					"Missing the '" + 
						RemoteActivityPrompt.XML_KEY_ACTIVITY + 
						"' property: " +
						id);
		}
		String activity = activityVlp.getLabel();
		LabelValuePair actionVlp = 
				properties.get(RemoteActivityPrompt.XML_KEY_ACTION);
		if(actionVlp == null) {
			throw new DomainException(
					"Missing the '" + 
						RemoteActivityPrompt.XML_KEY_ACTION + 
						"' property: " +
						id);
		}
		String action = actionVlp.getLabel();
		LabelValuePair autolaunchVlp = 
				properties.get(RemoteActivityPrompt.XML_KEY_AUTOLAUNCH);
		if(autolaunchVlp == null) {
			throw new DomainException(
					"Missing the '" + 
						RemoteActivityPrompt.XML_KEY_ACTION + 
						"' property: " +
						id);
		}
		Boolean autolaunch = 
				StringUtils.decodeBoolean(autolaunchVlp.getLabel());
		if(autolaunch == null) {
			throw new DomainException(
					"The property '" + 
						RemoteActivityPrompt.XML_KEY_AUTOLAUNCH + 
						"' is not a valid boolean: " +
						id);
		}
		int retries;
		try {
			LabelValuePair retriesVlp = 
					properties.get(RemoteActivityPrompt.XML_KEY_RETRIES);
			if(retriesVlp == null) {
				throw new DomainException(
						"Missing the '" + 
							RemoteActivityPrompt.XML_KEY_RETRIES + 
							"' property: " +
							id);	
			}
			retries = Integer.decode(retriesVlp.getLabel());
		}
		catch(NumberFormatException e) {
			throw new DomainException(
					"The '" +
						RemoteActivityPrompt.XML_KEY_RETRIES +
						"' property is not an integer: " +
						id, 
					e);
		}
		int minRuns;
		try {
			LabelValuePair minRunsVlp = 
					properties.get(RemoteActivityPrompt.XML_KEY_MIN_RUNS);
			if(minRunsVlp == null) {
				throw new DomainException(
						"Missing the '" + 
							RemoteActivityPrompt.XML_KEY_MIN_RUNS + 
							"' property: " +
							id);	
			}
			minRuns = Integer.decode(minRunsVlp.getLabel());
		}
		catch(NumberFormatException e) {
			throw new DomainException(
					"The '" +
						RemoteActivityPrompt.XML_KEY_MIN_RUNS +
						"' property is not an integer: " +
						id, 
					e);
		}
		String input = null;
		LabelValuePair inputVlp = properties.get(RemoteActivityPrompt.XML_KEY_INPUT);
		if(inputVlp != null) {
			input = inputVlp.getLabel();
		}
		if(defaultValue != null) {
			throw new DomainException(
					"Default values aren't allowed for remote activity prompts: " +
					id);
		}
		return new RemoteActivityPrompt(
			id,
			condition,
			unit,
			text,
			explanationText,
			skippable,
			skipLabel,
			displayLabel,
			packagee,
			activity,
			action,
			autolaunch,
			retries,
			minRuns,
			input,
			index);
	}
private static RemoteActivityPrompt processRemoteActivity ( 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 { LabelValuePair packageVlp = properties . get ( RemoteActivityPrompt . XML_KEY_PACKAGE ) ; if ( packageVlp == null ) { throw new DomainException ( "Missing the '" + RemoteActivityPrompt . XML_KEY_PACKAGE + "' property: " + id ) ; } String packagee = packageVlp . getLabel ( ) ; LabelValuePair activityVlp = properties . get ( RemoteActivityPrompt . XML_KEY_ACTIVITY ) ; if ( activityVlp == null ) { throw new DomainException ( "Missing the '" + RemoteActivityPrompt . XML_KEY_ACTIVITY + "' property: " + id ) ; } String activity = activityVlp . getLabel ( ) ; LabelValuePair actionVlp = properties . get ( RemoteActivityPrompt . XML_KEY_ACTION ) ; if ( actionVlp == null ) { throw new DomainException ( "Missing the '" + RemoteActivityPrompt . XML_KEY_ACTION + "' property: " + id ) ; } String action = actionVlp . getLabel ( ) ; LabelValuePair autolaunchVlp = properties . get ( RemoteActivityPrompt . XML_KEY_AUTOLAUNCH ) ; if ( autolaunchVlp == null ) { throw new DomainException ( "Missing the '" + RemoteActivityPrompt . XML_KEY_ACTION + "' property: " + id ) ; } Boolean autolaunch = StringUtils . decodeBoolean ( autolaunchVlp . getLabel ( ) ) ; if ( autolaunch == null ) { throw new DomainException ( "The property '" + RemoteActivityPrompt . XML_KEY_AUTOLAUNCH + "' is not a valid boolean: " + id ) ; } int retries ; try { LabelValuePair retriesVlp = properties . get ( RemoteActivityPrompt . XML_KEY_RETRIES ) ; if ( retriesVlp == null ) { throw new DomainException ( "Missing the '" + RemoteActivityPrompt . XML_KEY_RETRIES + "' property: " + id ) ; } retries = Integer . decode ( retriesVlp . getLabel ( ) ) ; } catch ( NumberFormatException e ) { throw new DomainException ( "The '" + RemoteActivityPrompt . XML_KEY_RETRIES + "' property is not an integer: " + id , e ) ; } int minRuns ; try { LabelValuePair minRunsVlp = properties . get ( RemoteActivityPrompt . XML_KEY_MIN_RUNS ) ; if ( minRunsVlp == null ) { throw new DomainException ( "Missing the '" + RemoteActivityPrompt . XML_KEY_MIN_RUNS + "' property: " + id ) ; } minRuns = Integer . decode ( minRunsVlp . getLabel ( ) ) ; } catch ( NumberFormatException e ) { throw new DomainException ( "The '" + RemoteActivityPrompt . XML_KEY_MIN_RUNS + "' property is not an integer: " + id , e ) ; } String input = null ; LabelValuePair inputVlp = properties . get ( RemoteActivityPrompt . XML_KEY_INPUT ) ; if ( inputVlp != null ) { input = inputVlp . getLabel ( ) ; } if ( defaultValue != null ) { throw new DomainException ( "Default values aren't allowed for remote activity prompts: " + id ) ; } return new RemoteActivityPrompt ( id , condition , unit , text , explanationText , skippable , skipLabel , displayLabel , packagee , activity , action , autolaunch , retries , minRuns , input , index ) ; }
Processes a remote activity prompt and returns a RemoteActivityPrompt
 object.
Processes a remote activity prompt and returns a RemoteActivityPrompt object .