Ejemplo n.º 1
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");
  }
Ejemplo n.º 2
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");
  }