src/org/ohmage/request/survey/SurveyResponseRequest.java
public void service(
			final Collection<SurveyResponse.ColumnKey> columns,
			final String promptType,
			final List<SortParameter> sortOrder,
			final Boolean collapse,
			final long numSurveyResponsesToSkip,
			final long numSurveyResponsesToProcess) {
		
		if(! authenticate(AllowNewAccount.NEW_ACCOUNT_DISALLOWED)) {
			return;
		}
		
		try {
		    LOGGER.info("Retrieving campaign configuration.");
			campaign = CampaignServices.instance().getCampaign(campaignId);
			if(campaign == null) {
				throw
					new ServiceException(
						ErrorCode.CAMPAIGN_INVALID_ID,
						"The campaign does not exist.");
			}
			
			if((promptIds != null) && (! promptIds.isEmpty()) && (! URN_SPECIAL_ALL_LIST.equals(promptIds))) {
				LOGGER.info("Verifying that the prompt ids in the query belong to the campaign.");
				SurveyResponseReadServices.instance().verifyPromptIdsBelongToConfiguration(promptIds, campaign);
			}
			
			if((surveyIds != null) && (! surveyIds.isEmpty()) && (! URN_SPECIAL_ALL_LIST.equals(surveyIds))) {
				LOGGER.info("Verifying that the survey ids in the query belong to the campaign.");
				SurveyResponseReadServices.instance().verifySurveyIdsBelongToConfiguration(surveyIds, campaign);
			}
		    
			LOGGER.info("Dispatching to the data layer.");
			surveyResponseCount = 
					SurveyResponseServices.instance().readSurveyResponseInformation(
							campaign,
							getUser().getUsername(),
							surveyResponseIds,
							(URN_SPECIAL_ALL_LIST.equals(usernames) ? null : usernames), 
							startDate, 
							endDate, 
							privacyState, 
							(URN_SPECIAL_ALL_LIST.equals(surveyIds)) ? null : surveyIds, 
							(URN_SPECIAL_ALL_LIST.equals(promptIds)) ? null : promptIds,
							null,
							promptResponseSearchTokens,
							((collapse != null) && collapse && (! columns.equals(URN_SPECIAL_ALL_LIST))) ? columns : null,
							sortOrder,
							numSurveyResponsesToSkip,
							numSurveyResponsesToProcess,
							surveyResponseList
						);
			
			int numPromptResponses = 0;
			for(SurveyResponse surveyResponse : surveyResponseList) {
				numPromptResponses += surveyResponse.getResponses().size();
			}
			
			LOGGER.info(
					"Found " + 
						surveyResponseList.size() + 
						" results after filtering and paging a total of " + 
						surveyResponseCount + 
						" applicable responses, which contains " +
						numPromptResponses +
						" prompt responses.");
		}
		catch(ServiceException e) {
			e.failRequest(this);
			e.logException(LOGGER);
		}
	}
/**
	 * Authenticates the parameters and makes the request against the database.
	 * 
	 * @param columns The columns to gather for each survey response.
	 * 
	 * @param promptType Only gather survey responses that contain prompt 
	 * 					 responses whose prompt type is this. Note, the survey
	 * 					 response may contain other prompt responses, but those
	 * 					 will _not_ be gathered.
	 * 
	 * @param collapse Whether or not to collapse the results.
	 * 
	 * @param numSurveyResponsesToSkip The number of survey responses to skip.
	 * 
	 * @param numSurveyResponsesToProcess The number of survey responses to	
	 * 									  process.
	 */
Authenticates the parameters and makes the request against the database.

@param columns The columns to gather for each survey response.

@param promptType Only gather survey responses that contain prompt
responses whose prompt type is this. Note, the survey
response may contain other prompt responses, but those
will _not_ be gathered.

@param collapse Whether or not to collapse the results.

@param numSurveyResponsesToSkip The number of survey responses to skip.

