示例#1
0
  /**
   * <br>
   * [機 能] 削除チェックを行う <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param con コネクション
   * @return エラー
   * @throws SQLException SQL例外発生
   */
  public ActionErrors deleteCheck(Connection con) throws SQLException {

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

    CmnUsrmLabelDao dao = new CmnUsrmLabelDao(con);
    // ユーザ情報に付加されているラベルSID一覧取得
    ArrayList<CmnUsrmLabelModel> modelList = dao.getCountLabBelongCat(getUsr043EditSid());

    // ユーザ情報に付加ラベルなし
    if (modelList == null) {
      return errors;
    }

    CmnLabelUsrDao labDao = new CmnLabelUsrDao(con);
    for (CmnUsrmLabelModel model : modelList) {
      CmnLabelUsrModel labModel = labDao.selectOneLabel(model.getUsrSid());
      fieldfix = "labBelongCat" + ".";
      String msgKey = "error.user.duplication.label.incategory";
      msg =
          new ActionMessage(
              msgKey,
              StringUtilHtml.transToHTmlPlusAmparsant(getUsr045CategoryName()),
              StringUtilHtml.transToHTmlPlusAmparsant(labModel.getLabName()),
              model.getCount());
      errors.add(fieldfix, msg);
    }

    return errors;
  }
示例#2
0
  /**
   * Insert CMN_LABEL_USR Data Bindding JavaBean
   *
   * @param bean CMN_LABEL_USR Data Bindding JavaBean
   * @throws SQLException SQL実行例外
   */
  public void insert(CmnLabelUsrModel bean) throws SQLException {

    PreparedStatement pstmt = null;
    Connection con = null;
    con = getCon();

    try {
      // SQL文
      SqlBuffer sql = new SqlBuffer();
      sql.addSql(" insert ");
      sql.addSql(" into ");
      sql.addSql(" CMN_LABEL_USR(");
      sql.addSql("   LAB_SID,");
      sql.addSql("   LUC_SID,");
      sql.addSql("   LAB_NAME,");
      sql.addSql("   LAB_BIKO,");
      sql.addSql("   LAB_AUID,");
      sql.addSql("   LAB_ADATE,");
      sql.addSql("   LAB_EUID,");
      sql.addSql("   LAB_EDATE,");
      sql.addSql("   LAB_SORT");
      sql.addSql(" )");
      sql.addSql(" values");
      sql.addSql(" (");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?");
      sql.addSql(" )");

      pstmt = con.prepareStatement(sql.toSqlString());
      sql.addIntValue(bean.getLabSid());
      sql.addIntValue(bean.getLucSid());
      sql.addStrValue(bean.getLabName());
      sql.addStrValue(bean.getLabBiko());
      sql.addIntValue(bean.getLabAuid());
      sql.addDateValue(bean.getLabAdate());
      sql.addIntValue(bean.getLabEuid());
      sql.addDateValue(bean.getLabEdate());
      sql.addIntValue(bean.getLabSort());
      log__.info(sql.toLogString());
      sql.setParameter(pstmt);
      pstmt.executeUpdate();
    } catch (SQLException e) {
      throw e;
    } finally {
      JDBCUtil.closeStatement(pstmt);
    }
  }