src/org/ohmage/domain/campaign/SurveyResponse.java
private RepeatableSetResponse processRepeatableSet(
			final RepeatableSet repeatableSet, 
			final JSONObject response,
			final Set<String> allowedPromptIds) 
			throws DomainException {
		
		try {
			if(response.getBoolean(RepeatableSetResponse.NOT_DISPLAYED)) {
				return new RepeatableSetResponse(
						repeatableSet, 
						NoResponse.NOT_DISPLAYED);
			}
		}
		catch(JSONException e) {
			throw new DomainException(
					ErrorCode.SURVEY_INVALID_RESPONSES, 
					"The not displayed value is missing.", 
					e);
		}
		RepeatableSetResponse result = new RepeatableSetResponse(repeatableSet, null);
		
		JSONArray responses;
		try {
			responses = response.getJSONArray(JSON_KEY_RESPONSES);
		} catch (JSONException e) {
			throw new DomainException(
					ErrorCode.SURVEY_INVALID_RESPONSES, 
					"The responses array for the repeatable set are missing.", 
					e);
		}
		
		int numIterations = responses.length();
		for(int i = 0; i < numIterations; i++) {
			try {
				result.addResponseGroup(
						i + 1, 
						processResponses(
								repeatableSet.getSurveyItems(), 
								responses.getJSONArray(i),
								i,
								allowedPromptIds,
								false			// disallow partial record
							)
					);
			} catch (JSONException e) {
				throw new DomainException(
						ErrorCode.SURVEY_INVALID_RESPONSES, 
						"One of the response array objects for a repeatable set is not a JSONArray.", 
						e);
			}
		}
		return result;
	}
/**
	 * Creates a RepeatableSetResponse object from a RepeatableSet and the
	 * responses in a JSONObject.
	 * 
	 * @param repeatableSet The RepeatableSet that generated the responses.
	 * 
	 * @param response The responses as a JSONObject.
	 * 
	 * @return A RepeatableSetResponse object that represents the responses
	 * 		   to this repeatable set gathered from the JSONObject.
	 *   
	 * @throws DomainException Thrown if the repeatable set JSONObject is
	 * 						   malformed.
	 */
Creates a RepeatableSetResponse object from a RepeatableSet and the
responses in a JSONObject.

@param repeatableSet The RepeatableSet that generated the responses.

@param response The responses as a JSONObject.

@return A RepeatableSetResponse object that represents the responses
to this repeatable set gathered from the JSONObject.

@throws DomainException Thrown if the repeatable set JSONObject is
malformed.
Creates a RepeatableSetResponse object from a RepeatableSet and the responses in a JSONObject . @param repeatableSet The RepeatableSet that generated the responses . @param response The responses as a JSONObject . @return A RepeatableSetResponse object that represents the responses to this repeatable set gathered from the JSONObject . @throws DomainException Thrown if the repeatable set JSONObject is malformed .
private RepeatableSetResponse processRepeatableSet(
			final RepeatableSet repeatableSet, 
			final JSONObject response,
			final Set<String> allowedPromptIds) 
			throws DomainException {
		try {
			if(response.getBoolean(RepeatableSetResponse.NOT_DISPLAYED)) {
				return new RepeatableSetResponse(
						repeatableSet, 
						NoResponse.NOT_DISPLAYED);
			}
		}
		catch(JSONException e) {
			throw new DomainException(
					ErrorCode.SURVEY_INVALID_RESPONSES, 
					"The not displayed value is missing.", 
					e);
		}
		RepeatableSetResponse result = new RepeatableSetResponse(repeatableSet, null);
		JSONArray responses;
		try {
			responses = response.getJSONArray(JSON_KEY_RESPONSES);
		} catch (JSONException e) {
			throw new DomainException(
					ErrorCode.SURVEY_INVALID_RESPONSES, 
					"The responses array for the repeatable set are missing.", 
					e);
		}
		int numIterations = responses.length();
		for(int i = 0; i < numIterations; i++) {
			try {
				result.addResponseGroup(
						i + 1, 
						processResponses(
								repeatableSet.getSurveyItems(), 
								responses.getJSONArray(i),
								i,
								allowedPromptIds,
								false			
							)
					);
			} catch (JSONException e) {
				throw new DomainException(
						ErrorCode.SURVEY_INVALID_RESPONSES, 
						"One of the response array objects for a repeatable set is not a JSONArray.", 
						e);
			}
		}
		return result;
	}
private RepeatableSetResponse processRepeatableSet ( final RepeatableSet repeatableSet , final JSONObject response , final Set < String > allowedPromptIds ) throws DomainException { try { if ( response . getBoolean ( RepeatableSetResponse . NOT_DISPLAYED ) ) { return new RepeatableSetResponse ( repeatableSet , NoResponse . NOT_DISPLAYED ) ; } } catch ( JSONException e ) { throw new DomainException ( ErrorCode . SURVEY_INVALID_RESPONSES , "The not displayed value is missing." , e ) ; } RepeatableSetResponse result = new RepeatableSetResponse ( repeatableSet , null ) ; JSONArray responses ; try { responses = response . getJSONArray ( JSON_KEY_RESPONSES ) ; } catch ( JSONException e ) { throw new DomainException ( ErrorCode . SURVEY_INVALID_RESPONSES , "The responses array for the repeatable set are missing." , e ) ; } int numIterations = responses . length ( ) ; for ( int i = 0 ; i < numIterations ; i ++ ) { try { result . addResponseGroup ( i + 1 , processResponses ( repeatableSet . getSurveyItems ( ) , responses . getJSONArray ( i ) , i , allowedPromptIds , false ) ) ; } catch ( JSONException e ) { throw new DomainException ( ErrorCode . SURVEY_INVALID_RESPONSES , "One of the response array objects for a repeatable set is not a JSONArray." , e ) ; } } return result ; }
Creates a RepeatableSetResponse object from a RepeatableSet and the
 responses in a JSONObject.
Creates a RepeatableSetResponse object from a RepeatableSet and the responses in a JSONObject .
// disallow partial record