@param numSurveyResponsesToProcess The number of survey responses to
process.
Authenticates the parameters and makes the request against the database . @param columns The columns to gather for each survey response . @param promptType Only gather survey responses that contain prompt responses whose prompt type is this . Note the survey response may contain other prompt responses but those will _not_ be gathered . @param collapse Whether or not to collapse the results . @param numSurveyResponsesToSkip The number of survey responses to skip . @param numSurveyResponsesToProcess The number of survey responses to process .
public void service(
			final Collection<SurveyResponse.ColumnKey> columns,
			final String promptType,
			final List<SortParameter> sortOrder,
			final Boolean collapse,
			final long numSurveyResponsesToSkip,
			final long numSurveyResponsesToProcess) {
		if(! authenticate(AllowNewAccount.NEW_ACCOUNT_DISALLOWED)) {
			return;
		}
		try {
		    LOGGER.info("Retrieving campaign configuration.");
			campaign = CampaignServices.instance().getCampaign(campaignId);
			if(campaign == null) {
				throw
					new ServiceException(
						ErrorCode.CAMPAIGN_INVALID_ID,
						"The campaign does not exist.");
			}
			if((promptIds != null) && (! promptIds.isEmpty()) && (! URN_SPECIAL_ALL_LIST.equals(promptIds))) {
				LOGGER.info("Verifying that the prompt ids in the query belong to the campaign.");
				SurveyResponseReadServices.instance().verifyPromptIdsBelongToConfiguration(promptIds, campaign);
			}
			if((surveyIds != null) && (! surveyIds.isEmpty()) && (! URN_SPECIAL_ALL_LIST.equals(surveyIds))) {
				LOGGER.info("Verifying that the survey ids in the query belong to the campaign.");
				SurveyResponseReadServices.instance().verifySurveyIdsBelongToConfiguration(surveyIds, campaign);
			}
			LOGGER.info("Dispatching to the data layer.");
			surveyResponseCount = 
					SurveyResponseServices.instance().readSurveyResponseInformation(
							campaign,
							getUser().getUsername(),
							surveyResponseIds,
							(URN_SPECIAL_ALL_LIST.equals(usernames) ? null : usernames), 
							startDate, 
							endDate, 
							privacyState, 
							(URN_SPECIAL_ALL_LIST.equals(surveyIds)) ? null : surveyIds, 
							(URN_SPECIAL_ALL_LIST.equals(promptIds)) ? null : promptIds,
							null,
							promptResponseSearchTokens,
							((collapse != null) && collapse && (! columns.equals(URN_SPECIAL_ALL_LIST))) ? columns : null,
							sortOrder,
							numSurveyResponsesToSkip,
							numSurveyResponsesToProcess,
							surveyResponseList
						);
			int numPromptResponses = 0;
			for(SurveyResponse surveyResponse : surveyResponseList) {
				numPromptResponses += surveyResponse.getResponses().size();
			}
			LOGGER.info(
					"Found " + 
						surveyResponseList.size() + 
						" results after filtering and paging a total of " + 
						surveyResponseCount + 
						" applicable responses, which contains " +
						numPromptResponses +
						" prompt responses.");
		}
		catch(ServiceException e) {
			e.failRequest(this);
			e.logException(LOGGER);
		}
	}
public void service ( final Collection < SurveyResponse . ColumnKey > columns , final String promptType , final List < SortParameter > sortOrder , final Boolean collapse , final long numSurveyResponsesToSkip , final long numSurveyResponsesToProcess ) { if ( ! authenticate ( AllowNewAccount . NEW_ACCOUNT_DISALLOWED ) ) { return ; } try { LOGGER . info ( "Retrieving campaign configuration." ) ; campaign = CampaignServices . instance ( ) . getCampaign ( campaignId ) ; if ( campaign == null ) { throw new ServiceException ( ErrorCode . CAMPAIGN_INVALID_ID , "The campaign does not exist." ) ; } if ( ( promptIds != null ) && ( ! promptIds . isEmpty ( ) ) && ( ! URN_SPECIAL_ALL_LIST . equals ( promptIds ) ) ) { LOGGER . info ( "Verifying that the prompt ids in the query belong to the campaign." ) ; SurveyResponseReadServices . instance ( ) . verifyPromptIdsBelongToConfiguration ( promptIds , campaign ) ; } if ( ( surveyIds != null ) && ( ! surveyIds . isEmpty ( ) ) && ( ! URN_SPECIAL_ALL_LIST . equals ( surveyIds ) ) ) { LOGGER . info ( "Verifying that the survey ids in the query belong to the campaign." ) ; SurveyResponseReadServices . instance ( ) . verifySurveyIdsBelongToConfiguration ( surveyIds , campaign ) ; } LOGGER . info ( "Dispatching to the data layer." ) ; surveyResponseCount = SurveyResponseServices . instance ( ) . readSurveyResponseInformation ( campaign , getUser ( ) . getUsername ( ) , surveyResponseIds , ( URN_SPECIAL_ALL_LIST . equals ( usernames ) ? null : usernames ) , startDate , endDate , privacyState , ( URN_SPECIAL_ALL_LIST . equals ( surveyIds ) ) ? null : surveyIds , ( URN_SPECIAL_ALL_LIST . equals ( promptIds ) ) ? null : promptIds , null , promptResponseSearchTokens , ( ( collapse != null ) && collapse && ( ! columns . equals ( URN_SPECIAL_ALL_LIST ) ) ) ? columns : null , sortOrder , numSurveyResponsesToSkip , numSurveyResponsesToProcess , surveyResponseList ) ; int numPromptResponses = 0 ; for ( SurveyResponse surveyResponse : surveyResponseList ) { numPromptResponses += surveyResponse . getResponses ( ) . size ( ) ; } LOGGER . info ( "Found " + surveyResponseList . size ( ) + " results after filtering and paging a total of " + surveyResponseCount + " applicable responses, which contains " + numPromptResponses + " prompt responses." ) ; } catch ( ServiceException e ) { e . failRequest ( this ) ; e . logException ( LOGGER ) ; } }
Authenticates the parameters and makes the request against the database.
Authenticates the parameters and makes the request against the database .