示例#1
0
  @RequestMapping(value = "/suppComment", method = RequestMethod.GET)
  public String deleteCommente(
      @ModelAttribute("SpringWeb") UserModel UserModel,
      ModelMap model,
      @RequestParam Long idCommente,
      HttpServletRequest request) {

    ICommenteMetier.delete(idCommente);
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    String username = auth.getName();
    request.getSession().setAttribute("username", username);
    Long idUser = IUserMetier.findByusername(username);
    model.addAttribute("user", IUserMetier.findOne(idUser));
    model.addAttribute("messageAll", IMessageMetier.findAllByIdUser(idUser));
    long idTask = (Long) request.getSession().getAttribute("idTask");
    String url = (String) request.getSession().getAttribute("url");
    if (url.equals("/tunisie/taskDetail")) {

      return "redirect:/taskDetail?idTask=" + idTask;
    } else return "redirect:/taskPerDetail?idTask=" + idTask;
  }
示例#2
0
  @RequestMapping(value = "/saveComment", method = RequestMethod.POST)
  public String saveCommentProjet(
      @ModelAttribute("SpringWeb") CommentModel CommenteModel,
      Model model,
      HttpServletRequest request) {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    String username = auth.getName();
    request.getSession().setAttribute("username", username);
    Long idUser = IUserMetier.findByusername(username);
    model.addAttribute("user", IUserMetier.findOne(idUser));
    model.addAttribute("messageAll", IMessageMetier.findAllByIdUser(idUser));
    long idTask = (Long) request.getSession().getAttribute("idTask");

    Calendar calendar = Calendar.getInstance();
    Date date = calendar.getTime();
    ICommenteMetier.save(CommenteModel.getDescription(), idTask, idUser, date);
    String url = (String) request.getSession().getAttribute("url");
    if (url.equals("/tunisie/taskDetail")) {

      return "redirect:/taskDetail?idTask=" + idTask;
    } else return "redirect:/taskPerDetail?idTask=" + idTask;
  }