Exemplo n.º 1
0
  /* (非 Javadoc)
   * @see jp.go.jsps.kaken.web.struts.BaseAction#doMainProcessing(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, jp.go.jsps.kaken.web.common.UserContainer)
   */
  public ActionForward doMainProcessing(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response,
      UserContainer container)
      throws ApplicationException {

    // -----ActionErrorsの宣言(定型処理)-----
    ActionErrors errors = new ActionErrors();

    // 検索条件があればクリアする。
    removeFormBean(mapping, request);

    // 検索条件をフォームをセットする。
    ShozokuSearchForm searchForm = new ShozokuSearchForm();

    // ------プルダウンデータセット
    searchForm.setShubetuCdList(LabelValueManager.getKikanShubetuCdList()); // 機関種別リスト
    searchForm.setBukyokuSearchFlgList(
        LabelValueManager.getBukyokuSearchFlgList()); // 部局担当者検索フラグリスト

    updateFormBean(mapping, request, searchForm);

    // -----画面遷移(定型処理)-----
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return forwardFailure(mapping);
    }
    return forwardSuccess(mapping);
  }
 /**
  * Override to provide population of current form with request parameters when validation fails.
  *
  * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping,
  *     javax.servlet.http.HttpServletRequest)
  */
 public org.apache.struts.action.ActionErrors validate(
     org.apache.struts.action.ActionMapping mapping,
     javax.servlet.http.HttpServletRequest request) {
   final org.apache.struts.action.ActionErrors errors = super.validate(mapping, request);
   if (errors != null && !errors.isEmpty()) {
     // we populate the current form with only the request parameters
     Object currentForm = request.getSession().getAttribute("form");
     // if we can't get the 'form' from the session, try from the request
     if (currentForm == null) {
       currentForm = request.getAttribute("form");
     }
     if (currentForm != null) {
       final java.util.Map parameters = new java.util.HashMap();
       for (final java.util.Enumeration names = request.getParameterNames();
           names.hasMoreElements(); ) {
         final String name = String.valueOf(names.nextElement());
         parameters.put(name, request.getParameter(name));
       }
       try {
         org.apache.commons.beanutils.BeanUtils.populate(currentForm, parameters);
       } catch (java.lang.Exception populateException) {
         // ignore if we have an exception here (we just don't populate).
       }
     }
   }
   return errors;
 }
  /**
   * Gobal Action, this action prepares to show glAcctDefaultList.JSP. The form Allows the operator
   * to select the account to be modified or click add or delete.
   */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws javax.servlet.ServletException, java.io.IOException {
    // AppLog.trace("ShowGlAccountDefaultList action doPerfrom");
    ActionErrors errors = new ActionErrors();
    HttpSession session = request.getSession();
    DbUserSession sessionUser = SessionHelpers.getUserSession(request);
    if (sessionUser == null) {
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.login.invalid"));
    }
    try {
      // Set collections in session
      SessionHelpers.setGlAccountDefaultListInSession(request);
    } catch (PersistenceException pe) {
      logger.error("Persistence Exception in ShowGlAccountDefaultList.doPerform. " + pe);
      errors.add(
          ActionErrors.GLOBAL_ERROR, new ActionError("error.PersistenceException", pe.getCause()));
    } catch (Exception pe) {
      logger.error("Exception in  ShowGlAccountDefaultList.doPerform. ", pe);
      errors.add(
          ActionErrors.GLOBAL_ERROR, new ActionError("error.GeneralException", pe.getMessage()));
    }
    // Check for any errors so far
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
    }

    return mapping.findForward("showGlAcctDefaultListJsp");
  }
Exemplo n.º 4
0
  /**
   * <br>
   * [機 能] 削除(TODO情報)ボタンクリック時の入力チェックを行う <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param con コネクション
   * @param buMdl セッションユーザ情報
   * @param reqMdl RequestModel
   * @return エラー
   * @throws SQLException SQL実行例外
   */
  public ActionErrors validateDelTodo(Connection con, BaseUserModel buMdl, RequestModel reqMdl)
      throws SQLException {

    ActionErrors errors = new ActionErrors();
    ActionMessage msg = null;
    GsMessage gsMsg = new GsMessage(reqMdl);
    // 削除
    String textDelete = gsMsg.getMessage("cmn.delete");
    PrjCommonBiz pcBiz = new PrjCommonBiz(con, gsMsg, reqMdl);
    if (!pcBiz.getTodoEditKengen(getPrj030prjSid(), buMdl)) {
      msg = new ActionMessage("error.not.edit.permissions.project", textDelete);
      StrutsUtil.addMessage(
          errors, msg, "prj030selectEditStatus.error.not.edit.permissions.project");
      return errors;
    }

    // 選択されたTODO
    if (prj030selectTodo__ == null || prj030selectTodo__.length < 1) {
      msg = new ActionMessage("error.select.required.text", GSConstProject.MSG_TODO);
      StrutsUtil.addMessage(errors, msg, "prj030selectTodo.error.select.required.text");
    }

    if (errors.isEmpty()) {
      List<Integer> prjSidList = new ArrayList<Integer>();
      prjSidList.add(getPrj030prjSid());

      validateCanEditTodo(errors, con, buMdl, prjSidList, "prj030selectTodo", textDelete, reqMdl);
    }

    return errors;
  }
