Пример #1
0
  @RequestMapping(value = "/comment/save", method = RequestMethod.POST)
  public String save(
      Model model,
      @RequestParam(value = "idCommente") Long idComment,
      @RequestParam(value = "Description") String description,
      HttpServletRequest request) {
    Comment comment = ICommenteMetier.findOne(idComment);
    Calendar calendar = Calendar.getInstance();
    Date date = calendar.getTime();
    ICommenteMetier.update(idComment, description, date);

    Long taskId = comment.getTask().getIdTask();

    String url = (String) request.getSession().getAttribute("url");
    if (url.equals("/tunisie/taskDetail")) {

      return "redirect:/taskDetail?idTask=" + taskId;
    } else return "redirect:/taskPerDetail?idTask=" + taskId;
  }
Пример #2
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;
  }
Пример #3
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;
  }
Пример #4
0
 @RequestMapping(value = "/comment/edit")
 public String add(Model model, @RequestParam(value = "id") Long idCommente) {
   Comment comment = ICommenteMetier.findOne(idCommente);
   model.addAttribute("comment", comment);
   return "comment.edit";
 }