public List getIdentityTables() { // delete all the data in the jbpm tables List jbpmTableNames = new ArrayList(); try { createConnection(); ResultSet resultSet = connection.getMetaData().getTables("", "", null, null); while (resultSet.next()) { String tableName = resultSet.getString("TABLE_NAME"); if ((tableName != null) && (tableName.length() > 5) && (IDENTITY_TABLE_PREFIX.equalsIgnoreCase(tableName.substring(0, 5)))) { jbpmTableNames.add(tableName); } } } catch (SQLException e) { throw new RuntimeException("couldn't get the jbpm table names"); } finally { closeConnection(); } return jbpmTableNames; }
/** * 領域番号の件数を取得する。 領域番号順にソートする。 * * @param connection コネクション * @param ryoikoNo 領域番号 * @return * @throws ApplicationException * @throws DataAccessException */ public String selectRyoikiNoCount(Connection connection, String ryoikoNo) throws ApplicationException, DataAccessException { String strCount = null; ResultSet recordSet = null; PreparedStatement preparedStatement = null; // ----------------------- // SQL文の作成 // ----------------------- StringBuffer select = new StringBuffer(); select.append("SELECT COUNT(RYOIKI_NO) "); select.append(ISystemServise.STR_COUNT); select.append(" FROM"); select.append(" (SELECT MR.RYOIKI_NO FROM MASTER_RYOIKI MR WHERE MR.ZENNENDO_OUBO_FLG = '1' "); select.append(" AND MR.RYOIKI_NO = '"); select.append(EscapeUtil.toSqlString(ryoikoNo)); select.append("')"); if (log.isDebugEnabled()) { log.debug("query:" + select.toString()); } try { preparedStatement = connection.prepareStatement(select.toString()); recordSet = preparedStatement.executeQuery(); if (recordSet.next()) { strCount = recordSet.getString(ISystemServise.STR_COUNT); } else { throw new NoDataFoundException("領域マスタデータテーブルに該当するデータが見つかりません。"); } } catch (SQLException ex) { throw new DataAccessException("領域マスタデータテーブルの検索中に例外が発生しました。", ex); } catch (NoDataFoundException ex) { throw new NoDataFoundException("該当する領域番号が存在しません。", ex); } return strCount; }