Exemplo n.º 5
0
  public ActionForward editEscalation(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward(); // return value
    boolean editSuccess = false;
    String flag = null;

    try {
      HttpSession session = request.getSession(false);
      UserDetailsDTO userDetails = (UserDetailsDTO) session.getAttribute("USER_INFO");

      EscalationForm escalationForm = (EscalationForm) form;
      String requestNo = escalationForm.getWorkflow_escalation_id();
      System.out.println("EDIT ACTION------------" + requestNo);

      if (escalationForm != null) {
        String userName = userDetails.getUserLoginId();
        escalationForm.setModified_by(userName);

        EscalationDTO escalationDTO = new EscalationDTO();
        EscalationDao escalationDaoImpl = new EscalationDaoImpl();
        BeanUtils.copyProperties(escalationDTO, escalationForm);

        editSuccess = escalationDaoImpl.editEscalation(escalationDTO, requestNo);

        if (editSuccess == true) {
          flag = "editsuccessful";
          request.setAttribute("editSuccess", flag);
          request.setAttribute("escalationID", requestNo);
          request.setAttribute("escalationType", escalationDTO.getEscalation_type());
        }
      }
    } catch (Exception exp) {
      errors.add("editCategory", new ActionError(""));
      saveErrors(request, errors);
      return mapping.findForward("InitEditEscalation");
    }
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      // Forward control to the appropriate 'failure' URI (change name as desired)
      forward = mapping.findForward("EditEscalation");
    } else {
      // Forward control to the appropriate 'success' URI (change name as desired)
      errors.add("editCategory", new ActionError("message.success"));
      saveErrors(request, errors);
      forward = mapping.findForward("EditEscalationSuccess");
      request.setAttribute("errorFlag", "1");
    }
    // Finish with
    return (forward);
  }
  public ActionForward submit(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws IOException, ServletException {

    if (form instanceof MaintenanceRequestForm) {
      ActionMessages messages = new ActionMessages();
      MaintenanceRequestForm maintenfrm = (MaintenanceRequestForm) form;
      ActionErrors actionErrors = maintenfrm.validate(mapping, request);
      if (actionErrors.isEmpty()) {
        Long aptid = (Long) request.getSession().getAttribute("aptID");
        try {

          MaintenanceRequestDAO maintenanceRequestDAO = new MaintenanceRequestDAO();
          MaintenanceRequest maintenanceRequest = new MaintenanceRequest();

          maintenanceRequest =
              this.mapFormToVO(
                  maintenfrm,
                  maintenanceRequest,
                  aptid,
                  (String) request.getSession().getAttribute("userName"));
          maintenanceRequestDAO.save(maintenanceRequest);

          CreateMaintenceRequest createMaintenceRequest =
              new CreateMaintenceRequest(
                  maintenanceRequest, (Long) request.getSession().getAttribute("userId"));
          createMaintenceRequest.execute();
          CreateMaintenceRequestSMS createMaintenceRequestSMS =
              new CreateMaintenceRequestSMS(
                  maintenanceRequest, (Long) request.getSession().getAttribute("userId"));
          createMaintenceRequestSMS.execute();
          reset(mapping, request);
          messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("main.Updated"));
          saveMessages(request, messages);
          request.setAttribute("message", "message");
          maintenfrm.setMaintenanceLocation("");
          maintenfrm.setMaintenanceRequest("");
          maintenfrm.setDescription("");
          maintenfrm.setPermission(false);
          return mapping.findForward("success");

        } catch (Exception e) {
          log.error(e.getMessage(), e);
        }
      } else {
        saveErrors(request, actionErrors);
        return mapping.findForward("input");
      }
    }

    return mapping.findForward("input");
  }
  /**
   * Ejecuta la validacion en la p\u00E1gina JSP <code>redactarMail.jsp</code>
   *
   * @param mapping El mapeo utilizado para seleccionar esta instancia
   * @param request La petici\u00F3n que se est\u00E1 procesando
   * @return errors Coleccion de errores producidos por la validaci\u00F3n, si no hubieron errores
   *     se retorna <code>null</code>
   */
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    PropertyValidator validar = new PropertyValidatorImpl();

    try {
      if (request.getParameter("ayuda") != null
          && request.getParameter("ayuda").equals("siEnviarEmail")) {
        LogSISPE.getLog().info("request redactarMail");
        validar.validateMandatory(
            errors, "emailContacto", this.emailEnviarCotizacion, "errors.requerido", "Para");
        if (errors.isEmpty()) {
          validar.validateFormato(
              errors,
              "emailContacto",
              this.emailEnviarCotizacion,
              false,
              "^[A-Za-z0-9_]+@[A-Za-z0-9_]|[A-Za-z0-9_]+@[A-Za-z0-9_]+\\.[A-Za-z0-9_]",
              "errors.formato.email");
        }
        if (this.ccMail != null && !this.ccMail.trim().isEmpty()) {
          validar.validateFormato(
              errors,
              "emailContactoConCopia",
              this.ccMail,
              false,
              "^[A-Za-z0-9_]+@[A-Za-z0-9_]|[A-Za-z0-9_]+@[A-Za-z0-9_]+\\.[A-Za-z0-9_]",
              "errors.formato.email");
        }
        validar.validateMandatory(
            errors, "asuntoMail", this.asuntoMail, "errors.requerido", "Asunto");
        validar.validateMandatory(
            errors, "textoMail", this.textoMail, "errors.requerido", "Contenido");
        request
            .getSession()
            .setAttribute(
                "ec.com.smx.sic.sispe.textoMail", this.textoMail != null ? this.textoMail : "");
        request
            .getSession()
            .setAttribute(
                "ec.com.smx.sic.sispe.asuntoMail", this.asuntoMail != null ? this.asuntoMail : "");
        request
            .getSession()
            .setAttribute(
                "ec.com.smx.sic.sispe.paraMail",
                this.emailEnviarCotizacion != null ? this.emailEnviarCotizacion : "");
        if (errors.size() > 0) {
          request.getSession().setAttribute(SessionManagerSISPE.MENSAJES_SISPE, "ok");
        }
      }
    } catch (Exception ex) {
      LogSISPE.getLog().error("error de aplicaci\u00F3n", ex);
    }
    return errors;
  }
Exemplo n.º 8
0
  /* (non-Javadoc)
   * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping,
   * javax.servlet.http.HttpServletRequest)
   */
  @Override
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    ActionErrors errors = super.validate(mapping, request);

    if (errors == null) {
      errors = new ActionErrors();
    }

    if (!empty(baselineDataSetVal)) {
      try {
        long freq = Long.parseLong(baselineDataSetVal);
        // 1h table holds at most 14 days worth of data, make sure we don't set a dataset more than
        // that
        if (freq > 14) {
          ActionMessage errorMessage = new ActionMessage("admin.settings.BadBaselineDataSetVal");
          errors.add("baselineDataSetVal", errorMessage);
        }
      } catch (Exception e) {
        ActionMessage errorMessage = new ActionMessage("admin.settings.BadBaselineDataSetVal");
        errors.add("baselineDataSetVal", errorMessage);
      }
    }

    if (!empty(agentMaxQuietTimeAllowedVal)) {
      try {
        long val = Long.parseLong(agentMaxQuietTimeAllowedVal);
        // we should never allow a quiet time threshold to be less than 2 minutes
        if (val < 2) {
          ActionMessage errorMessage =
              new ActionMessage("admin.settings.BadAgentMaxQuietTimeAllowedVal");
          errors.add("agentMaxQuietTimeAllowedVal", errorMessage);
        }
      } catch (Exception e) {
        ActionMessage errorMessage =
            new ActionMessage("admin.settings.BadAgentMaxQuietTimeAllowedVal");
        errors.add("agentMaxQuietTimeAllowedVal", errorMessage);
      }
    }

    checkForBadNumber(errors, this.maintIntervalVal, "maintIntervalVal");
    checkForBadNumber(errors, this.rtPurgeVal, "rtPurgeVal");
    checkForBadNumber(errors, this.alertPurgeVal, "alertPurgeVal");
    checkForBadNumber(errors, this.eventPurgeVal, "eventPurgeVal");
    checkForBadNumber(errors, this.traitPurgeVal, "traitPurgeVal");
    checkForBadNumber(errors, this.availPurgeVal, "availPurgeVal");
    checkForBadNumber(errors, this.baselineFrequencyVal, "baselineFrequencyVal");

    if (errors.isEmpty()) {
      return null;
    } else {
      return errors;
    }
  }
