@RequestMapping(value = "delete/{id}", method = RequestMethod.GET) public String deleteDCTAPById(@PathVariable String id, Model model) { DemandeValidationConsoTempsAccPers currentDctap = manager.getDVCTAPById(Long.valueOf(id)); // Test que la DCTAP appartient à la bonne personne if (currentDctap.getEleve().equals(UtilSession.getUserInSession())) { currentDctap.setDctapAnnule(); manager.updateDVCTAP(currentDctap); } return "redirect:/app/eleve/mesdctap"; }
@RequestMapping(value = "refuse/{id}", method = RequestMethod.GET) public String refuseDCTAPById(@PathVariable String id, Model model) { DemandeValidationConsoTempsAccPers dctap = manager.getDVCTAPById(Long.valueOf(id)); // Test que la DCTAP appartient à la bonne personne if (dctap.getEleve().equals(UtilSession.getUserInSession()) && dctap.getEtat() > 1023) { try { dctap.transitionRejeteeParEleve(); manager.updateDVCTAP(dctap); } catch (DVCTAPException e) { // TODO redirect error view } } return "redirect:/app/eleve/mesdctap"; }
@RequestMapping(value = "edit", method = RequestMethod.GET) public String editDCTAPById( @RequestParam("id") String id, FormDemandeConsoTempsAccPers formDctap, Model model) { // System.out.println("TEST id recu :" + formDctap.getId()); DemandeValidationConsoTempsAccPers currentDctap = manager.getDVCTAPById(Long.valueOf(id)); System.out.println("DCTAP : " + currentDctap); // valorise le bean de vue avec le dctap courant formDctap.setId(currentDctap.getId()); // en provenance d'un champ caché formDctap.setDateAction(currentDctap.getDateAction()); formDctap.setProfId(currentDctap.getProf().getId()); // formDctap.setProfNom(currentDctap.getProf().getNom()); formDctap.setIdEleve(currentDctap.getEleve().getId()); formDctap.setAccPersId(currentDctap.getAccPers().getId()); formDctap.setMinutes(currentDctap.getMinutes()); model.addAttribute("minute", currentDctap.getMinutes()); model.addAttribute("lesProfs", manager.getAllProf()); model.addAttribute("etat", manager.getDVCTAPById(formDctap.getId()).getEtat()); model.addAttribute("lesAP", manager.getAllAPForEleve()); return "eleve/edit"; }