protected ModelAndView handleRequestInternal(
      HttpServletRequest request, HttpServletResponse response) throws Exception {
    logger.debug("handleRequestInternal - START ");

    // used as a container for error messages
    ArrayList<String> errorMessages = new ArrayList<String>();

    ModelAndView mav = new ModelAndView(getView());

    // the user that logs in
    UserAuth userAuth =
        (UserAuth) SecurityContextHolder.getContext().getAuthentication().getPrincipal();

    // adding to model the time unit nomenclator
    mav.addObject(IConstant.NOM_TIME_UNIT, TSContext.getFromContext(IConstant.NOM_TIME_UNIT));

    try {
      // add the organization available currencies
      List<Currency> currencies =
          BLCurrency.getInstance().getByOrganizationId(userAuth.getOrganisationId());
      if (currencies != null && currencies.size() > 0) {
        List<IntString> nomCurrencies = new ArrayList<IntString>();
        for (Currency currency : currencies) {
          IntString entry = new IntString();
          entry.setValue(currency.getCurrencyId());
          entry.setLabel(currency.getName());
          nomCurrencies.add(entry);
        }
        mav.addObject(ORG_CURRENCIES, nomCurrencies);
      }

      // if the view will be rendered in a panel we display only some fields
      request.setAttribute(GET_FROM_PANEL, request.getParameter(GET_FROM_PANEL));

    } catch (BusinessException bexc) {
      logger.error(bexc.getMessage(), bexc);
      errorMessages.add(
          messageSource.getMessage(
              GET_ORG_CURRENCIES_ERROR,
              new Object[] {
                bexc.getCode(), ControllerUtils.getInstance().getFormattedCurrentTime()
              },
              RequestContextUtils.getLocale(request)));
    }

    setErrors(request, errorMessages);

    logger.debug("handleRequestInternal - END ");

    return mav;
  }
  @Override
  protected Map referenceData(HttpServletRequest request, Object command, Errors errors) {
    logger.debug("referenceData - START");
    Map map = new HashMap();
    ArrayList<String> errorMessages = new ArrayList<String>();
    UserAuth userAuth =
        (UserAuth) SecurityContextHolder.getContext().getAuthentication().getPrincipal();

    try {
      // adding to model the results per page for search results
      map.put(
          IConstant.NOM_RESULTS_PER_PAGE, TSContext.getFromContext(IConstant.NOM_RESULTS_PER_PAGE));
    } catch (Exception e) {
      logger.error("referenceData", e);
      errorMessages.add(
          messageSource.getMessage(
              GENERAL_ERROR,
              new Object[] {null, ControllerUtils.getInstance().getFormattedCurrentTime()},
              RequestContextUtils.getLocale(request)));
    }

    try {
      // add the organization available currencies
      List<Currency> currencies =
          BLCurrency.getInstance().getByOrganizationId(userAuth.getOrganisationId());
      if (currencies != null) {
        List<IntString> nomCurrencies = new ArrayList<IntString>();
        for (Currency currency : currencies) {
          IntString entry = new IntString();
          entry.setValue(currency.getCurrencyId());
          entry.setLabel(currency.getName());
          nomCurrencies.add(entry);
        }
        map.put(ORG_CURRENCIES, nomCurrencies);
      }
    } catch (BusinessException bexc) {
      logger.error(bexc.getMessage(), bexc);
      errorMessages.add(
          messageSource.getMessage(
              GET_ORG_CURRENCIES_ERROR,
              new Object[] {
                bexc.getCode(), ControllerUtils.getInstance().getFormattedCurrentTime()
              },
              RequestContextUtils.getLocale(request)));
    }

    try {
      // adding the user's available project for search;
      // if the user has the USER_ALL role, all its organization's projects will be available
      List<Project> projects = null;
      if (userAuth.hasAuthority(PermissionConstant.getInstance().getTS_ExchangeSearchAll())) {
        projects = BLProject.getInstance().getAllProjects(userAuth.getOrganisationId(), true);
      } else {
        projects = BLProject.getInstance().getProjectsByManager(userAuth.getPersonId(), true, true);
      }
      map.put(USER_PROJECTS, projects);
      if (projects != null && projects.size() > 0) {
        map.put(IS_PM_FOR_AT_LEAST_ONE_PROJECT, new Boolean(true));
      } else {
        map.put(IS_PM_FOR_AT_LEAST_ONE_PROJECT, new Boolean(false));
      }
    } catch (BusinessException be) {
      logger.error(be.getMessage(), be);
      errorMessages.add(
          messageSource.getMessage(
              GET_USER_PROJECTS_ERROR,
              new Object[] {be.getCode(), ControllerUtils.getInstance().getFormattedCurrentTime()},
              RequestContextUtils.getLocale(request)));
    }

    setErrors(request, errorMessages);
    logger.debug("referenceData - END");
    return map;
  }