Ejemplo n.º 1
0
 public String getCommentStr() {
   return StringUtils.maxLenString(getComment(), 23, 20, "...");
 }
Ejemplo n.º 2
0
  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;
    }
  }