|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensubsystems.patterns.listdata.persist.db.ListDatabaseUtils
public class ListDatabaseUtils
This class is used for common list retrieval and manipulation routines.
| Field Summary | |
|---|---|
static java.lang.String |
LIST_INDEX_PREFIX
Prefix that will be used for explicitely defined index name on columns that can be used within the ORDER BY clause for retrieving data to the list. |
| Constructor Summary | |
|---|---|
ListDatabaseUtils()
|
|
| Method Summary | |
|---|---|
protected java.util.List |
allocateObjectList(ListOptions options,
int iCount)
Method for allocating of the object list |
protected java.lang.String |
convertValueToSQL(java.lang.Object objValue,
int iValueType)
Convert the value to coresponding SQL representation based on it's data type. |
java.lang.String |
getConstructListIndexName(java.lang.String strTableName,
java.lang.String strColumnName)
Method construct name of the index used for data retrieving into the list. |
static ListDatabaseUtils |
getInstance()
Get database dependent instance of ListDatabaseUtils. |
java.util.List |
getObjectList(ListOptions options,
java.lang.String query,
ListDatabaseFactory factory,
ListDatabaseSchema schema)
Get list of data objects for specified parameters |
protected java.util.List |
getObjectListKeepSelected(ListDatabaseFactory factory,
java.sql.Connection cntConnection,
java.lang.String query,
ListOptions options,
java.util.List lstObjects,
ListDatabaseSchema schema)
Get list of data objects keeping the selected data object. |
protected int |
getSelectCount(java.sql.Connection cntConnection,
java.lang.String query,
ListDatabaseSchema schema,
int iDomainId)
Method for executing query for getting number of all items retrieved using count(x). |
java.lang.String |
getSelectList(java.lang.String strTableName,
ListOptions options,
ListDatabaseSchema schema)
Generate select query to returns data based on the list option describing what data objects to load taking into account filter decribing security restrictions that prevent us from loading data that the user doesn't have rights to see and all other filtering conditions. |
protected java.lang.String |
getSQLOperation(DataCondition condition)
Get SQL operation for operation and value of given data condition. |
protected java.lang.String |
getSQLValue(DataCondition condition)
Get SQL value for operation and value of given data condition.. |
protected int |
getTotalRecords(java.sql.ResultSet rsQueryResults,
ListOptions options)
Method for getting number of total records in result set using getRow() method. |
java.lang.String |
getWhereClause(java.lang.String strTableName,
int[] arrIds,
int[] arrDomainIds,
SimpleRule securityFilter,
ListDatabaseSchema schema)
Get where clause to select specified ids while taking into account specified security filter therefore retrieving only those data objects for which the access is granted. |
java.lang.String |
getWhereClause(java.lang.String strTableName,
int[] arrIds,
SimpleRule securityFilter,
ListDatabaseSchema schema)
Get where clause to select specified ids while taking into account specified security filter therefore retrieving only those data objects for which the access is granted. |
protected void |
parseCondition(java.lang.StringBuffer strBuffer,
DataCondition condition,
ListDatabaseSchema schema)
Parse DataCondition to SQL query expression. |
protected java.lang.String |
preprocessSelectQuery(java.lang.String inputQuery,
ListOptions options,
ListDatabaseSchema schema)
Method that preprocess query (by adding specific SQL clauses for example LIMIT, ...) to improve performance of selecting items from the list at specific position. |
protected java.lang.String |
preprocessSelectQueryForCreationDate(java.lang.String inputQuery,
ListOptions options,
ListDatabaseSchema schema)
Method that preprocess query (by adding specific SQL clauses after CREATION_DATE sort column) to fix ordering if DBS supports short timestamp value. |
protected ListOptions |
setOptionPositioning(int iCount,
ListOptions options)
Method set up begin position, end position and actual list size based on the total number of retrieved items. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String LIST_INDEX_PREFIX
| Constructor Detail |
|---|
public ListDatabaseUtils()
| Method Detail |
|---|
public static ListDatabaseUtils getInstance()
throws org.opensubsystems.core.error.OSSException
org.opensubsystems.core.error.OSSException - - an error has occured
public java.lang.String getConstructListIndexName(java.lang.String strTableName,
java.lang.String strColumnName)
strTableName - - name of the table that will be useed for index name costructionstrColumnName - - name of the column that will be useed for index name costruction
public java.util.List getObjectList(ListOptions options,
java.lang.String query,
ListDatabaseFactory factory,
ListDatabaseSchema schema)
throws org.opensubsystems.core.error.OSSException
options - - list option describing the list to retrievequery - - select SQL queryfactory - - list factory for specific data objectschema - - list database schema
org.opensubsystems.core.error.OSSException - - an error getting object list
protected java.util.List getObjectListKeepSelected(ListDatabaseFactory factory,
java.sql.Connection cntConnection,
java.lang.String query,
ListOptions options,
java.util.List lstObjects,
ListDatabaseSchema schema)
throws org.opensubsystems.core.error.OSSException,
java.sql.SQLException
factory - - list factory for specific data objectcntConnection - - connectionquery - - select SQL queryoptions - - list option describing the list to retrievelstObjects - - list of data objectsschema - - list database schema
org.opensubsystems.core.error.OSSException - - an error getting object list keeping selected
java.sql.SQLException - - an error getting object list keeping selected
public java.lang.String getSelectList(java.lang.String strTableName,
ListOptions options,
ListDatabaseSchema schema)
throws org.opensubsystems.core.error.OSSException
strTableName - - name of the table from which the data should be loadedoptions - - list options used to generate query to load list of dataschema - - list database schema implementation capable of providing
more info about attributes included in the query
org.opensubsystems.core.error.OSSException - - an error has occured
public java.lang.String getWhereClause(java.lang.String strTableName,
int[] arrIds,
SimpleRule securityFilter,
ListDatabaseSchema schema)
throws org.opensubsystems.core.error.OSSException
strTableName - - name of the table in databasearrIds - - array of Ids which should be selected, may be null when no
special IDs should be selectedsecurityFilter - - rule describing what data can user accessschema - - list database schema implementation capable of providing
more info about attributes included in the query
org.opensubsystems.core.error.OSSException - - error during parse
public java.lang.String getWhereClause(java.lang.String strTableName,
int[] arrIds,
int[] arrDomainIds,
SimpleRule securityFilter,
ListDatabaseSchema schema)
throws org.opensubsystems.core.error.OSSException
strTableName - - name of the table in databasearrIds - - array of Ids which should be selected, may be null when no
special IDs should be selectedarrDomainIds - - array of domain Ids in which should be selected arrIDs,
may be null and in that case will be used original
method getWhereClause() abovesecurityFilter - - rule describing what data can user accessschema - - list database schema implementation capable of providing
more info about attributes included in the query
org.opensubsystems.core.error.OSSException - - error during parse
protected java.lang.String preprocessSelectQuery(java.lang.String inputQuery,
ListOptions options,
ListDatabaseSchema schema)
throws org.opensubsystems.core.error.OSSException
inputQuery - - query that will be preprocessedoptions - - initialized list options that will be used for retrieving
begin position, page size, ...schema - - list database schema
org.opensubsystems.core.error.OSSException - - error during preprocessing select query
protected java.lang.String preprocessSelectQueryForCreationDate(java.lang.String inputQuery,
ListOptions options,
ListDatabaseSchema schema)
throws org.opensubsystems.core.error.OSSException
inputQuery - - query that will be preprocessedoptions - - initialized list options that will be used for retrieving
begin position, page size, ...schema - - list database schema
org.opensubsystems.core.error.OSSException - - error during preprocessing select query
protected void parseCondition(java.lang.StringBuffer strBuffer,
DataCondition condition,
ListDatabaseSchema schema)
throws org.opensubsystems.core.error.OSSException
strBuffer - - buffer to add SQL query expression tocondition - - condition to parseschema - - list database schema implementation capable of providing
more info about attributes included in the query
org.opensubsystems.core.error.OSSException - - an error has occured
protected java.lang.String getSQLOperation(DataCondition condition)
throws org.opensubsystems.core.error.OSSInvalidDataException
condition - - data condition to process
org.opensubsystems.core.error.OSSInvalidDataException - - error occured during parsing data
protected java.lang.String convertValueToSQL(java.lang.Object objValue,
int iValueType)
throws org.opensubsystems.core.error.OSSInvalidDataException
objValue - - value to convert to SQL string representation.iValueType - - one of the DataCondition.VALUE_TYPE_XXX constants
org.opensubsystems.core.error.OSSInvalidDataException - - error occured during parsing data
protected java.lang.String getSQLValue(DataCondition condition)
throws org.opensubsystems.core.error.OSSInvalidDataException
condition - - data condition to process
org.opensubsystems.core.error.OSSInvalidDataException - - error occured during parsing data
protected ListOptions setOptionPositioning(int iCount,
ListOptions options)
iCount - - number of itemsoptions - - options to be set up
protected int getSelectCount(java.sql.Connection cntConnection,
java.lang.String query,
ListDatabaseSchema schema,
int iDomainId)
throws org.opensubsystems.core.error.OSSException,
java.sql.SQLException
cntConnection - - db connectionquery - - original query to be executed to retrieve itemsschema - - list database schema implementation capable of providing
more info about attributes included in the queryiDomainId - - ID of the domain
org.opensubsystems.core.error.OSSException - - an error has occured
java.sql.SQLException - - error while executing query
protected java.util.List allocateObjectList(ListOptions options,
int iCount)
throws org.opensubsystems.core.error.OSSException
options - - list optionsiCount - - number of all items
org.opensubsystems.core.error.OSSException - - error occured during allocating object list
protected int getTotalRecords(java.sql.ResultSet rsQueryResults,
ListOptions options)
throws org.opensubsystems.core.error.OSSException,
java.sql.SQLException
rsQueryResults - - result setoptions - - list options
org.opensubsystems.core.error.OSSException - - an error has occured
java.sql.SQLException - - error while executing query
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||