src/org/ohmage/domain/campaign/SurveyResponse.java
public final void addPromptResponse(
			final PromptResponse promptResponse) 
			throws DomainException {
		
		if(promptResponse == null) {
			throw new DomainException("The prompt response is null.");
		}
		
		RepeatableSet parent = promptResponse.getPrompt().getParent();
		if(parent == null) {
			responses.put(
					promptResponse.getPrompt().getIndex(), 
					promptResponse);
		}
		else {
			// FIXME: This assumes repeatable sets cannot contain repeatable
			// sets. This needs to be fixed if we ever allow it.
			int index = parent.getIndex();
			
			RepeatableSetResponse rsResponse = 
					(RepeatableSetResponse) responses.get(index);
			
			if(rsResponse == null) {
				rsResponse = new RepeatableSetResponse(parent, null);
				responses.put(index, rsResponse);
			}
			rsResponse.addResponse(
					promptResponse.getRepeatableSetIteration(), 
					index, 
					promptResponse);
		}
	}
/**
	 * Adds a prompt response to this survey response.
	 * 
	 * @param promptResponse The prompt response.
	 * 
	 * @throws DomainException Thrown if the prompt response is null.
	 */
Adds a prompt response to this survey response.

@param promptResponse The prompt response.

@throws DomainException Thrown if the prompt response is null.
Adds a prompt response to this survey response . @param promptResponse The prompt response . @throws DomainException Thrown if the prompt response is null .
public final void addPromptResponse(
			final PromptResponse promptResponse) 
			throws DomainException {
		if(promptResponse == null) {
			throw new DomainException("The prompt response is null.");
		}
		RepeatableSet parent = promptResponse.getPrompt().getParent();
		if(parent == null) {
			responses.put(
					promptResponse.getPrompt().getIndex(), 
					promptResponse);
		}
		else {
			int index = parent.getIndex();
			RepeatableSetResponse rsResponse = 
					(RepeatableSetResponse) responses.get(index);
			if(rsResponse == null) {
				rsResponse = new RepeatableSetResponse(parent, null);
				responses.put(index, rsResponse);
			}
			rsResponse.addResponse(
					promptResponse.getRepeatableSetIteration(), 
					index, 
					promptResponse);
		}
	}
public final void addPromptResponse ( final PromptResponse promptResponse ) throws DomainException { if ( promptResponse == null ) { throw new DomainException ( "The prompt response is null." ) ; } RepeatableSet parent = promptResponse . getPrompt ( ) . getParent ( ) ; if ( parent == null ) { responses . put ( promptResponse . getPrompt ( ) . getIndex ( ) , promptResponse ) ; } else { int index = parent . getIndex ( ) ; RepeatableSetResponse rsResponse = ( RepeatableSetResponse ) responses . get ( index ) ; if ( rsResponse == null ) { rsResponse = new RepeatableSetResponse ( parent , null ) ; responses . put ( index , rsResponse ) ; } rsResponse . addResponse ( promptResponse . getRepeatableSetIteration ( ) , index , promptResponse ) ; } }
Adds a prompt response to this survey response.
Adds a prompt response to this survey response .
// FIXME: This assumes repeatable sets cannot contain repeatable // sets. This needs to be fixed if we ever allow it.