/**
   * Excel出力時のバリデートを行います.
   *
   * @return 表示するメッセージ
   */
  public ActionErrors validate() {
    ActionErrors errors = new ActionErrors();
    String labelPeriodMonth = MessageResourcesUtil.getMessage("labels.periodMonth");
    String labelAllocatedQuantity = MessageResourcesUtil.getMessage("labels.allocatedQuantity");

    if (RadioCond2.VALUE_5.equals(radioCond2) && !StringUtil.hasLength(allocatedQuantity)) {
      errors.add(
          ActionMessages.GLOBAL_MESSAGE,
          new ActionMessage("errors.required", labelAllocatedQuantity));
    }

    if (StringUtil.hasLength(periodMonth)) {
      try {
        Integer.valueOf(periodMonth);
      } catch (NumberFormatException e) {
        errors.add(
            ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.integer", labelPeriodMonth));
      }
    }

    if (RadioCond2.VALUE_5.equals(radioCond2) && StringUtil.hasLength(allocatedQuantity)) {
      try {
        Integer.valueOf(allocatedQuantity);
      } catch (NumberFormatException e) {
        errors.add(
            ActionMessages.GLOBAL_MESSAGE,
            new ActionMessage("errors.integer", labelAllocatedQuantity));
      }
    }

    return errors;
  }
Example #2
0
  /**
   * SAStrusのユーティリティのMessageResourceUtil.getMessage(key)のラッパー<br>
   * 基本的にConst定義はすべてプロパティファイルに書く<br>
   * 独自にConst定義をすると多言語化が面倒であるため。
   *
   * @param key
   * @return プロパティから取得した文字列
   */
  public static String get(final String key) {

    if (StringUtil.isBlank(key)) {
      return "";
    }
    return MessageResourcesUtil.getMessage(key);
  }