Exemplo n.º 9
0
  protected DataResult performSearch(RequestContext context) {
    HttpServletRequest request = context.getRequest();
    String searchString = (String) request.getAttribute(SEARCH_STR);
    String viewMode = (String) request.getAttribute(VIEW_MODE);
    String whereToSearch = (String) request.getAttribute(WHERE_TO_SEARCH);
    Boolean invertResults =
        StringUtils.defaultString((String) request.getAttribute(INVERT_RESULTS)).equals("on");
    Boolean isFineGrained = (Boolean) request.getAttribute(FINE_GRAINED);

    ActionErrors errs = new ActionErrors();
    DataResult dr = null;
    try {
      dr =
          SystemSearchHelper.systemSearch(
              context, searchString, viewMode, invertResults, whereToSearch, isFineGrained);
    } catch (MalformedURLException e) {
      log.error("Caught Exception :" + e, e);
      errs.add(
          ActionMessages.GLOBAL_MESSAGE, new ActionMessage("packages.search.connection_error"));
    } catch (XmlRpcFault e) {
      log.info("Caught Exception :" + e + ", code [" + e.getErrorCode() + "]", e);
      if (e.getErrorCode() == 100) {
        log.error("Invalid search query", e);
        errs.add(
            ActionMessages.GLOBAL_MESSAGE,
            new ActionMessage("packages.search.could_not_parse_query", searchString));
      } else if (e.getErrorCode() == 200) {
        log.error("Index files appear to be missing: ", e);
        errs.add(
            ActionMessages.GLOBAL_MESSAGE,
            new ActionMessage("packages.search.index_files_missing", searchString));
      } else {
        errs.add(
            ActionMessages.GLOBAL_MESSAGE,
            new ActionMessage("packages.search.could_not_execute_query", searchString));
      }
    } catch (XmlRpcException e) {
      log.error("Caught Exception :" + e, e);
      errs.add(
          ActionMessages.GLOBAL_MESSAGE, new ActionMessage("packages.search.connection_error"));
    }
    if (dr == null) {
      ActionMessages messages = new ActionMessages();
      messages.add(
          ActionMessages.GLOBAL_MESSAGE, new ActionMessage("systemsearch_no_matches_found"));
      getStrutsDelegate().saveMessages(request, messages);
    }
    if (!errs.isEmpty()) {
      addErrors(request, errs);
    }
    return dr;
  }
Exemplo n.º 10
0
 @TransactionDemarcate(joinToken = true)
 public ActionForward captureQuestionResponses(
     final ActionMapping mapping,
     final ActionForm form,
     final HttpServletRequest request,
     @SuppressWarnings("unused") final HttpServletResponse response)
     throws Exception {
   request.setAttribute(METHODCALLED, "captureQuestionResponses");
   ActionErrors errors =
       createGroupQuestionnaire.validateResponses(request, (LoanDisbursementActionForm) form);
   if (errors != null && !errors.isEmpty()) {
     addErrors(request, errors);
     return mapping.findForward(ActionForwards.captureQuestionResponses.toString());
   }
   return createGroupQuestionnaire.rejoinFlow(mapping);
 }
Exemplo n.º 11
0
  /**
   * <br>
   * [機 能] 入力チェックを行う <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param con コネクション
   * @param req リクエスト
   * @return errors エラー
   * @throws SQLException SQL実行時例外
   */
  public ActionErrors validateCheck(Connection con, HttpServletRequest req) throws SQLException {
    ActionErrors errors = new ActionErrors();
    ActionMessage msg = null;
    errors = GSValidateCommon.validateDateFieldText(errors, baseDay__, "baseDay", "取得開始日", false);
    if (!errors.isEmpty()) {
      return errors;
    }
    selfDataOnTop__ = NullDefault.getString(selfDataOnTop__, "1");
    if (!GSValidateUtil.isNumber(selfDataOnTop__)) {
      msg = new ActionMessage("error.input.number.hankaku", "自己データ表示フラグ");
      StrutsUtil.addMessage(errors, msg, "selfDataOnTop");
      return errors;
    }

    return errors;
  }
Exemplo n.º 12
0
  /**
   * <br>
   * [機 能] 入力チェックを行う。 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map マップ
   * @param form フォーム
   * @param req リクエスト
   * @param con コネクション
   * @return ActionForward フォワード
   * @throws SQLException SQL実行例外
   */
  private ActionForward __doValidateCheck(
      ActionMapping map, Ipk100Form form, HttpServletRequest req, Connection con)
      throws SQLException {

    ActionErrors errors = null;
    errors = form.validateCheck(getRequestModel(req));
    if (errors != null && !errors.isEmpty()) {
      addErrors(req, errors);
      return __doInitAg(map, form, con);
    }

    // トランザクショントークン設定
    saveToken(req);

    return map.findForward("ipk100Touroku");
  }
Exemplo n.º 13
0
  /**
   * <br>
   * [機 能] OKボタンクリック時処理 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map マップ
   * @param form フォーム
   * @param req リクエスト
   * @param res レスポンス
   * @param con コネクション
   * @return ActionForward フォワード
   * @throws Exception 実行時例外
   */
  private ActionForward __doEntry(
      ActionMapping map,
      Adr200Form form,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con)
      throws Exception {

    // 入力チェック
    ActionErrors errors = form.validateCheck(con, req);
    if (!errors.isEmpty()) {
      addErrors(req, errors);
      return __doInit(map, form, req, res, con);
    }

    boolean commit = false;
    try {
      Adr200Biz biz = new Adr200Biz(getRequestModel(req));

      Adr200ParamModel paramMdl = new Adr200ParamModel();
      paramMdl.setParam(form);
      biz.entryLabelData(
          con, paramMdl, getCountMtController(req), getSessionUserModel(req).getUsrsid());
      paramMdl.setFormData(form);

      GsMessage gsMsg = new GsMessage();
      String opCode = gsMsg.getMessage(req, "cmn.entry");
      // ログ出力処理
      AdrCommonBiz adrBiz = new AdrCommonBiz(con);
      adrBiz.outPutLog(map, req, res, opCode, GSConstLog.LEVEL_TRACE, "");

      con.commit();
      commit = true;

    } catch (Exception e) {
      log__.error("ラベル情報の登録に失敗");
      throw e;
    } finally {
      if (!commit) {
        con.rollback();
      }
    }

    form.setAdr200closeFlg(true);
    return __doInit(map, form, req, res, con);
  }
