Пример #1
0
  /**
   * <br>
   * [機 能] 入力チェックを行う <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param reqMdl リクエスト情報
   * @return エラー
   */
  public ActionErrors ipk070ValidateCheck(RequestModel reqMdl) {

    ActionErrors errors = new ActionErrors();
    ActionMessage msg = null;

    GsMessage gsMsg = new GsMessage(reqMdl);
    String textKeyword = gsMsg.getMessage("cmn.keyword");
    String searchTarget = gsMsg.getMessage("cmn.search2");

    // -- キーワード --
    if (!StringUtil.isNullZeroStringSpace(ipk070KeyWord__)) {
      errors =
          IpkValidate.validateSearchFieldText(
              errors,
              textKeyword,
              ipk070KeyWord__,
              "ipk070KeyWord",
              IpkConst.MAX_LENGTH_IPAD,
              true);
    }

    // -- 検索対象未選択チェック --
    if (ipk070SearchTarget__ == null || ipk070SearchTarget__.length == 0) {
      msg = new ActionMessage("error.select.required.text", searchTarget);
      StrutsUtil.addMessage(errors, msg, "ipk070SearchTarget");
    }
    return errors;
  }
Пример #2
0
  /**
   * <br>
   * [機 能] 入力チェックを行う <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map アクションマッピング
   * @param req リクエスト
   * @param con コネクション
   * @param sessionUsrSid ユーザSID
   * @return エラー
   * @throws SQLException SQL実行時例外
   */
  public Map<Integer, ActionErrors> validateCheck(
      ActionMapping map, HttpServletRequest req, Connection con, int sessionUsrSid)
      throws SQLException {

    ActionMessage msg = null;
    GsMessage gsMsg = new GsMessage();

    // 行番号とエラー内容を格納するMAP
    Map<Integer, ActionErrors> errorsMap = new TreeMap<Integer, ActionErrors>();

    for (Ntp030Param ntpData : ntp030nippouDataList__) {

      ActionErrors errors = new ActionErrors();

      String number = String.valueOf(ntpData.getRowId());
      String ntpYear = String.valueOf(ntpData.getNtpYear());
      String ntpMonth = String.valueOf(ntpData.getNtpMonth());
      String ntpDay = String.valueOf(ntpData.getNtpDay());
      String frHour = String.valueOf(ntpData.getFrHour());
      String frMin = String.valueOf(ntpData.getFrMin());
      String toHour = String.valueOf(ntpData.getToHour());
      String toMin = String.valueOf(ntpData.getToMin());
      String title = String.valueOf(ntpData.getTitle());
      String naiyou = String.valueOf(ntpData.getValueStr());

      // 開始年月日チェックフラグ(true=入力OK、false=NG)
      boolean fromOk = false;

      int iSYear = -1;
      if (!StringUtil.isNullZeroStringSpace(ntpYear)) {
        iSYear = Integer.parseInt(ntpYear);
      }
      int iSMonth = Integer.parseInt(ntpMonth);
      int iSDay = Integer.parseInt(ntpDay);

      UDate frDate = new UDate();
      frDate.setDate(iSYear, iSMonth, iSDay);
      frDate.setSecond(GSConstSchedule.DAY_START_SECOND);
      frDate.setMilliSecond(GSConstSchedule.DAY_START_MILLISECOND);
      if (frDate.getYear() != iSYear
          || frDate.getMonth() != iSMonth
          || frDate.getIntDay() != iSDay) {
        msg =
            new ActionMessage(
                "error.input.notfound.date", gsMsg.getMessage(req, "schedule.sch100.10"));
        errors.add("error.input.notfound.date", msg);
        log__.debug("error:1");
      } else {
        fromOk = true;
      }

      // 終了年月日チェックフラグ(true=入力OK、false=NG)
      boolean toOk = false;

      int iEYear = -1;
      if (!StringUtil.isNullZeroStringSpace(ntpYear)) {
        iEYear = Integer.parseInt(ntpYear);
      }
      int iEMonth = Integer.parseInt(ntpMonth);
      int iEDay = Integer.parseInt(ntpDay);

      UDate toDate = new UDate();
      toDate.setDate(iEYear, iEMonth, iEDay);
      toDate.setSecond(GSConstSchedule.DAY_START_SECOND);
      toDate.setMilliSecond(GSConstSchedule.DAY_START_MILLISECOND);
      if (toDate.getYear() != iEYear
          || toDate.getMonth() != iEMonth
          || toDate.getIntDay() != iEDay) {
        msg =
            new ActionMessage(
                "error.input.notfound.date", gsMsg.getMessage(req, "schedule.sch100.15"));
        errors.add("error.input.notfound.date", msg);
        log__.debug("error:2");
      } else {
        toOk = true;
      }

      if (fromOk && toOk && ntp030TimeKbn__.equals(String.valueOf(GSConstSchedule.TIME_EXIST))) {

        if (frHour.equals("-1")
            || frMin.equals("-1")
            || toHour.equals("-1")
            || toMin.equals("-1")) {
          // 時分
          String textHourMinute = gsMsg.getMessage(req, "schedule.src.36");
          msg = new ActionMessage("error.input.required.text", textHourMinute);
          errors.add("" + "error.input.required.text", msg);
          fromOk = false;
        }
      }

      // 個別チェックOKの場合
      if (fromOk && toOk) {

        if (ntp030TimeKbn__.equals(String.valueOf(GSConstSchedule.TIME_EXIST))) {
          if (frHour.equals("-1") && frMin.equals("-1")) {
            frDate.setHour(GSConstSchedule.DAY_START_HOUR);
            frDate.setMinute(GSConstSchedule.DAY_START_MINUTES);
          } else {
            frDate.setHour(Integer.parseInt(frHour));
            frDate.setMinute(Integer.parseInt(frMin));
          }
          if (toHour.equals("-1") && toMin.equals("-1")) {
            toDate.setHour(GSConstSchedule.DAY_END_HOUR);
            toDate.setMinute(GSConstSchedule.DAY_SYSMAX_MINUTES);
          } else {
            toDate.setHour(Integer.parseInt(toHour));
            toDate.setMinute(Integer.parseInt(toMin));
          }
        } else {
          frDate.setZeroHhMmSs();
          toDate.setMaxHhMmSs();
        }

        // from~to大小チェック
        if (frDate.compare(frDate, toDate) != UDate.LARGE) {
          // 開始 < 終了
          String textStartLessEnd = gsMsg.getMessage(req, "cmn.start.lessthan.end");
          // 開始・終了
          String textStartEnd = gsMsg.getMessage(req, "cmn.start.end");
          msg = new ActionMessage("error.input.comp.text", textStartEnd, textStartLessEnd);
          errors.add("" + "error.input.comp.text", msg);
          log__.debug("error:5");
        }
      }

      // タイトルのチェック
      if (__checkNoInput(errors, title, "ntp030Title", gsMsg.getMessage(req, "cmn.title"))) {
        if (__checkRange(
            errors,
            title,
            "ntp030Title",
            gsMsg.getMessage(req, "cmn.title"),
            GSConstSchedule.MAX_LENGTH_TITLE)) {
          // 先頭スペースチェック
          if (ValidateUtil.isSpaceStart(title)) {
            // タイトル
            String textTitle = gsMsg.getMessage(req, "cmn.title");
            msg = new ActionMessage("error.input.spase.start", textTitle);
            StrutsUtil.addMessage(errors, msg, "ntp030Title");
          } else {
            __checkJisString(errors, title, "ntp030Title", gsMsg.getMessage(req, "cmn.title"));
          }
        }
      }
      boolean valueError = false;
      // 内容のチェック
      if (__checkRangeTextarea(
          errors,
          naiyou,
          "ntp030Value",
          gsMsg.getMessage(req, "cmn.content"),
          GSConstSchedule.MAX_LENGTH_VALUE)) {
        if (!StringUtil.isNullZeroString(naiyou)) {
          // スペースのみチェック
          if (!valueError && ValidateUtil.isSpaceOrKaigyou(naiyou)) {
            msg =
                new ActionMessage(
                    "error.input.spase.cl.only", gsMsg.getMessage(req, "cmn.content"));
            StrutsUtil.addMessage(errors, msg, "ntp030Value");
            valueError = true;
          }

          if (!valueError) {
            // JIS
            __checkJisString(errors, naiyou, "ntp030Value", gsMsg.getMessage(req, "cmn.content"));
          }
        }
      }

      if (errors.size() > 0) {
        errorsMap.put(Integer.valueOf(number), errors);
      }
    }
    return errorsMap;
  }