示例#1
0
  public ActionForward save(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);

    DynaActionForm dform = (DynaActionForm) form;
    Episode episode = (Episode) dform.get("episode");
    Integer id = null;
    try {
      id = Integer.parseInt(request.getParameter("episode.id"));
    } catch (NumberFormatException e) {
      /*empty*/
    }
    Episode e = null;
    if (id != null && id.intValue() > 0) {
      e = episodeDao.find(Integer.valueOf(id));
    } else {
      e = new Episode();
    }
    BeanUtils.copyProperties(episode, e, new String[] {"id", "lastUpdateTime", "lastUpdateUser"});
    e.setLastUpdateUser(loggedInInfo.getLoggedInProviderNo());

    if (!securityInfoManager.hasPrivilege(
        LoggedInInfo.getLoggedInInfoFromSession(request),
        "_demographic",
        "w",
        e.getDemographicNo())) {
      throw new SecurityException("missing required security object (_demographic)");
    }

    if (id != null && id.intValue() > 0) {
      episodeDao.merge(e);
    } else {
      episodeDao.persist(e);
    }
    request.setAttribute("parentAjaxId", "episode");
    return mapping.findForward("success");
  }
示例#2
0
  public ActionForward list(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    Integer demographicNo = Integer.parseInt(request.getParameter("demographicNo"));

    if (!securityInfoManager.hasPrivilege(
        LoggedInInfo.getLoggedInInfoFromSession(request), "_demographic", "r", demographicNo)) {
      throw new SecurityException("missing required security object (_demographic)");
    }

    List<Episode> episodes = episodeDao.findAll(demographicNo);
    request.setAttribute("episodes", episodes);
    return mapping.findForward("list");
  }
示例#3
0
  public ActionForward edit(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    String id = request.getParameter("episode.id");

    if (id != null) {
      Episode e = episodeDao.find(Integer.valueOf(id));
      request.setAttribute("episode", e);
    }

    String[] codingSystems =
        OscarProperties.getInstance().getProperty("dxResearch_coding_sys", "").split(",");
    List<String> cs = Arrays.asList(codingSystems);
    request.setAttribute("codingSystems", cs);
    request.setAttribute("demographicNo", request.getParameter("demographicNo"));
    return mapping.findForward("form");
  }
  public boolean getInfo(
      EctSessionBean bean,
      HttpServletRequest request,
      NavBarDisplayDAO Dao,
      MessageResources messages) {
    boolean a = true;
    Vector v = OscarRoleObjectPrivilege.getPrivilegeProp("_newCasemgmt.episode");
    String roleName =
        (String) request.getSession().getAttribute("userrole")
            + ","
            + (String) request.getSession().getAttribute("user");
    a = OscarRoleObjectPrivilege.checkPrivilege(roleName, (Properties) v.get(0), (Vector) v.get(1));
    a = true;
    if (!a) {
      return true;
    } else {
      try {
        String appointmentNo = request.getParameter("appointment_no");

        // Set lefthand module heading and link
        String winName = "episode" + bean.demographicNo;
        String pathview, pathedit;

        pathview =
            request.getContextPath()
                + "/Episode.do?method=list&demographicNo="
                + bean.demographicNo;
        pathedit =
            request.getContextPath()
                + "/Episode.do?method=edit&demographicNo="
                + bean.demographicNo;

        String url = "popupPage(500,900,'" + winName + "','" + pathview + "')";
        Dao.setLeftHeading(messages.getMessage(request.getLocale(), "global.episode"));
        Dao.setLeftURL(url);

        // set right hand heading link
        winName = "AddEpisode" + bean.demographicNo;
        url = "popupPage(500,600,'" + winName + "','" + pathedit + "'); return false;";
        Dao.setRightURL(url);
        Dao.setRightHeadingID(cmd);

        EpisodeDao episodeDao = SpringUtils.getBean(EpisodeDao.class);
        List<Episode> episodes = episodeDao.findAllCurrent(Integer.parseInt(bean.demographicNo));

        for (Episode episode : episodes) {
          NavBarDisplayDAO.Item item = NavBarDisplayDAO.Item();
          String itemHeader =
              StringUtils.maxLenString(
                  episode.getDescription(), MAX_LEN_TITLE, CROP_LEN_TITLE, ELLIPSES);
          item.setLinkTitle(itemHeader);
          item.setTitle(itemHeader);
          item.setDate(episode.getStartDate());
          int hash = Math.abs(winName.hashCode());
          url =
              "popupPage(500,900,'"
                  + hash
                  + "','"
                  + request.getContextPath()
                  + "/Episode.do?method=edit&episode.id="
                  + episode.getId()
                  + "'); return false;";
          item.setURL(url);
          Dao.addItem(item);
        }

      } catch (Exception e) {
        MiscUtils.getLogger().error("Error", e);
        return false;
      }
      return true;
    }
  }