@RequestMapping(value = "/logon.sf", method = RequestMethod.POST) public String logonMethod( @ModelAttribute("logon") Logon logon, BindingResult result, SessionStatus status) { logonValidator.validate(logon, result); if (result.hasErrors()) { //if validator failed return "login"; } else { status.setComplete(); //form success return "securepage"; } }
@RequestMapping(value = "/users/upload", params = {"deleteImage"}, method = RequestMethod.POST) public String deleteProfileImage(CurrentUser currentUser, RedirectAttributes attributes, Model model, SessionStatus status) { logger.info("Removing Profile Image for user: {}", currentUser.getUser().getUsername()); String profileRedirectUrl = String.format("redirect:/%s", currentUser.getUsername()); ProfileImageDTO profileImageDTO = new ProfileImageDTO(); model.addAttribute("profileImageDTO", profileImageDTO); userService.updateHasAvatar(currentUser.getId(), false); status.setComplete(); webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_PROFILE_IMAGE_REMOVED); return profileRedirectUrl; }
@RequestMapping(value = "/users/upload", method = RequestMethod.POST) public String handleFileUpload(@Valid ProfileImageDTO profileImageDTO, BindingResult result, ModelMap model, CurrentUser currentUser, RedirectAttributes attributes, SessionStatus status) throws IOException { String profileRedirectUrl = String.format("redirect:/user/%s?ico", currentUser.getUsername()); if (result.hasErrors()) { logger.info("Profile Image Errors for: {}", profileImageDTO.getFile().getOriginalFilename()); return USER_PROFILE_VIEW; } else { logger.debug("Fetching file"); MultipartFile multipartFile = profileImageDTO.getFile(); String userKey = currentUser.getUser().getUserKey(); webUI.processProfileImage(profileImageDTO, userKey); userService.updateHasAvatar(currentUser.getId(), true); status.setComplete(); webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_PROFILE_IMAGE_UPDATED); return profileRedirectUrl; } }
@RequestMapping(value = "/users/new", method = RequestMethod.POST) public String addUser(@Valid UserDTO userDTO, BindingResult result, SessionStatus status, Model model, RedirectAttributes attributes) { if (result.hasErrors()) { model.addAttribute("authorities", userService.getRoles()); return ADMIN_USERFORM_VIEW; } else { userDTO.setSignInProvider(SignInProvider.SITE); User added = userService.create(userDTO); logger.info("Added user with information: {}", added); status.setComplete(); webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_USER_ADDED, added.getFirstName(), added.getLastName()); return "redirect:/admin/users"; } }
@RequestMapping(value = "/roles/new", method = RequestMethod.POST) public String addUser(@Valid RoleDTO roleDTO, BindingResult result, SessionStatus status, RedirectAttributes attributes) { if (result.hasErrors()) { return ADMIN_ROLES_VIEW; } else { Authority authority = userService.createAuthority(roleDTO); logger.info("Role Added: {}", authority); status.setComplete(); webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_ROLE_ADDED, authority.getAuthority()); return "redirect:/admin/roles"; } }
@RequestMapping(value = "/tags/new", method = RequestMethod.POST) public String addTag(@Valid TagDTO tagDTO, BindingResult result, SessionStatus status, RedirectAttributes attributes) { if (result.hasErrors()) { return ADMIN_TAGS_VIEW; } else { Tag tag = postService.createTag(tagDTO); logger.info("Tag Added: {}", tag.getTagValue()); status.setComplete(); webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_TAG_ADDED, tag.getTagValue()); return "redirect:/admin/posts/tags"; } }
@RequestMapping(value = "/categories/new", method = RequestMethod.POST) public String addCategory(@Valid CategoryDTO categoryDTO, BindingResult result, SessionStatus status, RedirectAttributes attributes) { if (result.hasErrors()) { return ADMIN_CATEGORIES_VIEW; } else { Category category = postService.createCategory(categoryDTO); logger.info("Category Added: {}", category.getCategoryValue()); status.setComplete(); webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_CATEGORY_ADDED, category.getCategoryValue()); return "redirect:/admin/posts/categories"; } }
@PostMapping("new") public String processPetCreationForm( @Valid @ModelAttribute Pet pet, BindingResult bindingResult, Model model, @ModelAttribute("id") int petId, SessionStatus sessionStatus) { logger.debug("processPetCreationForm()"); if (bindingResult.hasErrors()) { model.addAttribute("mode", FormMode.Edit); return "pet/viewOrEdit"; } if (petId != -1) { pet.setId(petId); petRepository.update(pet); } else { petId = petRepository.insert(pet); } sessionStatus.setComplete(); return "redirect:/pets/" + petId; }
@RequestMapping(value = "/contato/new", method = RequestMethod.POST) public String processCreationForm(@Valid Contato contato, BindingResult result, SessionStatus status, RedirectAttributes redirectAttributes) { if (result.hasErrors()) { System.out.println("Contato in if"); System.out.println("Contato " + result.toString()); return "contato/contatoForm"; } else { System.out.println("Contato in else"); repository.save(contato); String msginfo = "<script>$(document).ready(function() {toastr.success('Contato incluído com sucesso !');});</script>"; redirectAttributes.addFlashAttribute("msginfo", msginfo); status.setComplete(); return "redirect:/contato"; } }
/** * The final step (dashboard) of the new site registration route, if the GLOBE survey was not skipped. * * @param site The site that exists in the model with fields populated by what the user * entered into the form on the second page. * @param sessionStatus The session module for the new site registration route. * @param answers An array of GLOBE survey answers. * @return A redirect command to the dashboard. */ @RequestMapping(params = "_finish_globe", method = RequestMethod.POST) public String createGlobeSite( @ModelAttribute("site") Site site, SessionStatus sessionStatus, @RequestParam("answers") String[] answers) { // Persist the site. siteService.save(site); // I'm sure there is a better way of persisting GLOBE answers. for (byte i = 0; i < answers.length; i++) { Globe globe = new Globe(); globe.setSite(site); globe.setSiteID(site.getId()); globe.setAnswer(answers[i]); globe.setQuestion_number((byte)(i + 1)); globeRepository.save(globe); } // Set the session complete, as the site has been safely persisted. sessionStatus.setComplete(); // Redirect to the dashboard. return "redirect:/dashboard"; }
@RequestMapping(value = "/{tascaId}/restaurar", method = RequestMethod.POST) public String restaurar( HttpServletRequest request, @PathVariable String tascaId, SessionStatus status, Model model) { try { accioRestaurarForm(request, tascaId); } catch (Exception ex) { MissatgesHelper.error(request, ex.getMessage()); logger.error("No s'ha pogut restaurar el formulari en la tasca " + tascaId, ex); } status.setComplete(); return mostrarInformacioTascaPerPipelles( request, tascaId, model, "form"); }
@RequestMapping(value="/{expedientId}/{tokenId}/tokenRetrocedir", method = RequestMethod.POST) public String tokenRetrocedirPost( HttpServletRequest request, @PathVariable Long expedientId, @PathVariable String tokenId, @ModelAttribute TokenExpedientCommand command, BindingResult result, SessionStatus status, Model model) { try{ new TokenRetrocedirValidator().validate(command, result); if (result.hasErrors()) { model.addAttribute("arrivingNodeNames", tokenService.findArrivingNodeNames(expedientId,tokenId.toString())); return "v3/expedientTokenRetrocedir"; } tokenService.tokenRetrocedir(expedientId, tokenId, command.getNodeRetrocedir(), command.isCancelar()); MissatgesHelper.success(request, getMessage(request, "info.token.retrocedit") ); } catch (Exception ex) { MissatgesHelper.error(request, getMessage(request, "error.retrocedir.token", new Object[] {String.valueOf(tokenId)} )); logger.error("No s'ha pogut retrocedir el token " + String.valueOf(tokenId), ex); } return modalUrlTancar(false); }
@RequestMapping(value = "/{expedientTipusId}/{definicioProcesId}/borrarRepro/{reproId}", method = RequestMethod.POST) public String deleteRepro( HttpServletRequest request, @PathVariable Long expedientTipusId, @PathVariable Long definicioProcesId, @PathVariable Long reproId, @ModelAttribute("command") Object command, BindingResult result, SessionStatus status, Model model) { try { String nomRepro = reproService.deleteById(reproId); MissatgesHelper.success(request, getMessage(request, "repro.missatge.repro") + " '" + nomRepro + "' " + getMessage(request, "repro.missatge.eliminat")); } catch (Exception ex) { MissatgesHelper.error(request, getMessage(request, "repro.missatge.error.eliminat")); } return expedientInicioPasFormController.iniciarFormGet(request, expedientTipusId, definicioProcesId, model); }
@RequestMapping(value = "/carrec/jbpmForm", method = RequestMethod.POST) public String jbpmFormPost( HttpServletRequest request, @RequestParam(value = "submit", required = false) String submit, @ModelAttribute("command") CarrecJbpmId command, BindingResult result, SessionStatus status) { if ("submit".equals(submit) || submit.length() == 0) { annotationValidator.validate(command, result); if (result.hasErrors()) return "/carrec/jbpmForm"; try { if (command.getId() == null) organitzacioService.createCarrecJbpmId(command); else organitzacioService.updateCarrecJbpmId(command); missatgeInfo(request, getMessage("info.infocarrec.guardat") ); status.setComplete(); } catch (Exception ex) { missatgeError(request, getMessage("error.proces.peticio"), ex.getLocalizedMessage()); logger.error("No s'ha pogut guardar la informació del càrrec", ex); return "/carrec/jbpmForm"; } } return "redirect:/carrec/jbpmConfigurats.html"; }
@RequestMapping(value = "form", method = RequestMethod.POST) public String formPost( HttpServletRequest request, @RequestParam(value = "submit", required = false) String submit, @ModelAttribute("command") Persona command, BindingResult result, SessionStatus status) { if ("submit".equals(submit) || submit.length() == 0) { if (validator != null) validator.validate(command, result); if (result.hasErrors()) { return "perfil/form"; } try { personaService.updatePerfil(command); missatgeInfo(request, getMessage("info.perfil.guardat") ); status.setComplete(); } catch (Exception ex) { missatgeError(request, getMessage("error.guardar.perfil"), ex.getLocalizedMessage()); logger.error("No s'ha pogut guardar el registre", ex); return "perfil/form"; } return "redirect:/perfil/info.html"; } return "redirect:/perfil/info.html"; }
@RequestMapping(value="/submit") protected String onSubmit(HttpServletRequest request, SessionStatus status ) throws ServletRequestBindingException { UserSession userSession = (UserSession) WebUtils.getSessionAttribute(request, "userSession"); PlayerData player = playerService.findPlayer(userSession.getGameId(), userSession.getMemberId()); QuestionData q = (QuestionData) WebUtils.getSessionAttribute(request, "qsess"); if (q == null) { logger.error("No session in preview post!"); return "redirect:make"; } logger.debug("================> qid="+q.getId()); request.getSession().removeAttribute("qsess"); playerService.submitQuestion(player.getId(), q); return "redirect:/game/game"; }
/** * The mapping for the final step of the registration route. * Validation is performed on fields from the previous page * and the user is persisted if no issues are present. * * @param user The user that exists in the model with fields populated by what the user * entered into the form on the question page. * @param bindingResult The error module for this page, allows bindings between the validation module. * @param sessionStatus The session module for the registration route. * @return A redirect command to the dashboard, or the path to the site-questionnaire if validation * has failed on fields from the previous page. */ @RequestMapping(params = "_finish", method = RequestMethod.POST) public String processFinish( final @ModelAttribute("user") User user, final BindingResult bindingResult, final SessionStatus sessionStatus) { String username = user.getUsername(); String password = user.getPassword(); // Validates the First, Middle initial, and Last name fields. personalDetailsValidator.validate(user, bindingResult); if (bindingResult.hasErrors()) { return "registration/questionPage"; } // At this point, all the validation has passed. Save the new account and login the user. userService.save(user); // Auto login, so the user does not have to login after creating an account. securityService.autoLogin(username, password); sessionStatus.setComplete(); return "redirect:dashboard"; }
@RequestMapping(value = "/area/jbpmForm", method = RequestMethod.POST) public String jbpmFormPost( HttpServletRequest request, @RequestParam(value = "submit", required = false) String submit, @ModelAttribute("command") AreaJbpmId command, BindingResult result, SessionStatus status) { if ("submit".equals(submit) || submit.length() == 0) { annotationValidator.validate(command, result); if (result.hasErrors()) return "/area/jbpmForm"; try { if (command.getId() == null) organitzacioService.createAreaJbpmId(command); else organitzacioService.updateAreaJbpmId(command); missatgeInfo(request, getMessage("info.infoarea.guardat")); status.setComplete(); } catch (Exception ex) { missatgeError(request, getMessage("error.proces.peticio"), ex.getLocalizedMessage()); logger.error("No s'ha pogut guardar la informació de l'area", ex); return "/area/jbpmForm"; } } return "redirect:/area/jbpmConfigurats.html"; }
@RequestMapping(value="/submit") protected String submit(HttpServletRequest request, SessionStatus status ) throws ServletRequestBindingException { UserSession userSession = (UserSession) WebUtils.getSessionAttribute(request, "userSession"); PlayerData player = playerService.findPlayer(userSession.getGameId(), userSession.getMemberId()); QuestionData q = (QuestionData) WebUtils.getSessionAttribute(request, "qsess"); if (q == null) { logger.error("No session in preview post!"); return "redirect:make"; } logger.debug("================> qid="+q.getId()); playerService.submitQuestion(player.getId(), q); // allow invitations to be sent now... question cannot be changed after this. gameService.beginGameInvitation(userSession.getGameId()); request.getSession().removeAttribute("qsess"); return "redirect:/game/create/invite/home"; }
@RequestMapping(value="/make", method=RequestMethod.POST) protected String onSubmit( HttpServletRequest request, HttpServletResponse response, QuestionData q, ModelMap model, SessionStatus status) throws Exception { UserSession userSession = (UserSession) WebUtils.getSessionAttribute(request, "userSession"); PlayerData player = playerService.findPlayer(userSession.getGameId(), userSession.getMemberId()); if (request.getParameterMap().containsKey("delete")) { // delete all queued questions by sending empty list to reorder to. ArrayList<Integer> emptyList = new ArrayList<Integer>(); playerService.reorderQueuedQuestions(player.getId(),emptyList); // clear question in session now. status.setComplete(); return "redirect:make"; } else { logger.debug("makequestion post playerid="+player.getId()+" qid="+q.getId()+" imageId="+q.getImageId()); logger.debug("================> qid="+q.getId()); request.getSession().setAttribute("qsess", q); // put question is session so it can be grabbed for verify and submit. return "redirect:preview"; } }
@RequestMapping(value = "/contato/{contatoId}/edit", method = RequestMethod.POST) public String processUpdateForm(@PathVariable("contatoId") int contatoId, @Valid Contato contato, BindingResult result, SessionStatus status, RedirectAttributes redirectAttributes) { if (result.hasErrors()) { return "contato/contatoForm"; } else { Contato contatoUpdate = repository.findOne((long) contatoId); contatoUpdate.setNome(contato.getNome()); contatoUpdate.setEmail(contato.getEmail()); repository.save(contatoUpdate); String msginfo = "<script>$(document).ready(function() {toastr.success('Contato atualizado com sucesso !');});</script>"; redirectAttributes.addFlashAttribute("msginfo", msginfo); status.setComplete(); return "redirect:/contato"; } }
@RequestMapping(value = "/area/membreEsborrar") public String esborrarMembre( HttpServletRequest request, @ModelAttribute("command") AreaMembreCommand command, SessionStatus status) { Entorn entorn = getEntornActiu(request); if (entorn != null) { try { organitzacioService.esborrarMembre(command.getId(), command.getPersona()); missatgeInfo(request, getMessage("info.esborrat.persona.area") ); status.setComplete(); } catch (Exception ex) { missatgeError(request, getMessage("error.esborrar.persona.area"), ex.getLocalizedMessage()); logger.error("No s'ha pogut esborrar la persona", ex); } return "redirect:/area/membres.html?id=" + command.getId(); } else { missatgeError(request, getMessage("error.no.entorn.selec") ); return "redirect:/index.html"; } }
@RequestMapping(value = "/persona/consulta.html", method = RequestMethod.POST) public String consultaPost( HttpServletRequest request, HttpSession session, @RequestParam(value = "submit", required = false) String submit, @ModelAttribute("command") PersonaConsultaCommand command, BindingResult result, SessionStatus status, ModelMap model) { if ("submit".equals(submit)) { session.setAttribute(VARIABLE_SESSIO_COMMAND, command); return "redirect:/persona/consulta.html"; } else if ("clean".equals(submit)) { session.removeAttribute(VARIABLE_SESSIO_COMMAND); return "redirect:/persona/consulta.html"; } return "expedient/consulta"; }
@RequestMapping(value = "/expedient/iniciarRegistre", method = RequestMethod.POST) public String registrePost( HttpServletRequest request, @RequestParam(value = "id", required = true) String id, @RequestParam(value = "registreId", required = true) Long registreId, @RequestParam(value = "index", required = false) Integer index, @RequestParam(value = "submit", required = true) String submit, @ModelAttribute("command") Object command, BindingResult result, SessionStatus status, ModelMap model) { return super.registrePost( request, id, registreId, index, submit, command, result, status, model); }
@RequestMapping("/logout") public String signOut(HttpSession session, SessionStatus status, Model model) { session.removeAttribute("rol"); session.removeAttribute("usuario"); session.invalidate(); status.setComplete(); return "redirect:login?logout"; }
@PostMapping("/registration") public ModelAndView submitRegistration(@ModelAttribute("employee") Employee employeeRegistration, BindingResult result, SessionStatus status, Model model, RedirectAttributes redirectAttributes) { log.info("Inside submitRegistation method of Registration Controller."); registrationValidator.validate(employeeRegistration, result); if (result.hasErrors()) { model.addAttribute("css", "danger"); model.addAttribute("msg", "Invalid / Missing Information. Please correct the information entered below!!"); return new ModelAndView("registration", "employee", employeeRegistration); } log.info("The form has no errors, so persisting the data."); try { employeeRegistration.setAccountStatusFlag(TimesheetConstants.REGISTRATION_STATUS_ACTIVE); employeeRegistration.setDateCreated(new Date()); employeeRegistration.setNameUserCreated(employeeRegistration.getEmployeeFullName()); log.info("Saving the registration details of the Employee."); registrationService.saveRegistrationDetails(employeeRegistration); emailService.sendPlainTextMailWithoutAttachment(TimesheetConstants.fromAddress, employeeRegistration.getEmployeeEmailId(), "", "TechNumen Inc., Time sheet Application - Registration Successful", "This is to confirm that you have successfully created your profile."); status.setComplete(); } catch (Exception ex) { log.error("Exception while saving Registration details: " + ex); model.addAttribute("css", "danger"); model.addAttribute("msg", "Technical issue while saving the Registration information. " + "Please contact Admin for more information!!"); return new ModelAndView("registration", "employee", employeeRegistration); } log.info("Successfully Registered the user, forwarding to the Login page."); redirectAttributes.addFlashAttribute("msg", "You are successfully registered. Please Login to Continue."); redirectAttributes.addFlashAttribute("css", "success"); return new ModelAndView("redirect:/login?encodedEmail=" + encryptDecryptUtils.encodeInputString(employeeRegistration.getEmployeeEmailId())); }
@PostMapping("/updatePassword") public ModelAndView updatePassword(@ModelAttribute("employee") Employee employee, BindingResult result, SessionStatus status, Model model, Errors errors) { log.info("Inside updatePassword method of Registration Controller. EmployeeId: " + employee.getEmployeeEmailId()); updatePasswordValidator.validate(employee, errors); if (result.hasErrors()) { model.addAttribute("css", "danger"); model.addAttribute("msg", "Invalid / Missing Information. Please correct the information entered below!!"); return new ModelAndView("updatePassword"); } try { registrationService.updatePassword(employee.getEmployeeEmailId(), employee.getEmpPassword()); } catch (Exception ex) { log.error("Exception while updating Employee password."); model.addAttribute("css", "danger"); model.addAttribute("msg", "Application issue while updating your password. Please contact Admin for more information!!"); return new ModelAndView("updatePassword"); } status.setComplete(); //Send a confirmation Email. emailService.sendPlainTextMailWithoutAttachment(TimesheetConstants.fromAddress, employee.getEmployeeEmailId(), "", "TechNumen Inc., Time sheet Application - Password updated", "This is to let you know that your password is updated successfully."); return new ModelAndView("updatePassword"); }
/** * 顾客预约托管 * @param name 顾客姓名 * @param tel 顾客手机号 * @param location 工程所在地 * @param model 预约结果信息 * @return 预约成功页面 */ @RequestMapping(value = "/free-appointment",method = RequestMethod.POST) public String freeAppointment(HttpServletRequest httpServletRequest, @RequestParam("name") String name, @RequestParam("tel") String tel, @RequestParam("location") String location,Model model, SessionStatus sessionStatus){ String workerId = (String) httpServletRequest.getSession().getAttribute("workerid"); Customer customer = new Customer(name,tel,location,new Date(),""); if(workerId != null){ WorkerInfo workerInfo = workerInfoService.queryWorkerByWorkerId(Long.parseLong(workerId)); customer.setNotes("预约[工号:" + workerId + ";姓名:"+workerInfo.getName() + "]"); } try{ int result = customerService.newCustomer(customer); model.addAttribute("msg","预约成功!"); aliyunMNService.SMSNotification(3,tel); UserInfo userInfo = userInfoService.queryByRoleId(8); String telphone = userInfo.getTelphone(); aliyunMNService.SMSNotification(4,telphone); sessionStatus.setComplete(); return "appointment/appointmentsuccess"; }catch (Exception e){ model.addAttribute("msg","预约失败!"); return "appointment/appointmentsuccess"; } }
@RequestMapping(value = "/{expedientId}/{terminiId}/terminiModificar", method = RequestMethod.POST) public String terminiModificar( HttpServletRequest request, @PathVariable Long expedientId, @PathVariable Long terminiId, @Valid @ModelAttribute ExpedientTerminiModificarCommand expedientTerminiModificarCommand, BindingResult result, SessionStatus status, Model model) { try { Date inicio = null; if (TerminiModificacioTipus.DURADA.name().equals(expedientTerminiModificarCommand.getTipus())) { TerminiIniciatDto terminiIniciat = terminiService.findIniciatAmbId(terminiId); inicio = terminiIniciat.getDataInici(); } else if (TerminiModificacioTipus.DATA_INICI.name().equals(expedientTerminiModificarCommand.getTipus())) { inicio = expedientTerminiModificarCommand.getDataInici(); } else { inicio = expedientTerminiModificarCommand.getDataFi(); } terminiService.modificar( terminiId, expedientId, inicio, expedientTerminiModificarCommand.getAnys(), expedientTerminiModificarCommand.getMesos(), expedientTerminiModificarCommand.getDies(), TerminiModificacioTipus.DATA_FI.name().equals(expedientTerminiModificarCommand.getTipus())); MissatgesHelper.success(request, getMessage(request, "info.termini.modificat")); } catch (Exception ex) { MissatgesHelper.error(request, getMessage(request, "error.modificar.termini")); logger.error("No s'ha pogut modificar el termini", ex); } return modalUrlTancar(false); }
@RequestMapping(value = "/{expedientId}/aturar", method = RequestMethod.POST) public String aturarPost( HttpServletRequest request, @PathVariable Long expedientId, Model model, @ModelAttribute("aturarExpedient") ExpedientEinesAturarCommand aturarExpedient, BindingResult result, SessionStatus status) { try { ExpedientDto expedient = expedientService.findAmbId(expedientId); if (!expedient.isAturat()) { new ExpedientAturarValidator().validate(aturarExpedient, result); if (result.hasErrors()) { MissatgesHelper.error(request, getMessage(request, "error.validacio")); model.addAttribute("expedientId", expedientId); model.addAttribute(aturarExpedient); return "v3/expedient/aturar"; } expedientService.aturar(expedientId, aturarExpedient.getMotiu()); MissatgesHelper.success(request, getMessage(request, "info.expedient.aturat")); } else { MissatgesHelper.error(request, getMessage(request, "error.expedient.ja.aturat")); } } catch (Exception ex) { MissatgesHelper.error(request, getMessage(request, "error.aturar.expedient")); ex.getLocalizedMessage(); } return modalUrlTancar(); }
@RequestMapping(value="massivaExecutarAccio", method = RequestMethod.POST) public String execucioAccioCommandPost( HttpServletRequest request, @RequestParam(value = "inici", required = false) String inici, @RequestParam(value = "correu", required = false) boolean correu, @ModelAttribute ExecucioAccioCommand command, @RequestParam(value = "accio", required = true) String accio, BindingResult result, SessionStatus status, Model model) { return massivaPost(request, inici, correu, command, accio, result, status, model, null, null); }
@RequestMapping(value="aturarMas", method = RequestMethod.POST) public String expedientEinesAturarCommandPost( HttpServletRequest request, @RequestParam(value = "inici", required = false) String inici, @RequestParam(value = "correu", required = false) boolean correu, @ModelAttribute ExpedientEinesAturarCommand command, @RequestParam(value = "accio", required = true) String accio, BindingResult result, SessionStatus status, Model model) { return massivaPost(request, inici, correu, command, accio, result, status, model, null, null); }
@RequestMapping(value="scriptMas", method = RequestMethod.POST) public String expedientEinesScriptCommandPost( HttpServletRequest request, @RequestParam(value = "inici", required = false) String inici, @RequestParam(value = "correu", required = false) boolean correu, @ModelAttribute ExpedientEinesScriptCommand command, @RequestParam(value = "accio", required = true) String accio, BindingResult result, SessionStatus status, Model model) { return massivaPost(request, inici, correu, command, accio, result, status, model, null, null); }
@RequestMapping(value="massivaCanviVersio", method = RequestMethod.POST) public String canviVersioProcesCommandPost( HttpServletRequest request, @RequestParam(value = "inici", required = false) String inici, @RequestParam(value = "correu", required = false) boolean correu, @ModelAttribute CanviVersioProcesCommand command, @RequestParam(value = "accio", required = true) String accio, BindingResult result, SessionStatus status, Model model) { return massivaPost(request, inici, correu, command, accio, result, status, model, null, null); }
@RequestMapping(value="/documentModificarMas", method = RequestMethod.POST) public String documentAdjuntarMasPost( HttpServletRequest request, @RequestParam(value = "inici", required = false) String inici, @RequestParam(value = "correu", required = false) boolean correu, @ModelAttribute DocumentExpedientCommand command, @RequestParam(value = "accio", required = true) String accio, BindingResult result, SessionStatus status, Model model) { return massivaPost(request, inici, correu, command, accio, result, status, model, request.getParameter("contingut"), null); }
@RequestMapping(value = "/contato/{contatoId}/delete", method = RequestMethod.GET) public String delete(@PathVariable("contatoId") int contatoId, SessionStatus status) { repository.delete((long) contatoId); status.setComplete(); return "redirect:/contato"; }
@RequestMapping(value="/{campId}/modificarVariablesMas", method = RequestMethod.POST) public String modificarVariablesMasPost( HttpServletRequest request, @RequestParam(value = "inici", required = false) String inici, @RequestParam(value = "correu", required = false) boolean correu, @PathVariable Long campId, @Valid @ModelAttribute("modificarVariablesCommand") Object command, @RequestParam(value = "accio", required = true) String accio, BindingResult result, SessionStatus status, Model model) { return massivaPost(request, inici, correu, command, accio, result, status, model, null, campId); }
@RequestMapping(value="/make", method=RequestMethod.GET) public String handleGetRequest(HttpServletRequest request, ModelMap model, SessionStatus status) { UserSession userSession = (UserSession) WebUtils.getSessionAttribute(request, "userSession"); logger.info("Gamequeue shown for member id = " + userSession.getMemberId()); QuestionData q = (QuestionData) WebUtils.getSessionAttribute(request, "qsess"); if (q != null) { logger.debug("Got question from session"); Boolean isVerified = null; try { isVerified = ServletRequestUtils.getBooleanParameter(request, "verified"); } catch (ServletRequestBindingException e) { logger.warn("make question session entered without verified? Clear session"); } if (isVerified != null) { model.addAttribute("verified", isVerified); } else { // has session, but not an edit (no verified flag). Clear session and go through normal processing q=null; } } if (q == null) { PlayerData player = playerService.findPlayer(userSession.getGameId(), userSession.getMemberId()); List<QuestionData> qqs = playerService.getQueuedQuestions(player.getId()); if (qqs.size() > 0) { q = qqs.get(0); logger.debug("Got queued question."); } else { logger.debug("Creating question as none in session or id."); q = new QuestionData(); } } model.addAttribute("question", q); logger.debug("================> qid="+q.getId()); return "game/gameQueue"; }
@RequestMapping(value = "/{tascaId}/guardar", method = RequestMethod.POST) public String guardar( HttpServletRequest request, @PathVariable String tascaId, @Valid @ModelAttribute("command") Object command, BindingResult result, SessionStatus status, Model model) { List<TascaDadaDto> tascaDades = tascaService.findDades(tascaId); //afegirVariablesInstanciaProces(tascaDades, tascaId); TascaFormValidatorHelper validator = new TascaFormValidatorHelper( tascaService, tascaDades); Map<String, Object> variables = TascaFormHelper.getValorsFromCommand( tascaDades, command, false); guardarForm( validator, variables, command, result, request, tascaId); status.setComplete(); return mostrarInformacioTascaPerPipelles( request, tascaId, model, null); }
@RequestMapping(value = { "/{tascaId}/accio", "/{tascaId}/form/accio" }, method = RequestMethod.POST) public String accio( HttpServletRequest request, @PathVariable String tascaId, @RequestParam(value = "accioCamp", required = true) String accioCamp, @ModelAttribute("command") Object command, BindingResult result, SessionStatus status, Model model) { List<TascaDadaDto> tascaDades = tascaService.findDades(tascaId); //afegirVariablesInstanciaProces(tascaDades, tascaId); TascaFormValidatorHelper validator = new TascaFormValidatorHelper( tascaService, tascaDades); Map<String, Object> variables = TascaFormHelper.getValorsFromCommand( tascaDades, command, false); boolean guardado = guardarForm( validator, variables, command, result, request, tascaId); status.setComplete(); if (guardado && accioExecutarAccio(request, tascaId, accioCamp)) { model.addAttribute("campFocus", accioCamp); } return mostrarInformacioTascaPerPipelles( request, tascaId, model, "form"); }