Exemplo n.º 14
0
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws IOException, ServletException {
    String target = "success";
    String strTyp =
        (request.getParameter("reqtyp") != null) ? request.getParameter("reqtyp").trim() : "New";
    //// System.out.println("Request Type in test data "+strTyp);
    // String strTestTyp = (request.getParameter("testtyp")!=null) ?
    // request.getParameter("testtyp").trim() : "Digital";
    try {
      if (strTyp.equalsIgnoreCase("New")) {
        form = buildUserForm();
      } else {
        String strTid =
            (request.getParameter("tstid") != null) ? request.getParameter("tstid").trim() : "0";
        if (Integer.parseInt(strTid.trim()) <= 0) {
          form = buildUserForm();
        } else {
          form = buildUserDetailForm(Integer.parseInt(strTid.trim()), request);
        }
      }
      if ("request".equals(mapping.getScope())) {
        request.setAttribute(mapping.getAttribute(), form);
      } else {
        HttpSession session = request.getSession();
        session.setAttribute(mapping.getAttribute(), form);
      }
    } catch (Exception e) {
      target = new String("failure");
      ActionErrors errors = new ActionErrors();

      errors.add(
          ActionErrors.GLOBAL_ERROR, new ActionError("errors.database.error", e.getMessage()));

      // Report any errors
      if (!errors.isEmpty()) {

        saveErrors(request, errors);
      }
    }

    return (mapping.findForward(target));
  }
Exemplo n.º 15
0
  /**
   * <br>
   * [機 能] 検索ボタン押下時処理 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map マップ
   * @param form フォーム
   * @param req リクエスト
   * @param res レスポンス
   * @param con コネクション
   * @return ActionForward フォワード
   * @throws Exception 実行時例外
   */
  private ActionForward __doGoToSearch(
      ActionMapping map,
      Rsv010Form form,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con)
      throws Exception {

    ActionErrors errors = form.validateSearchCheck(req);

    if (!errors.isEmpty()) {
      addErrors(req, errors);
      return __doInit(map, form, req, res, con);
    }

    return __doMoveSyokai(map, form, req, res, con);
  }
Exemplo n.º 16
0
 public ActionForward guardar(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response) {
   ActionErrors errors = new ActionErrors();
   String parametros = "";
   ConMxcModuloxCuentacontableDAO mxcModuloxCuentacontableDAO =
       new ConMxcModuloxCuentacontableDAO(getSessionHibernate(request));
   RelacionModuloContaForm relacionForm = (RelacionModuloContaForm) form;
   errors = validarGuardado(relacionForm);
   Transaction tx = mxcModuloxCuentacontableDAO.getSession().beginTransaction();
   parametros =
       "3;"
           + relacionForm.getParametro(1)
           + ";"
           + relacionForm.getParametro(2)
           + ";"
           + relacionForm.getParametro(3)
           + ";"
           + relacionForm.getParametro(4);
   if (!mxcModuloxCuentacontableDAO
       .findByCuentaParametros(relacionForm.getConCueCuenta().getCueId(), parametros)
       .isEmpty()) {
     errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.mxcc.relacionRepetida"));
   }
   if (errors.isEmpty()) {
     try {
       if (relacionForm.getConCpaConceptoPartida().getCpaId() == -1)
         relacionForm.setConCpaConceptoPartida(null);
       relacionForm.getModuloxCuentacontable().setCxcParametrosUnion(parametros);
       relacionForm.setCxcFechaRelacion(new Date());
       mxcModuloxCuentacontableDAO.save(relacionForm.getModuloxCuentacontable());
       tx.commit();
     } catch (Exception e) {
       tx.rollback();
       e.printStackTrace();
     } finally {
       mxcModuloxCuentacontableDAO.getSession().flush();
       mxcModuloxCuentacontableDAO.getSession().clear();
     }
   }
   saveMessages(request, errors);
   return lista(mapping, form, request, response);
 }
  /* (非 Javadoc)
   * @see jp.go.jsps.kaken.web.struts.BaseAction#doMainProcessing(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, jp.go.jsps.kaken.web.common.UserContainer)
   */
  public ActionForward doMainProcessing(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response,
      UserContainer container)
      throws ApplicationException {

    // -----ActionErrorsの宣言(定型処理)-----
    ActionErrors errors = new ActionErrors();

    // ------キャンセル時
    if (isCancelled(request)) {
      return forwardCancel(mapping);
    }

    // ------表示対象審査員情報の取得
    ShinsainPk pkInfo = new ShinsainPk();

    ShinsainSearchForm shinsainSearchForm = (ShinsainSearchForm) form;

    // ------キー情報
    pkInfo.setShinsainNo(shinsainSearchForm.getShinsainNo4View()); // 審査員番号
    pkInfo.setJigyoKubun(shinsainSearchForm.getJigyoKubun()); // 事業区分

    // ------キー情報を元にデータ取得
    ShinsainInfo result =
        getSystemServise(IServiceName.SHINSAIN_MAINTENANCE_SERVICE)
            .select(container.getUserInfo(), pkInfo);
    // ------表示対象情報をセッションに登録。
    //		container.setShinsainInfo(result);

    // 登録結果をリクエスト属性にセット
    request.setAttribute(IConstants.RESULT_INFO, result);

    // -----画面遷移(定型処理)-----
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return forwardFailure(mapping);
    }
    return forwardSuccess(mapping);
  }
Exemplo n.º 18
0
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward();
    // BookForm bookForm = (BookForm) form;

    try {
      // get parameters
      HttpSession session = request.getSession(true);
      String name = request.getParameter("name");
      Book book = (Book) getBookDAO().getBookfromName(name).get(0);
      if (book == null) {
        errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage("Buy book failed"));
      }
      List books = (List) session.getAttribute("cart");
      if (books == null) {
        books = new ArrayList();
      }
      books.add(book);
      session.setAttribute("cart", books);

    } catch (Exception e) {
      errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage("register.message.failed"));
      e.printStackTrace();
    }

    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      forward = mapping.findForward(Constants.FAILURE_KEY);
    } else {
      forward = mapping.findForward(Constants.SUCCESS_KEY);
    }

    // Finish with
    return (forward);
  }
