Class Table<T>
- java.lang.Object
-
- org.silverpeas.core.persistence.jdbc.AbstractTable<T>
-
- org.silverpeas.core.admin.persistence.Table<T>
-
- Direct Known Subclasses:
AccessLevelTable
,ComponentInstanceI18NTable
,ComponentInstanceTable
,DomainTable
,GroupUserRoleTable
,InstanceDataTable
,KeyStoreTable
,SpaceI18NTable
,SpaceTable
,SpaceUserRoleTable
,UserRoleTable
public abstract class Table<T> extends AbstractTable<T>
A Table object manages a table in a database.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 static String
aliasColumns(String rowAlias, String columnList)
Builds an aliased columns list from a row alias and a columns list.protected void
checkGroupExistence(int groupId)
protected void
checkUserExistence(int userId)
protected int
getCount(String tableName, String whereClause, int id, String param)
Returns the nb of rows in the given table aggregated on the given columnprotected int
getCount(String tableName, String whereClause, String param)
Returns the nb of rows in the given table aggregated on the given columnprotected 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 List<String>
getIds(ResultSet rs)
protected String
getNotNullString(String sn)
protected List<T>
getRows(String query, List<?> params)
Returns the rows described by the given query with parameters.protected void
performPrepareStatementParams(PreparedStatement ps, List<?> params)
Centralization of PreparedStatement parameter setting.protected int
updateRelation(String query)
-
Methods inherited from class org.silverpeas.core.persistence.jdbc.AbstractTable
fetchRow, getInteger, getInteger, getMatchingRows, getNextId, getRows, getRows, getRows, getRows, getRows, getRows, getRows, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, getUniqueRow, insertRow, prepareInsert, prepareUpdate, truncate, updateRelation, updateRelation, updateRow
-
-
-
-
Constructor Detail
-
Table
protected Table(String tableName)
-
-
Method Detail
-
aliasColumns
protected static String aliasColumns(String rowAlias, String columnList)
Builds an aliased columns list from a row alias and a columns list. Returns "u.id,u.firstName,u.lastName" for row alias "u" columns list "id,firstName,lastName".- Parameters:
rowAlias
-columnList
-- Returns:
-
checkUserExistence
protected void checkUserExistence(int userId) throws SQLException
- Throws:
SQLException
-
checkGroupExistence
protected void checkGroupExistence(int groupId) throws SQLException
- Throws:
SQLException
-
getIds
protected List<String> getIds(String query) throws SQLException
Returns the ids described by the given no parameters query.- Parameters:
query
-- Returns:
- Throws:
SQLException
-
getIds
protected List<String> getIds(String query, int id) throws SQLException
Returns the ids described by the given query with one id parameter.- Parameters:
query
-id
-- Returns:
- Throws:
SQLException
-
getIds
protected List<String> getIds(String query, List<?> params) throws SQLException
Returns the rows described by the given query with parameters.- Parameters:
query
-params
-- Returns:
- Throws:
SQLException
-
getRows
protected List<T> getRows(String query, List<?> params) throws SQLException
Returns the rows described by the given query with parameters.- Parameters:
query
-params
-- Returns:
- Throws:
SQLException
-
performPrepareStatementParams
protected void performPrepareStatementParams(PreparedStatement ps, List<?> params) throws SQLException
Centralization of PreparedStatement parameter setting.- Parameters:
ps
-params
-- Throws:
SQLException
-
getCount
protected int getCount(String tableName, String whereClause, String param) throws SQLException
Returns the nb of rows in the given table aggregated on the given column- Parameters:
tableName
-whereClause
-param
-- Returns:
- Throws:
SQLException
-
getCount
protected int getCount(String tableName, String whereClause, int id, String param) throws SQLException
Returns the nb of rows in the given table aggregated on the given column- Parameters:
tableName
-whereClause
-id
-param
-- Returns:
- Throws:
SQLException
-
getIds
protected List<String> getIds(ResultSet rs) throws SQLException
- Throws:
SQLException
-
updateRelation
protected int updateRelation(String query) throws SQLException
- Throws:
SQLException
-
addParamToQuery
protected boolean addParamToQuery(Collection<Object> theVect, StringBuilder theQuery, String value, String column, boolean concatAndOr, String andOr)
-
addParamToQuery
protected boolean addParamToQuery(Collection<Object> theVect, StringBuilder theQuery, int value, String column, boolean concatAndOr, String andOr)
-
addIdToQuery
protected boolean addIdToQuery(Collection<Object> theVect, StringBuilder theQuery, int value, String column, boolean concatAndOr, String andOr)
-
-