/**
   * Initial controller method, when the user lands on the page /admin/messageReport. By default is
   * loaded the messageReportList based on the current date - 7 days> and the current date
   *
   * @param model controller object for binding variables into the view template
   * @return renders the msgRep view -> /freemarker/msgRep.ftl
   */
  @RequestMapping(value = "/messageReport", method = RequestMethod.GET)
  public String showMessageReport(@ModelAttribute("model") ModelMap model) {

    List<TransformedMessageDto> messageReportList =
        transformToView(
            msgReportService.getMessageStateSummary(getDateForQuery(7), getDateForQuery(0)));

    model.addAttribute("msgreplist", messageReportList);
    return "msgRep";
  }
  /**
   * Renders the view with the object List {@link TransformedMessageDto} based on a time span data
   * from the user.
   *
   * @param startDate user-input from the web form
   * @param endDate user-input from the web form
   * @param model controller object for binding variables into the view template
   * @return renders the updated msgRep view -> /freemarker/msgRep.ftl
   */
  @RequestMapping(value = "/updatereport", method = RequestMethod.POST)
  public String updateMessageReport(
      @RequestParam("formStartDate") String startDate,
      @RequestParam("formEndDate") String endDate,
      @ModelAttribute("model") ModelMap model) {

    Assert.notNull(startDate, "startDate on updateReport must be defined");
    Assert.notNull(endDate, "endDate on updateReport must be defined");

    List<TransformedMessageDto> messageReportList =
        transformToView(
            msgReportService.getMessageStateSummary(
                formatDateForQuery(startDate), formatDateForQuery(endDate)));

    model.addAttribute("reqStartDate", startDate);
    model.addAttribute("reqEndDate", endDate);
    model.addAttribute("msgreplist", messageReportList);
    return "msgRep";
  }