Exemplo n.º 19
0
  /* (Javadoc なし)
   * @see jp.go.jsps.kaken.web.struts.BaseAction#doMainProcessing(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, jp.go.jsps.kaken.web.common.UserContainer)
   */
  public ActionForward doMainProcessing(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response,
      UserContainer container)
      throws ApplicationException {

    // -----ActionErrorsの宣言(定型処理)-----
    ActionErrors errors = new ActionErrors();

    // 意見検索条件フォームの取得
    IkenForm ikenForm = (IkenForm) form;

    if (log.isDebugEnabled()) {
      log.debug("意見情報取得キー:" + ikenForm.getSystem_no());
    }

    // 検索用サービスの取得
    ISystemServise servise = getSystemServise(IServiceName.IKEN_MAINTENANCE_SERVICE);

    // 検索実行
    IkenInfo result =
        servise.selectIkenDataInfo(
            ikenForm.getSystem_no(), // システム受付番号
            ikenForm.getTaishoID() // 対象者ID
            );

    // 登録結果をリクエスト属性にセット
    // request.setAttribute(IConstants.RESULT_INFO,result);
    request.setAttribute("ikeninfo", result);

    // -----画面遷移(定型処理)-----
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return forwardFailure(mapping);
    }

    // TODO 自動生成したメソッド・スタブ
    return forwardSuccess(mapping);
  }
  /* (非 Javadoc)
   * @see jp.go.jsps.kaken.web.struts.BaseAction#doMainProcessing(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, jp.go.jsps.kaken.web.common.UserContainer)
   */
  public ActionForward doMainProcessing(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response,
      UserContainer container)
      throws ApplicationException {

    // -----ActionErrorsの宣言(定型処理)-----
    ActionErrors errors = new ActionErrors();

    // -----簡易申請書入力フォームの取得
    RyoikiGaiyoForm ryoikiGaiyoForm = (RyoikiGaiyoForm) form;
    ShinseiDataInfo shinseiDataInfo = new ShinseiDataInfo();
    shinseiDataInfo.setSystemNo(ryoikiGaiyoForm.getRyoikiSystemNo());
    shinseiDataInfo.setRyouikiNo(ryoikiGaiyoForm.getKariryoikiNo());

    // 研究項目番号を「総括班」に設定
    shinseiDataInfo.setRyouikiKoumokuNo("X00");

    // 削除フラグ
    shinseiDataInfo.setDelFlg("0");
    shinseiDataInfo.setJokyoId(StatusCode.STATUS_RYOUIKIDAIHYOU_KAKUNIN);

    // 申請状況:「領域代表者確認中」
    shinseiDataInfo.setJokyoIds(JOKYO_ID);
    try {
      getSystemServise(IServiceName.TEISHUTU_MAINTENANCE_SERVICE)
          .kakuteiRyoikiGaiyo(container.getUserInfo(), shinseiDataInfo);
    } catch (NoDataFoundException ex) {
      errors.add("該当データはありません", new ActionError("errors.5002"));
    }

    // -----画面遷移(定型処理)-----
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return forwardFailure(mapping);
    }

    return forwardSuccess(mapping);
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward();
    // return value
    FormAgregarRolSistema formAgregarRolSistema = (FormAgregarRolSistema) form;

    try {
      SessionManager.beginTransaction();

      String nombre = formAgregarRolSistema.getNombre();

      PersistentArrayList acciones = formAgregarRolSistema.getAccionesPersistentesSeleccionadas();

      // Agrega el usuario
      Cysdreq cysdreq = Cysdreq.getPersistentInstance();
      HashMap params = new HashMap(2);
      params.put("nombreRol", nombre);
      params.put("tiposDeAcciones", acciones);
      cysdreq.ejecutarAccion(new AgregarRolSistema(), cysdreq, params);

      SessionManager.commit();

    } catch (Throwable e) {
      e.printStackTrace();
      SessionManager.rollback();
      errors.add("rolSistema", new ActionError("errors.registrarRolSistema"));
    }

    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      forward = mapping.findForward("error");
    } else forward = mapping.findForward("globalSuccess");

    return (forward);
  }
Exemplo n.º 22
0
 @Override
 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
   String method = request.getParameter("method");
   if (null == request.getAttribute(Constants.CURRENTFLOWKEY)) {
     request.setAttribute(
         Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
   }
   ActionErrors errors = null;
   try {
     errors = validateFields(request, method);
   } catch (ApplicationException ae) {
     errors = new ActionErrors();
     errors.add(ae.getKey(), new ActionMessage(ae.getKey(), ae.getValues()));
   }
   if (null != errors && !errors.isEmpty()) {
     request.setAttribute(Globals.ERROR_KEY, errors);
     request.setAttribute("methodCalled", method);
   }
   errors.add(super.validate(mapping, request));
   return errors;
 }
Exemplo n.º 23
0
  /*
   * 入力チェック。
   */
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {

    // 定型処理-----
    ActionErrors errors = super.validate(mapping, request);
    // ---------------------------------------------
    // 基本的なチェック(必須、形式等)はValidatorを使用する。
    // ---------------------------------------------

    // 基本入力チェックここまで
    if (!errors.isEmpty()) {
      return errors;
    }

    // 定型処理-----

    // 追加処理-----

    // ---------------------------------------------
    // 組み合わせチェック
    // ---------------------------------------------
    return errors;
  }
  /* (非 Javadoc)
   * @see jp.go.jsps.kaken.web.struts.BaseAction#doMainProcessing(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, jp.go.jsps.kaken.web.common.UserContainer)
   */
  public ActionForward doMainProcessing(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response,
      UserContainer container)
      throws ApplicationException {

    // -----ActionErrorsの宣言(定型処理)-----
    ActionErrors errors = new ActionErrors();

    // ------承認対象申請情報システム番号の取得
    SimpleShinseiDataInfo[] dataInfo = container.getSimpleShinseiDataInfos();
    ShinseiDataPk[] pkInfo = new ShinseiDataPk[dataInfo.length];
    for (int i = 0; i < dataInfo.length; i++) {
      pkInfo[i] = new ShinseiDataPk();
      pkInfo[i].setSystemNo(dataInfo[i].getSystemNo());
    }
    try {
      getSystemServise(IServiceName.SHINSEI_MAINTENANCE_SERVICE)
          .recognizeMultiApplication(container.getUserInfo(), pkInfo, "kakunin");
    } catch (ValidationException ex) {
      List errorList = ex.getErrors();
      for (int i = 0; i < errorList.size(); i++) {
        ErrorInfo errInfo = (ErrorInfo) errorList.get(i);
        errors.add(
            errInfo.getProperty(), new ActionError(errInfo.getErrorCode(), errInfo.getErrorArgs()));
      }
    } catch (ApplicationException ex) {
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(ex.getErrorCode(), ex.getMessage()));
    }
    // -----画面遷移(定型処理)-----
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return forwardFailure(mapping);
    }
    removeFormBean(mapping, request);
    return forwardSuccess(mapping);
  }
Exemplo n.º 25
0
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ShareForm qform = (ShareForm) form;

    ActionErrors errors = new ActionErrors();

    String command = qform.getCommand();
    String keypass = qform.getKeypass();
    if (CommandConstant.GET_USER_BYPLANKEY.equals(command)) {
      String fid = qform.getFid();
      Plan plan = (Plan) request.getSession().getAttribute(Constant.SESSION_PLAN);
      plan.setEditable(fid.equals(plan.getUser().getReference()));
      request.getSession().setAttribute(Constant.SESSION_PLAN, plan);
      return mapping.findForward("pland");
    } else {
      MResult result = PlanService.getPlan(keypass);
      if (result.getCode() == MResult.RESULT_OK) {
        Plan plan = (Plan) result.getObject();
        if (plan != null) {
          request.setAttribute(Constant.REQUEST_MESSAGE, plan.getUser().getReference());
          plan.setVerify(true);
          request.getSession().setAttribute(Constant.SESSION_PLAN, plan);
        }
      } else {
        errors.add(CommandConstant.ERROR, new ActionMessage("share.error"));
      }
    }
    if (!errors.isEmpty()) {
      this.saveMessages(request, errors);
    }
    return mapping.findForward(Constant.MAPPING_SUCCESS);
  }
