|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.stratelia.webactiv.organization.Table<T>
public abstract class Table<T>
A Table object manages a table in a database.
| Constructor Summary | |
|---|---|
Table(Schema schema,
String tableName)
|
|
| Method Summary | |
|---|---|
protected boolean |
addIdToQuery(Collection<Object> theVect,
StringBuilder theQuery,
int value,
String column,
boolean concatAndOr,
String andOr)
|
protected boolean |
addParamToQuery(Collection<Object> theVect,
StringBuilder theQuery,
int value,
String column,
boolean concatAndOr,
String andOr)
|
protected boolean |
addParamToQuery(Collection<Object> theVect,
StringBuilder theQuery,
String value,
String column,
boolean concatAndOr,
String andOr)
|
protected boolean |
addParamToQuery(Collection<Object> theVect,
StringBuilder theQuery,
Timestamp value,
String column,
boolean concatAndOr,
String andOr)
|
static String |
aliasColumns(String rowAlias,
String columnList)
Builds an aliased columns list from a row alias and a columns list. |
protected abstract T |
fetchRow(ResultSet rs)
Builds a new row object which values are retrieved from the given ResultSet. |
protected int |
getCount(String tableName,
String whereClause,
int id,
String param)
Returns the nb of rows in the given table agregated on the given column |
protected int |
getCount(String tableName,
String whereClause,
String param)
Returns the nb of rows in the given table agregated on the given column |
protected List<String> |
getIds(ResultSet rs)
|
protected List<String> |
getIds(String query)
Returns the ids described by the given no parameters query. |
protected List<String> |
getIds(String query,
int id)
Returns the ids described by the given query with one id parameter. |
protected List<String> |
getIds(String query,
List<?> params)
Returns the rows described by the given query with parameters. |
protected Integer |
getInteger(ResultSet rs)
|
protected Integer |
getInteger(String query,
int[] ids)
Returns the integer of the single row, single column resultset returned by the given query with id parameters. |
protected List<T> |
getMatchingRows(String returnedColumns,
String[] matchColumns,
String[] matchValues)
Returns the rows like a sample row. |
int |
getNextId()
Returns the next id which can be used to create a new row. |
protected List<T> |
getRows(ResultSet rs)
|
protected List<T> |
getRows(String query)
Returns the rows described by the given no parameters query. |
protected List<T> |
getRows(String query,
int id)
Returns the rows described by the given query with one id parameter. |
protected List<T> |
getRows(String query,
List<?> params)
Returns the rows described by the given query with parameters. |
protected T |
getUniqueRow(ResultSet rs)
|
protected T |
getUniqueRow(String query,
int id)
Returns the unique row referenced by the given query and id. |
protected T |
getUniqueRow(String query,
String id)
Returns the unique row referenced by the given query and id. |
protected int |
insertRow(String insertQuery,
T row)
|
protected void |
performPrepareStatementParams(PreparedStatement ps,
List<?> params)
Centralization of PreparedStatement parameter setting. |
protected abstract void |
prepareInsert(String insertQuery,
PreparedStatement insert,
T row)
Set all the parameters of the insert PreparedStatement built from the insertQuery in order to insert the given row. |
protected abstract void |
prepareUpdate(String updateQuery,
PreparedStatement update,
T row)
Set all the parameters of the update PreparedStatement built from the updateQuery in order to update the given row. |
static String |
truncate(String value,
int maxSize)
Truncates a string value to be inserted in a fixed size column |
protected int |
updateRelation(String query)
|
protected int |
updateRelation(String query,
int param)
|
protected int |
updateRelation(String query,
int[] ids)
|
protected int |
updateRow(String updateQuery,
T row)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Table(Schema schema,
String tableName)
| Method Detail |
|---|
public static String aliasColumns(String rowAlias,
String columnList)
rowAlias - columnList -
public static String truncate(String value,
int maxSize)
value - maxSize -
public int getNextId()
throws SQLException
SQLException
protected abstract T fetchRow(ResultSet rs)
throws SQLException
rs -
SQLException
protected abstract void prepareInsert(String insertQuery,
PreparedStatement insert,
T row)
throws SQLException
insertQuery - insert - row -
SQLException
protected abstract void prepareUpdate(String updateQuery,
PreparedStatement update,
T row)
throws SQLException
updateQuery - update - row -
SQLException
protected T getUniqueRow(String query,
int id)
throws AdminPersistenceException
query - the sql query string must be like "select * from ... where ... id=?" where id is
an int column.id - references an unique row.
AdminPersistenceException
protected T getUniqueRow(String query,
String id)
throws AdminPersistenceException
query - the sql query string must be like "select * from ... where ... id=?" where id is
an String column.id - references an unique row.
AdminPersistenceException
protected List<String> getIds(String query)
throws AdminPersistenceException
query -
AdminPersistenceException
protected List<String> getIds(String query,
int id)
throws AdminPersistenceException
query - id -
AdminPersistenceException
protected List<String> getIds(String query,
List<?> params)
throws AdminPersistenceException
query - params -
AdminPersistenceException
protected List<T> getRows(String query)
throws AdminPersistenceException
query -
AdminPersistenceException
protected List<T> getRows(String query,
int id)
throws AdminPersistenceException
query - id -
AdminPersistenceException
protected List<T> getRows(String query,
List<?> params)
throws AdminPersistenceException
query - params -
AdminPersistenceException
protected void performPrepareStatementParams(PreparedStatement ps,
List<?> params)
throws SQLException
ps - params -
SQLException
protected int getCount(String tableName,
String whereClause,
String param)
throws AdminPersistenceException
tableName - whereClause - param -
AdminPersistenceException
protected int getCount(String tableName,
String whereClause,
int id,
String param)
throws AdminPersistenceException
tableName - whereClause - id - param -
AdminPersistenceException
protected List<T> getMatchingRows(String returnedColumns,
String[] matchColumns,
String[] matchValues)
throws AdminPersistenceException
returnedColumns - matchColumns - matchValues -
AdminPersistenceException
protected Integer getInteger(String query,
int[] ids)
throws AdminPersistenceException
query - ids -
AdminPersistenceException
protected T getUniqueRow(ResultSet rs)
throws SQLException,
AdminPersistenceException
SQLException
AdminPersistenceException
protected List<T> getRows(ResultSet rs)
throws SQLException
SQLException
protected List<String> getIds(ResultSet rs)
throws SQLException
SQLException
protected Integer getInteger(ResultSet rs)
throws SQLException,
AdminPersistenceException
SQLException
AdminPersistenceException
protected int insertRow(String insertQuery,
T row)
throws AdminPersistenceException
AdminPersistenceException
protected int updateRow(String updateQuery,
T row)
throws AdminPersistenceException
AdminPersistenceException
protected int updateRelation(String query)
throws AdminPersistenceException
AdminPersistenceException
protected int updateRelation(String query,
int param)
throws AdminPersistenceException
AdminPersistenceException
protected int updateRelation(String query,
int[] ids)
throws AdminPersistenceException
AdminPersistenceException
protected boolean addParamToQuery(Collection<Object> theVect,
StringBuilder theQuery,
String value,
String column,
boolean concatAndOr,
String andOr)
protected boolean addParamToQuery(Collection<Object> theVect,
StringBuilder theQuery,
Timestamp value,
String column,
boolean concatAndOr,
String andOr)
protected boolean addParamToQuery(Collection<Object> theVect,
StringBuilder theQuery,
int value,
String column,
boolean concatAndOr,
String andOr)
protected boolean addIdToQuery(Collection<Object> theVect,
StringBuilder theQuery,
int value,
String column,
boolean concatAndOr,
String andOr)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||