private void setUpData(HttpServletRequest request) { if (!UserUtils.isLoggedOn(request)) { throw new UserNotFoundException(); } Long surveyId = RequestUtils.getNumericInput(request, "surveyId", "surveyId", true); Survey survey = null; if (surveyId != null) { survey = SurveyGetSingle.execute(surveyId); request.setAttribute(RequestUtils.SURVEY, survey); } if (survey == null) { throw new RuntimeException("Survey not found:" + surveyId); } String userId = request.getUserPrincipal().getName(); Admin admin = AdminGetSingle.getByUserId(userId, surveyId); if (admin == null) { throw new RuntimeException( "Admin not authorized for survey. userId: " + userId + " surveyId: " + surveyId); } List<Language> languages = LanguageGetAll.execute(surveyId); request.setAttribute(RequestUtils.LANGUAGES, languages); List<Question> questions = QuestionGetAll.execute(surveyId); request.setAttribute(RequestUtils.QUESTIONS, questions); List<AnswerSet> answerSets = AnswerSetGetAll.execute(surveyId); request.setAttribute(RequestUtils.ANSWER_SETS, answerSets); }