예제 #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
  /**
   * Create CMN_LABEL_USR Data Bindding JavaBean From ResultSet
   *
   * @param rs ResultSet
   * @return created UsrLabelModel
   * @throws SQLException SQL実行例外
   */
  private CmnLabelUsrModel __getCmnLabelUsrFormRs(ResultSet rs) throws SQLException {
    CmnLabelUsrModel bean = new CmnLabelUsrModel();
    bean.setLabSid(rs.getInt("LAB_SID"));
    bean.setLucSid(rs.getInt("LUC_SID"));
    bean.setLabName(rs.getString("LAB_NAME"));
    bean.setLabBiko(rs.getString("LAB_BIKO"));
    bean.setLabAdate(UDate.getInstanceTimestamp(rs.getTimestamp("LAB_ADATE")));
    bean.setLabAuid(rs.getInt("LAB_AUID"));
    bean.setLabEdate(UDate.getInstanceTimestamp(rs.getTimestamp("LAB_EDATE")));
    bean.setLabEuid(rs.getInt("LAB_EUID"));
    bean.setLabSort(rs.getInt("LAB_SORT"));

    return bean;
  }
예제 #3
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);
    }
  }
예제 #4
0
  /**
   * <br>
   * [機 能] ラベルを削除する <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param labSid LAB_SID
   * @return delete count
   * @throws SQLException SQL実行例外
   */
  public int delete(int labSid) throws SQLException {

    PreparedStatement pstmt = null;
    int count = 0;
    Connection con = null;
    con = getCon();

    try {

      CmnLabelUsrModel model = selectOneLabel(labSid);
      ArrayList<Integer> list = selectLabelSort(model.getLabSort(), model.getLucSid());
      // SQL文
      SqlBuffer sql = new SqlBuffer();
      sql.addSql(" delete");
      sql.addSql(" from");
      sql.addSql("   CMN_LABEL_USR");
      sql.addSql(" where ");
      sql.addSql("   LAB_SID=?");

      pstmt = con.prepareStatement(sql.toSqlString());
      sql.addIntValue(labSid);

      log__.info(sql.toLogString());
      sql.setParameter(pstmt);
      count = pstmt.executeUpdate();

      for (int i = 0; i < list.size(); i++) {
        sortArrange(list.get(i));
      }
    } catch (SQLException e) {
      throw e;
    } finally {
      JDBCUtil.closeStatement(pstmt);
    }
    return count;
  }