Exemplo n.º 26
0
  /**
   * <br>
   * [機 能] 施設設定画面へ移動 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map マップ
   * @param form フォーム
   * @param req リクエスト
   * @param res レスポンス
   * @param con コネクション
   * @return ActionForward フォワード
   * @throws Exception 実行時例外
   */
  private ActionForward __doMoveIkkatu(
      ActionMapping map,
      Rsv010Form form,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con)
      throws Exception {

    // 削除対象選択チェック
    ActionErrors errors = form.validateSelectCheck(req);

    if (!errors.isEmpty()) {
      addErrors(req, errors);
      return __doInit(map, form, req, res, con);
    }

    Rsv210Form nextForm = new Rsv210Form();
    nextForm.setRsvDspFrom(form.getRsvDspFrom());
    nextForm.setRsvSelectedGrpSid(form.getRsvSelectedGrpSid());
    nextForm.setRsvBackPgId(GSConstReserve.DSP_ID_RSV010);
    req.setAttribute("rsv210Form", nextForm);

    return map.findForward("ikkatu_yoyaku");
  }
Exemplo n.º 27
0
  /** {@inheritDoc} */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    if (CertificateManager.getInstance().isSatelliteCertExpired()) {
      addMessage(request, "satellite.expired");
      request.setAttribute(LoginSetupAction.HAS_EXPIRED, new Boolean(true));
      return mapping.findForward("failure");
    }

    ActionForward ret = null;
    DynaActionForm f = (DynaActionForm) form;

    // Validate the form
    ActionErrors errors = RhnValidationHelper.validateDynaActionForm(this, f);
    if (!errors.isEmpty()) {
      performGracePeriodCheck(request);
      addErrors(request, errors);
      return mapping.findForward("failure");
    }
    String username = (String) f.get("username");
    String password = (String) f.get("password");
    String urlBounce = (String) f.get("url_bounce");

    ActionErrors e = new ActionErrors();
    User user = loginUser(username, password, request, response, e);
    RequestContext ctx = new RequestContext(request);

    if (e.isEmpty()) {
      if (urlBounce == null || urlBounce.trim().equals("")) {
        if (log.isDebugEnabled()) {
          log.debug("2 - url bounce is empty using [" + DEFAULT_URL_BOUNCE + "]");
        }
        urlBounce = DEFAULT_URL_BOUNCE;
      }
      if (urlBounce.trim().endsWith("Logout.do")) {
        if (log.isDebugEnabled()) {
          log.debug(" - handling special case of url_bounce=Logout.do");
        }
        urlBounce = DEFAULT_URL_BOUNCE;
      }
      if (user != null) {
        try {
          publishUpdateErrataCacheEvent(user.getOrg());
        } catch (ConstraintViolationException ex) {
          log.error(ex);
          User loggedInUser = ctx.getLoggedInUser();
          if (loggedInUser != null) {
            request.setAttribute("loggedInUser", loggedInUser.getLogin());
          }
          ret = mapping.findForward("error");
          return ret;
        }
      }

      if (log.isDebugEnabled()) {
        log.debug("5 - redirecting to [" + urlBounce + "]");
      }
      if (user != null) {
        pxtDelegate.updateWebUserId(request, response, user.getId());

        try {
          response.sendRedirect(urlBounce);
          return null;
        } catch (IOException ioe) {
          throw new RuntimeException("Exception while trying to redirect: " + ioe);
        }
      }
    } else {
      if (log.isDebugEnabled()) {
        log.debug("6 - forwarding to failure");
      }

      performGracePeriodCheck(request);

      addErrors(request, e);
      request.setAttribute("url_bounce", urlBounce);
      ret = mapping.findForward("failure");
    }
    if (log.isDebugEnabled()) {
      log.debug("7 - returning");
    }
    return ret;
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws javax.servlet.ServletException, java.io.IOException {

    logger.debug("********************************************");
    logger.debug("*** Entering ProcessFirstCallInformation ***");

    CemAnStatus form = (CemAnStatus) actionForm;
    ActionErrors errors = new ActionErrors();
    formErrors = new ArrayList();
    HttpSession session = request.getSession();
    DbUserSession sessionUser = (DbUserSession) session.getAttribute(SessionValueKeys.DB_USER);

    logger.debug("ExecutorSame request value : " + request.getParameter("executorSame"));

    DatabaseTransaction t = null;
    FdmsDb fdmsdb = null;
    DbVitalsDeceased deceased = null;
    DbVitalsInformant informant = null;
    DbVitalsFirstCall firstCall = null;
    DbCase caseinfo = null;
    DbVitalsNextKin nextkin = null;
    DbPreneed preneed = null;
    DbVitalsSchedule sched = null;
    DbVitalsExecutor executor = null;
    DbCemAtneed cematneed = null;
    boolean addmode = false;
    int vitalsid = 0;
    String directive = form.getDirective();

    // Try to set the vitalsid from the form.
    try {
      vitalsid = FormatNumber.parseInteger(form.getVitalsId());
    } catch (Exception e) {
      vitalsid = 0;
    }

    cematneed = new DbCemAtneed();
    cematneed.setNew();

    if (directive.equals("cancel")) {
      // go back to case status unless no vitalsid then, show introduction.
      vitalsid = SessionHelpers.getVitalsIdFromSession(request, sessionUser);
      if (vitalsid > 0) {
        return mapping.findForward("showCaseStatusGlobal");
      } else {
        return mapping.findForward("ShowIntroductionGlobal");
      }
    }

    if (directive.equals("help")) {
      return mapping.findForward("usingHelp");
    }

    // From this point, we need to access the database
    try {
      t = (DatabaseTransaction) DatabaseTransaction.getTransaction(sessionUser);
      fdmsdb = FdmsDb.getInstance();

      if (directive.equals("redisplay")) {
        redisplayForm(t, sessionUser, form, errors);
        form.setDirective(" ");
        session.setAttribute("cemAnStatus", form);
        return new ActionForward(mapping.getInput());
      }

      validateForm(t, sessionUser, form, errors);
      // if errors found, return to input screen without saving anything
      if (!errors.isEmpty()) {
        // AppLog.info("ProcessFirstCall Invoking forward mapping getInput() after validation.");
        saveErrors(request, errors);
        request.setAttribute("formErrors", formErrors);

        form.setDirective(" ");
        session.setAttribute("cemAnStatus", form);
        return new ActionForward(mapping.getInput());
      } else {
        // AppLog.trace("ProcessFirstCall past validation.");
      }

      // Get the DbVitalDeceased and DbVitalsFirstCall objects
      if (vitalsid == 0) {
        deceased = new DbVitalsDeceased();
        deceased.setNew();
        addmode = true;
      } else {
        deceased = fdmsdb.getVitalsDeceased(t, vitalsid);
      }

      // Set the data in the DbVitalsDeceased and DbVitalsFirstCall records
      setVitalsDeceased(deceased, informant, form, errors);
      // if errors found, return to input screen without saving anything
      if (!errors.isEmpty()) {
        // AppLog.info("ProcessFirstCall Invoking forward mapping getInput() after
        // setVitalsDeceased.");
        saveErrors(request, errors);
        request.setAttribute("formErrors", formErrors);
        session.setAttribute("cemAnStatus", form);
        form.setDirective(" ");
        return new ActionForward(mapping.getInput());
      } else {
        // AppLog.trace("ProcessFirstCall past setVitalsDeceased.");
      }

      if (vitalsid == 0) {
        t.addPersistent(deceased);
        t.save();
        t.closeConnection();
        t = null;

        vitalsid = deceased.getId();
        form.setVitalsId(String.valueOf(vitalsid));
        sessionUser.setCurrentCaseID(vitalsid);
        // Need another transaction to continue with add
        t = (DatabaseTransaction) DatabaseTransaction.getTransaction(sessionUser);
        // increment next contract number if user did not change it
        // and assign to this case
        // if user changed contract# then use the one they entered.
        if (form.getContractNumber().equals(form.getNextContractNumber())) {
          int newnextno =
              SessionHelpers.nextContractNumber(sessionUser.getDbLookup(), sessionUser.getRegion());
          form.setContractNumber(String.valueOf(newnextno));
          form.setNextContractNumber(form.getContractNumber());
          // need new transaction since save in above method ends that transaction
        }
        sched = fdmsdb.getVitalsSchedule(t, vitalsid);
        sched.setDefaultAtNeedCheckList(sessionUser.getRegion(), sessionUser.getDbLookup());
      } else {
        sched = fdmsdb.getVitalsSchedule(t, vitalsid);
      }

      // Now, lets update the other Vitals information
      SessionHelpers.setVitalsIdInRequest(request, vitalsid);
      firstCall = fdmsdb.getVitalsFirstCall(t, vitalsid);
      informant = fdmsdb.getVitalsInformant(t, vitalsid);
      caseinfo = fdmsdb.getCase(t, vitalsid);
      nextkin = fdmsdb.getVitalsNextKin(t, vitalsid);
      executor = fdmsdb.getVitalsExecutor(t, vitalsid);
      // cematneed = fdmsdb.getCemAtneed(t, vitalsid);
      if (executor == null) {
        executor = new DbVitalsExecutor();
        executor.setNew();
      }
      setVitalsRest(
          t,
          sessionUser,
          deceased,
          firstCall,
          informant,
          caseinfo,
          nextkin,
          executor,
          cematneed,
          form,
          errors);
      // if errors found, return to input screen without saving anything
      if (!errors.isEmpty()) {
        // AppLog.info("ProcessFirstCall Invoking forward mapping getInput() after setVitalsRest.");
        saveErrors(request, errors);
        request.setAttribute("formErrors", formErrors);
        session.setAttribute("cemAnStatus", form);
        form.setDirective(" ");
        return new ActionForward(mapping.getInput());
      } else {
        logger.debug("no errors exist in processfirstcall information");
        // AppLog.trace("ProcessFirstCall past setVitalsRest.");
      }

      // determine whether active preneed or deceased
      preneed = fdmsdb.getPreneed(t, vitalsid);
      String relation = "Deceased";
      if (preneed.getStatus().equals(DbPreneed.ACTIVE)) {
        relation = "Preneed";
      }
      t.removePersistent(preneed);

      // update special survivor information for searching deceased, informant, case#, contract#
      DbSurvivor.addUpdateSurvivor(
          t,
          vitalsid,
          DbSurvivor.DECEASED,
          deceased.getSalutation(),
          deceased.getDecFName(),
          deceased.getDecMName(),
          deceased.getDecLName(),
          deceased.getSuffix(),
          deceased.getMaidenName(),
          deceased.getFullName(),
          deceased.getDecResStreet() + " " + deceased.getDecAptNo(),
          "",
          deceased.getDecResMailCity(),
          deceased.getDecResState(),
          deceased.getDecResZip(),
          "",
          "",
          "",
          relation,
          "",
          "",
          "");
      DbSurvivor.addUpdateSurvivor(
          t,
          vitalsid,
          DbSurvivor.INFORMANT,
          informant.getSalutation(),
          informant.getFname(),
          informant.getMname(),
          informant.getLname(),
          "",
          "",
          "",
          informant.getStreet() + " " + informant.getRoad2() + " " + informant.getRoad3(),
          "",
          informant.getCity(),
          informant.getState(),
          informant.getZip(),
          informant.getPhone(),
          "",
          informant.getInformantEmail(),
          "Informant",
          "",
          "",
          "");
      DbSurvivor.addUpdateSurvivor(
          t,
          vitalsid,
          DbSurvivor.CONTRACT,
          "",
          deceased.getDecLName(),
          "",
          caseinfo.getContractCode(),
          "",
          "",
          "",
          "",
          "",
          "",
          "",
          "",
          "",
          "",
          "",
          deceased.getDecFName(),
          "",
          "",
          "");
      DbSurvivor.addUpdateSurvivor(
          t,
          vitalsid,
          DbSurvivor.CASECODE,
          "",
          deceased.getDecLName(),
          "",
          caseinfo.getCaseCode(),
          "",
          "",
          "",
          "",
          "",
          "",
          "",
          "",
          "",
          "",
          "",
          deceased.getDecFName(),
          "",
          "",
          "");

      // add informant and next-of-kin as normal survivors but only during add cycle
      if (addmode) {
        // AppLog.trace("Adding informant and NOK as survivors.");
        DbSurvivor infsurv =
            new DbSurvivor(
                vitalsid,
                informant.getSalutation(),
                informant.getFname(),
                informant.getMname(),
                informant.getLname(),
                "",
                "",
                "",
                informant.getStreet() + " " + informant.getRoad2() + " " + informant.getRoad3(),
                "",
                informant.getCity(),
                informant.getState(),
                informant.getZip(),
                informant.getPhone(),
                "",
                informant.getInformantEmail(),
                informant.getRelated(),
                "",
                "",
                "",
                "");
        t.addPersistent(infsurv);
        if (!form.getNextKinSame()) {
          DbSurvivor noksurv =
              new DbSurvivor(
                  vitalsid,
                  nextkin.getSalutation(),
                  nextkin.getFirstname(),
                  "",
                  nextkin.getLastname(),
                  "",
                  "",
                  "",
                  nextkin.getStreet() + nextkin.getRoad2() + " " + nextkin.getRoad3(),
                  "",
                  nextkin.getCity(),
                  nextkin.getState(),
                  nextkin.getZip(),
                  nextkin.getPhone(),
                  "",
                  "",
                  nextkin.getRelation(),
                  "",
                  "",
                  "",
                  "");
          t.addPersistent(noksurv);
        }
      }
      t.addPersistent(cematneed);

      if (executor != null) t.addPersistent(executor);

      // Final commit and cleanup
      t.save();

    } catch (PersistenceException pe) {
      logger.error("PersistenceException in doPerform() : ", pe);
      errors.add(
          ActionErrors.GLOBAL_ERROR, new ActionError("error.PersistenceException", pe.getCause()));
    } catch (Exception pe) {
      logger.error("Error in doPerform() : ", pe);
      errors.add(
          ActionErrors.GLOBAL_ERROR, new ActionError("error.GeneralException", pe.getMessage()));
    } finally {
      if (t != null) {
        try {
          t.closeConnection();
          t = null;
        } catch (Exception e) {
          logger.error("Error in closeConnection() : ", e);
        }
      }
    }

    if (!errors.isEmpty()) {
      // AppLog.info("ProcessFirstCallInformation Invoking forward mapping getInput().");
      saveErrors(request, errors);
      request.setAttribute("formErrors", formErrors);
      form.setDirective(" ");
      session.setAttribute("cemAnStatus", form);
      return (new ActionForward(mapping.getInput()));
    }

    // remove session variables used in FirstCall page
    SessionHelpers.removeArrangerListFromSession(request);
    SessionHelpers.removeChapelListInSession(request);
    session.removeAttribute("cemAnStatus");
    SessionHelpers.setVitalsIdInRequest(request, vitalsid);

    // Since we are forwarding to another ACTION, need to go through this exercise
    /*	ActionMappings mappings = mapping.getMappings();
           String returnPath = actionForward.getPath();
           int periodpos = returnPath.indexOf(".do");
           returnPath = returnPath.substring(0,periodpos);
           ActionMapping finalMapping = mappings.findMapping(returnPath);
           Action finalAction = null;

           try {
               Class clazz = Class.forName(finalMapping.getType());
               finalAction = (Action) clazz.newInstance();
               AppLog.trace("chaining to:"+finalAction.toString());
           } catch (Exception e) {
               AppLog.warning("Could not find chained action: " + e.getMessage());
               return forwardGlobalCancel(mapping) ;
           }

           return finalAction.perform(finalMapping,form,request,response);
    */
    // return forwardShowCaseStatusGlobal(mapping);

    if (errors.isEmpty()) {
      request.setAttribute("redirect", Boolean.TRUE);
      request.setAttribute("vitalsId", new Integer(vitalsid));
    }
    return new ActionForward(mapping.getInput());
  }
