HttpServletResponse response, BindException errors) {
Map<String, Object> map = new HashMap<String, Object>();
String eventId = request.getParameter("id");
Map model = errors.getModel();
AppEngineUserService userService = new AppEngineUserService();
map.put("userService", userService);
model.put("model", map);
Event event = retrieveEvent(eventId);
if (event == null) {
String errorText = "Failed to retrieve event with ID \"" + eventId +
"\" -- event not found.";
model.put("errorText", errorText);
return new ModelAndView("admin_error", model);
}
Chapter chapter = retrieveChapter(event.getChapterId());
if (chapter == null) {
String errorText = "Failed to retrieve chapter with ID \"" +
event.getChapterId() + "\" -- chapter not found.";
model.put("errorText", errorText);
return new ModelAndView("admin_error", model);
}
if (!hasAccess(userService, chapter)) {
userService.setAfterLogoutEndpoint("/admin");
String errorText = "You are not listed as an organizer for the " +
"chapter associated with this event. Please sign in with an " +
"organizer's account to access this page.";
model.put("errorText", errorText);