コード例 #1
0
  public ModelAndView raiseInterest(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    if (logger.isDebugEnabled()) {
      logger.debug("raiseInterest(HttpServletRequest, HttpServletResponse) - start");
    }

    ProjectVo projectVo = (ProjectVo) modelAndView.getModel().get("projectVo");

    if (logger.isDebugEnabled()) {
      logger.debug(
          "raiseInterest(HttpServletRequest, HttpServletResponse) - @@@@@@@@@@@@@@raiseInterest@@@@@@@@@:"
              + projectVo.getPrjId());
    }

    ProjectInterestVo projectInterestVo = new ProjectInterestVo();
    projectInterestVo.setPrjId(projectVo.getPrjId());

    String loginId = UserUtil.getUserSessionInfoVo().getUserID();

    List<ProjectInterestVo> projectInterestVos =
        projectInterestService.getProjectInterestListbyProjectIdAndUserId(
            projectVo.getPrjId(), loginId);

    if (projectInterestVos.size() == 0) {

      projectInterestService.createProjectInterest(projectInterestVo);

      if (logger.isDebugEnabled()) {
        logger.debug(
            "raiseInterest(HttpServletRequest, HttpServletResponse) - @@@@@@@@@@@@@@successfully raise new project interest@@@@@@@@@:"
                + projectVo.getPrjId());
      }

      modelAndView.addObject(
          "riMsg",
          Messages.getString("message.common.submit.msg", new String[] {"Project Interest"}));

    } else {

      modelAndView.addObject(
          "riMsg",
          Messages.getString("message.common.submit.adi.msg", new String[] {"Project Interest"}));
    }

    if (logger.isDebugEnabled()) {
      logger.debug("raiseInterest(HttpServletRequest, HttpServletResponse) - end");
    }
    return modelAndView;
  }
コード例 #2
0
  public ModelAndView requestCertificate(HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    if (logger.isDebugEnabled()) {
      logger.debug("requestCertificate(HttpServletRequest, HttpServletResponse) - start");
    }

    ProjectVo projectVo = (ProjectVo) modelAndView.getModel().get("projectVo");

    if (logger.isDebugEnabled()) {
      logger.debug(
          "requestCertificate(HttpServletRequest, HttpServletResponse) - @@@@@@@@@@@@@@requestCertificate@@@@@@@@@: "
              + projectVo.getPrjId());
    }

    String loginId = UserUtil.getUserSessionInfoVo().getUserID();

    List<CertificateRequestVo> certificateRequestDtos =
        certificateManagementService.getCertificateRequestsbyProject(projectVo.getPrjId(), loginId);

    if (certificateRequestDtos.size() == 0) {

      certificateManagementService.createIndividualCertificateRequest(projectVo.getPrjId());
      modelAndView.addObject(
          "riMsg",
          Messages.getString("message.common.submit.msg", new String[] {"Certificate Request"}));
    } else {
      modelAndView.addObject(
          "riMsg",
          Messages.getString(
              "message.common.submit.adi.msg", new String[] {"Certificate Request"}));
    }

    if (logger.isDebugEnabled()) {
      logger.debug(
          "requestCertificate(HttpServletRequest, HttpServletResponse) - @@@@@@@@@@@@@@successfully reqCertifictae@@@@@@@@@:"
              + projectVo.getPrjId());
      logger.debug("requestCertificate(HttpServletRequest, HttpServletResponse) - start");
    }

    return modelAndView;
  }
コード例 #3
0
  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;
    }
  }