Exemplo n.º 29
0
  /**
   * <br>
   * [機 能] 稟議情報登録処理を行う <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map アクションマッピング
   * @param form アクションフォーム
   * @param req リクエスト
   * @param res レスポンス
   * @param con コネクション
   * @param mode 登録モード 0:申請 1:草稿に保存
   * @throws Exception 実行時例外
   * @return ActionForward
   */
  private ActionForward __doEntry(
      ActionMapping map,
      Rng020Form form,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con,
      int mode)
      throws Exception {

    if (!isTokenValid(req, true)) {
      log__.info("2重投稿");
      return getSubmitErrorPage(map, req);
    }

    // 入力チェックを行う
    ActionErrors errors = null;
    if (mode == 0) {
      errors = form.validateCheck(Rng020Form.CHECKTYPE_REQUEST, req);
    } else if (mode == 1) {
      errors = form.validateCheck(Rng020Form.CHECKTYPE_DRAFT, req);
    }
    if (errors != null && !errors.isEmpty()) {
      addErrors(req, errors);
      return __doDsp(map, form, req, res, con);
    }

    // 新規作成の場合、確認画面へ遷移する。
    if (mode == 0) {
      return map.findForward("rng020kn");
    }
    ActionForward forward = null;
    boolean commit = false;
    PluginConfig pconfig = getPluginConfigForMain(getPluginConfig(req), con);
    CommonBiz cmnBiz = new CommonBiz();
    boolean smailPluginUseFlg = cmnBiz.isCanUsePlugin(GSConstMain.PLUGIN_ID_SMAIL, pconfig);

    try {
      RequestModel reqMdl = getRequestModel(req);
      Rng020ParamModel paramMdl = new Rng020ParamModel();
      paramMdl.setParam(form);
      Rng020Biz biz = new Rng020Biz(con, reqMdl, getSessionUserSid(req));
      biz.entryRingiData(
          paramMdl,
          getCountMtController(req),
          getAppRootPath(),
          _getRingiDir(req),
          mode,
          getPluginConfig(req),
          smailPluginUseFlg,
          getRequestModel(req));
      paramMdl.setFormData(form);

      forward = __setCompPageParam(map, req, form);

      GsMessage gsMsg = new GsMessage(reqMdl);
      String msg = gsMsg.getMessage("cmn.entry");
      String msg2 = gsMsg.getMessage("cmn.save.draft");

      // ログ出力処理
      RngBiz rngBiz = new RngBiz(con);
      String opCode = msg;

      rngBiz.outPutLog(map, opCode, GSConstLog.LEVEL_TRACE, msg2, reqMdl);

      con.commit();
      commit = true;

      // テンポラリディレクトリの削除
      IOTools.deleteDir(_getRingiDir(req));
    } catch (Exception e) {
      log__.error("稟議情報の登録に失敗", e);
      throw e;
    } finally {
      if (!commit) {
        con.rollback();
      }
    }

    return forward;
  }
