public ModelAndView searchProjects(
      HttpServletRequest request, HttpServletResponse response, ProjectVo command)
      throws Exception {

    if (logger.isDebugEnabled()) {
      logger.debug("searchProjects(HttpServletRequest, HttpServletResponse, ProjectVo) - start");
    }

    modelAndView = new ModelAndView("volunteer/viewProjectList"); // jsp page
    List<CodeLookupVo> projectCodeList =
        CodeLookupUtil.getCodeListByCategory(VMSConstants.PROJECT_STATUS);

    modelAndView.addObject("projectCodeList", projectCodeList);

    List<ProjectVo> projectList = projectManagementService.getProjectsbyProjectVo(command);
    logger.debug("The project size is" + projectList.size());
    modelAndView.addObject("projectList", projectList);
    modelAndView.addObject("command", command);

    PagedListHolder projectPagedListHolder = new PagedListHolder(projectList);
    if (!projectList.isEmpty()) {
      int page = ServletRequestUtils.getIntParameter(request, "p", 0);
      projectPagedListHolder.setPage(page);
      projectPagedListHolder.setPageSize(VMSConstants.MAX_PAGE_SIZE);
    }
    modelAndView.addObject("pagedListHolder", projectPagedListHolder);

    if (logger.isDebugEnabled()) {
      logger.debug("searchProjects(HttpServletRequest, HttpServletResponse, ProjectVo) - end");
    }
    return modelAndView;
  }
  public ModelAndView viewProjectDetails(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    if (logger.isDebugEnabled()) {
      logger.debug("viewProjectDetails(HttpServletRequest, HttpServletResponse) - start");
    }

    long prjId = Long.parseLong(request.getParameter("prjId"));

    if (prjId <= 0) {
      if (logger.isDebugEnabled()) {
        logger.debug("viewProjectDetails(HttpServletRequest, HttpServletResponse) - end");
      }
      return modelAndView;
    }
    ProjectVo projectVo = projectManagementService.getProjectbyId(prjId);

    List<CodeLookupVo> roleCodeList =
        CodeLookupUtil.getCodeListByCategory(VMSConstants.MEMBER_ROLE);

    List<ProjectMemberVo> memberList =
        memberManagementService.getMemberListbyProject(projectVo.getPrjId());

    List<ProjectExperienceVo> experienceList =
        projectExperienceService.getProjectExperienceListbyProjectId(projectVo.getPrjId());
    List<ProjectFeedbackVo> feedbackList =
        projectFeedbackService.getProjectFeedbackListbyProjectId(projectVo.getPrjId());
    modelAndView = new ModelAndView("volunteer/viewProject");

    PagedListHolder feedbackPagedListHolder = new PagedListHolder(feedbackList);
    if (!feedbackList.isEmpty()) {
      int page = ServletRequestUtils.getIntParameter(request, "p1", 0);
      feedbackPagedListHolder.setPage(page);
      feedbackPagedListHolder.setPageSize(100);
    }

    PagedListHolder exPagedListHolder = new PagedListHolder(experienceList);
    if (!experienceList.isEmpty()) {
      int page = ServletRequestUtils.getIntParameter(request, "p2", 0);
      exPagedListHolder.setPage(page);
      exPagedListHolder.setPageSize(100);
    }

    modelAndView.addObject("fbPagedListHolder", feedbackPagedListHolder);

    modelAndView.addObject("exPagedListHolder", exPagedListHolder);

    modelAndView.addObject("projectVo", projectVo);
    modelAndView.addObject("memberList", memberList);

    modelAndView.addObject("feedbackVo", new ProjectFeedbackVo());

    modelAndView.addObject("experienceVo", new ProjectExperienceVo());

    for (ProjectMemberVo projectMemberVo : memberList) {
      for (CodeLookupVo codeLookupVo : roleCodeList) {
        if (codeLookupVo.getCdId().equals(Long.valueOf(projectMemberVo.getRoleCd()))) {
          projectMemberVo.setRoleCd(codeLookupVo.getVal());
          break;
        }
      }
    }

    if (logger.isDebugEnabled()) {
      logger.debug(
          "viewProjectDetails(HttpServletRequest, HttpServletResponse) - Total memebr:"
              + memberList.size());
      logger.debug("viewProjectDetails(HttpServletRequest, HttpServletResponse) - end");
    }

    return modelAndView;
  }
  public ModelAndView updateVolunteer(
      HttpServletRequest request, HttpServletResponse response, VolunteerVo command)
      throws Exception {
    if (logger.isDebugEnabled()) {
      logger.debug("updateVolunteer(HttpServletRequest, HttpServletResponse, VolunteerVo) - start");
    }

    // TODO: get current login volunteer
    if (command.getLoginId() == null) {
      VolunteerVo volunteer =
          volunteerManagementService.getVolunteer(UserUtil.getUserSessionInfoVo().getUserID());

      // TODO: Update Session User
      modelAndView = new ModelAndView("volunteer/updateProfile");
      // page
      modelAndView.addObject(
          "titleList", CodeLookupUtil.getCodeListByCategory(VMSConstants.TITLE_CATEGORY));
      modelAndView.addObject(
          "countryList", CodeLookupUtil.getCodeListByCategory(VMSConstants.COUNTRY_CATEGORY));
      // volunteer.setCmdType(VMSConstants.SCREEN_CMD_UPDATE);
      modelAndView.addObject("command", volunteer);

      if (logger.isDebugEnabled()) {
        logger.debug("updateVolunteer(HttpServletRequest, HttpServletResponse, VolunteerVo) - end");
      }
      return modelAndView;
    } else {
      validate(command);
      modelAndView = new ModelAndView("volunteer/updateProfile");
      modelAndView.addObject(
          "titleList", CodeLookupUtil.getCodeListByCategory(VMSConstants.TITLE_CATEGORY));
      modelAndView.addObject(
          "countryList", CodeLookupUtil.getCodeListByCategory(VMSConstants.COUNTRY_CATEGORY));
      VolunteerVo volunteerVo = command;
      if (errors.hasErrors()) {
        logger.debug(
            "updateVolunteer(HttpServletRequest, HttpServletResponse, VolunteerVo) - Error Handling : ");
        saveError(request, errors.getFieldError().getDefaultMessage());
        modelAndView.addObject("command", volunteerVo);

        if (logger.isDebugEnabled()) {
          logger.debug(
              "updateVolunteer(HttpServletRequest, HttpServletResponse, VolunteerVo) - end");
        }
        return modelAndView;
      }

      try {
        volunteerManagementService.updateVolunteer(volunteerVo);
        // once updated, update the user session info vo to reflect the
        // changes
        UserSessionInfoVo userSessionInfoVo = UserUtil.getUserSessionInfoVo();
        userSessionInfoVo.setEmail(volunteerVo.getEmail());
        userSessionInfoVo.setName(volunteerVo.getNme());
        request
            .getSession()
            .setAttribute(
                (Messages.getString("AuthorisationFilter.SESSION_USER_SESSION_INFO_VO_ATTR_NME")),
                userSessionInfoVo);

        volunteerVo =
            volunteerManagementService.getVolunteer(UserUtil.getUserSessionInfoVo().getUserID());

      } catch (ApplicationException ae) {
        logger.error("updateVolunteer(HttpServletRequest, HttpServletResponse, VolunteerVo)", ae);

        List list = new ArrayList();
        list.add(ae.getMessage());
        modelAndView.addObject("errors", list);
        modelAndView.addObject("command", volunteerVo);

        if (logger.isDebugEnabled()) {
          logger.debug(
              "updateVolunteer(HttpServletRequest, HttpServletResponse, VolunteerVo) - end");
        }
        return modelAndView;
      }
      volunteerVo.setCmdType(VMSConstants.SCREEN_CMD_UPDATE);
      modelAndView.addObject("command", volunteerVo);
      modelAndView.addObject("msg", Messages.getString("message.common.save"));

      if (logger.isDebugEnabled()) {
        logger.debug("updateVolunteer(HttpServletRequest, HttpServletResponse, VolunteerVo) - end");
      }
      return modelAndView;
    }
  }