Exemplo n.º 30
0
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward();
    // return value
    String username = (String) PropertyUtils.getSimpleProperty(form, "usuario");
    String password = (String) PropertyUtils.getSimpleProperty(form, "password");

    try {
      // obtiene la transacción asociada al administrador de persistencia.
      SessionManager.beginTransaction();

      Cysdreq cysdreq;
      try {
        cysdreq =
            (Cysdreq)
                PersistenceManagers.findObject(
                    SessionManager.getSession(), SessionManager.ROOT_OBJECT_ID);
        System.out.println("Cysdreq obtenido");
      } catch (Throwable t) {
        // Report the error using the appropriate name and ID.
        errors.add("login", new ActionError("errors.obtenerSistema"));
        throw t;
      }

      Usuario usuario = cysdreq.getUsuario(username, password);
      if (usuario == null) {
        errors.add("login", new ActionError("errors.login.inexistente"));
      } else {
        UserBean userBean = new UserBean();
        userBean.setLongUsername(usuario.getNombre());
        userBean.setUsername(usuario.getUsuario());
        userBean.setPassword(usuario.getPassword());

        // Save our logged-in user in the session
        HttpSession session = request.getSession();
        session.setAttribute(USER_KEY, userBean);
      }

      SessionManager.commit();
    } catch (Throwable t) {
      SessionManager.rollback();
      t.printStackTrace();
      // Report the error using the appropriate name and ID.
      errors.add("sistema", new ActionError("errors.errorDesconocido"));
    }

    // If a message is required, save the specified key(s)
    // into the request for use by the <struts:errors> tag.

    if (!errors.isEmpty()) {
      saveErrors(request, errors);

      // Forward control to the appropriate 'failure' URI (change name as desired)
      forward = mapping.findForward("error");

    } else {

      // Forward control to the appropriate 'success' URI (change name as desired)
      forward = mapping.findForward("success");
    }

    // Finish with
    return (forward);
  }