com.sibvisions.rad.persist.jdbc
Class DBStorage

java.lang.Object
  extended by com.sibvisions.rad.persist.AbstractStorage
      extended by com.sibvisions.rad.persist.AbstractCachedStorage
          extended by com.sibvisions.rad.persist.jdbc.DBStorage
All Implemented Interfaces:
ICloseable, ICachedStorage, IStorage, INamedObject

public class DBStorage
extends AbstractCachedStorage

The DBStorage is a IStorage for SQL database specific features.

The DBStorage allows to influence the creation of the SELECT statement to get the data.
The following template shows how the SELECT will be constructed out of the specified properties.

 
 SELECT getBeforeQueryColumns() getQueryColumns()
 FROM   getFromClause()
 WHERE  getFilter()
 AND    getMasterReference()
 AND    getWhereClause()
 getAfterWhereClause()
 ORDER BY getSort()/getOrderByClause()
 
 
Example:
  
 SELECT DISTINCT // ++ comment, optimizer hints 
        a.COL1 C, b.COL2 D, a.FK_ID FK_ID, ...
 FROM   TABLE1 a,
        TABLE2 b,
        ...
 WHERE  C LIKE 'a%' AND D IS NOT NULL ... // getFilter().getSQL
 AND    FK_ID = 23                        // getMasterReference() get all detail rows to a 
                                             specific master row in an other DataBook
 AND    a.ID = b.FK_ID ...                // getLastWhereCondition() 
 GROUP BY C, D                            // getAfterWhereClause()
 ORDER BY C DESC                                                        // getSort() or getOrderByClause()
 
 

See Also:
IStorage, ColumnMetaData, RemoteDataBook, DBAccess

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sibvisions.rad.persist.AbstractStorage
AbstractStorage.AllFetchedList<E>
 
Field Summary
static java.lang.String SUBSTORAGE_PREFIX
          The prefix for substorages.
 
Constructor Summary
DBStorage()
          Constructs a DBStorage.
 
Method Summary
 void close()
          It close the DBStorage.
 void createAutomaticLinkReference(java.lang.String[] pColumns, DBStorage pDBStorage, java.lang.String[] pReferenceColumns)
          Creates and sets a new StorageReferenceDefinition with the specified DBStorage and columns and reference columns on all pColumns.
 void createAutomaticLinkReference(java.lang.String[] pColumns, java.lang.String pWritebackTable, java.lang.String[] pReferenceColumns)
          Creates and sets a new StorageReferenceDefinition with the specified FromClause and columns and reference columns on all pColumns.
protected  void createAutomaticLinkStorage(StorageReferenceDefinition pReferenceDefinition, java.lang.String[] pWritebackColumnNames)
          Creates a new DBStorage which is configured for automatic link cell editors.
protected  ServerMetaData createMetaData(java.lang.String pBeforeQueryColumns, java.lang.String[] pQueryColumns, java.lang.String pFromClause, java.lang.String pWhereClause, java.lang.String pAfterWhereClause, java.lang.String pWritebackTable, java.lang.String[] pWritebackColumns, boolean pAutoLinkReference, boolean pUseRepresentationColumnsAsQueryColumns)
          Returns the meta data for the specified DBStorage with all its parameters.
protected  java.lang.String createSubStorageName(DBStorage pDBStorage)
          Creates the sub storage name for an AutomaticLinkReference.
protected  void executeDelete(java.lang.Object[] pDeleteDataRow)
          This method has to be implemented in the Storage implementation and should have the functionality of the delete method.
protected  java.util.List<java.lang.Object[]> executeFetch(ICondition pFilter, SortDefinition pSort, int pFromRow, int pMinimumRowCount)
          This method has to be implemented in the Storage implementation and should have the functionality of the fetch method.
protected  java.lang.Object[] executeInsert(java.lang.Object[] pDataRow)
          This method has to be implemented in the Storage implementation and should have the functionality of the insert method.
protected  java.lang.Object[] executeRefetchRow(java.lang.Object[] pDataRow)
          This method has to be implemented in the Storage implementation and should have the functionality of the refetchRow method.
protected  java.lang.Object[] executeUpdate(java.lang.Object[] pOldDataRow, java.lang.Object[] pNewDataRow)
          This method has to be implemented in the Storage implementation and should have the functionality of the update method.
 java.lang.String[] getAdditionalQueryColumns()
          Returns the additional query columns of the SELECT statement.
 java.lang.String getAfterWhereClause()
          Returns the string to place in the SELECT statement after the WHERE clause and before the ORDER BY clause.
 java.lang.String getBeforeQueryColumns()
          Returns the string to place in the SELECT statement between the SELECT and the first query column.
 IDBAccess getDBAccess()
          Returns the IDBAccess of this DBStorage .
 SortDefinition getDefaultSort()
          Returns the default sort.
 int getEstimatedRowCount(ICondition pFilter)
          Returns the number of rows in this AbstractStorage from the storage.
 java.lang.String getFromClause()
          Returns the query tables to use in the SELECT statement to get the data from the storage.
 MetaData getMetaData()
          Returns the meta data for this AbstractStorage from the storage as MetaData.
 java.lang.String getOrderByClause()
          Returns the string to place in the ORDER BY section if no default sort is set.
 java.lang.String[] getQueryColumns()
          Returns the query columns of the SELECT statement.
 ICondition getRestrictCondition()
          Returns the restrict condition.
 java.util.Map<java.lang.String,DBStorage> getSubStorages()
          Gets all known sub storages as key/value pair.
 java.lang.String getWhereClause()
          Returns the string to place in the SELECT statement after the last WHERE condition from the Filter or MasterReference (Master-Detail Condition).
 java.lang.String[] getWritebackColumns()
          Returns the list of write back columns to use in the INSERT, UPDATE statements.
 java.lang.String getWritebackTable()
          Returns the WritebackTable, which is used for the INSERT, UPDATE, DELETE calls.
protected  java.lang.String getWritebackTableCatalog()
          Gets the catalog name of the writeback table.
protected  java.lang.String getWritebackTableSchema()
          Gets the schema name of the writeback table.
protected  void installAutomaticLinkReferenceIntern(StorageReferenceDefinition pReferenceDefinition)
          Creates and sets a new StorageReferenceDefinition with the specified DBStorage(or from clause) and columns and reference columns on all pColumns.
 boolean isAllowedValues()
          Returns the allowed value detection mode.
 boolean isAutoLinkReference()
          Returns if the automatic LinkReference mode is on or off.
protected  boolean isAutomaticLinkNullable(java.lang.String[] pColumns, ServerColumnMetaData[] pColumnMetaData)
          True, if one of the writable columns is nullable.
static boolean isDefaultAllowedValues()
          Returns the default allowed value detection mode.
static boolean isDefaultAutoLinkReference()
          Returns the default automatic LinkReference mode.
static boolean isDefaultDefaultValue()
          Returns the default - default value detection mode.
 boolean isDefaultValue()
          Returns the default value detection mode.
 boolean isLazyFetchEnabled()
          If lazy fetch should be enabled.
 boolean isLockOnRefetch()
          True, if refetch should lock the row.
 boolean isOpen()
          Returns if the DBStorage is open.
 void open()
          Opens the DBStorage and checks if the DBAssess is !
protected  void openInternal(boolean pUseRepresentationColumnsAsQueryColumns)
          Opens the DBStorage and checks if the DBAccess is !
protected  java.lang.Object[] refetchRow(java.lang.Object[] pDataRow, boolean pLock)
          Refetch and optional locks the specified DataRow via PK.
protected  void refreshMetaData()
          Refreshs the MetaData with initial settings.
 void setAdditionalQueryColumns(java.lang.String[] pAdditionalQueryColumns)
          Sets the additional query columns of the SELECT statement.
 void setAfterWhereClause(java.lang.String pAfterWhereClause)
          Sets the string to place in the SELECT statement after the WHERE clause and before the ORDER BY clause.
 void setAllowedValues(boolean pAllowedValues)
          Sets the allowed value detection en- or disabled.
 void setAutoLinkReference(boolean pAutoLinkReference)
          Sets if the automatic link reference detection is en- or disabled.
 void setBeforeQueryColumns(java.lang.String pBeforeQueryColumns)
          Sets the string to place in the SELECT statement between the SELECT and the first query column.
 void setDBAccess(IDBAccess pDBAccess)
          Set the IDBAccess of this DBStorage .
static void setDefaultAllowedValues(boolean pAllowedValues)
          Sets the default allowed value detection en- or disabled.
static void setDefaultAutoLinkReference(boolean pDefaultAutoLinkReference)
          Sets the default automatic link reference detection mode.
static void setDefaultDefaultValue(boolean pDefaultValue)
          Sets the default - default value detection en- or disabled.
 void setDefaultSort(SortDefinition pDefaultSort)
          Sets the default sort.
 void setDefaultValue(boolean pDefaultValue)
          Sets the default value detection en- or disabled.
 void setFromClause(java.lang.String pFromClause)
          Sets the query tables to use in the SELECT statement to get the data from the storage.
 void setLazyFetchEnabled(boolean pLazyFetchEnabled)
          Sets if lazy fetch should be enabled.
 void setLockOnRefetch(boolean pLockOnRefetch)
          True, if refetch should lock the row.
 void setMetaData(MetaData pMetaData)
          Sets a new meta data.
 void setOrderByClause(java.lang.String pOrderByClause)
          Sets the string to place in the ORDER BY section if no default sort is set.
 void setQueryColumns(java.lang.String[] pQueryColumns)
          Sets the query columns of the SELECT statement.
 void setRestrictCondition(ICondition pRestrictCondition)
          Sets the restrict condition.
 void setWhereClause(java.lang.String pWhereClause)
          Sets the string to place in the SELECT statement after the last WHERE condition from the Filter or MasterReference (Master-Detail Condition).
 void setWritebackColumns(java.lang.String[] pWritebackColumns)
          Sets the list of write back columns to use in the INSERT, UPDATE statements.
 void setWritebackTable(java.lang.String pWritebackTable)
          Sets the WritebackTable, which is used for the INSERT, UPDATE, DELETE calls.
 java.lang.String toString()
          
 void writeCSV(java.io.OutputStream pOutputStream, java.lang.String[] pColumnNames, java.lang.String[] pLabels, ICondition pFilter, SortDefinition pSort, java.lang.String pSeparator)
          Write the current storage with the specified filter and sort into the given output stream as CSV Format.
 
Methods inherited from class com.sibvisions.rad.persist.AbstractCachedStorage
clearMetaData, clearMetaData, getMetaData, getMetaData, getMetaDataCacheGroups, getMetaDataCacheOption, getMetaDataFromCache, getMetaDataFromCache, isGlobalMetaDataCacheEnabled, isMetaDataCacheEnabled, putMetaDataToCache, removeMetaData, setGlobalMetaDataCacheEnabled, setMetaDataCacheOption
 
Methods inherited from class com.sibvisions.rad.persist.AbstractStorage
createBean, createBeanType, createCSV, createCSV, createCSV, createEmptyBean, createPOJO, createPOJO, debug, delete, delete, error, eventAfterDelete, eventAfterInsert, eventAfterUpdate, eventBeforeDelete, eventBeforeInsert, eventBeforeUpdate, eventCalculateRow, eventInsteadOfDelete, eventInsteadOfInsert, eventInsteadOfUpdate, executeDeleteAsBean, executeFetchAsBean, executeInsertAsBean, executeRefetchRowAsBean, executeUpdateAsBean, fetch, fetch, fetch, fetchBean, fetchBean, getAndInitBeanType, getBeanConverter, getName, getPropertyNameForColumn, hasInsteadOfDeleteEventHandler, hasInsteadOfInsertEventHandler, hasInsteadOfUpdateEventHandler, info, insert, insert, isLogEnabled, isRefetch, refetch, refetchRow, setName, setPropertyNameForColumn, setRefetch, update, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.persist.IStorage
delete, fetch, insert, refetchRow, update
 

Field Detail

SUBSTORAGE_PREFIX

public static final java.lang.String SUBSTORAGE_PREFIX
The prefix for substorages.

See Also:
Constant Field Values
Constructor Detail

DBStorage

public DBStorage()
Constructs a DBStorage.

Method Detail

writeCSV

public void writeCSV(java.io.OutputStream pOutputStream,
                     java.lang.String[] pColumnNames,
                     java.lang.String[] pLabels,
                     ICondition pFilter,
                     SortDefinition pSort,
                     java.lang.String pSeparator)
              throws java.lang.Exception
Write the current storage with the specified filter and sort into the given output stream as CSV Format.

Specified by:
writeCSV in class AbstractStorage
Parameters:
pOutputStream - the output stream to use for the CSV stream
pColumnNames - the column names to include in the export
pLabels - the labels to show as header in the export
pFilter - the condition
pSort - the sort definition
pSeparator - the column separator
Throws:
java.lang.Exception - if the CSV output couldn't written to stream

getMetaData

@Accessible
public MetaData getMetaData()
                     throws DataSourceException
Returns the meta data for this AbstractStorage from the storage as MetaData.

Returns:
the meta data for this AbstractStorage from the storage as MetaData.
Throws:
DataSourceException - if an Exception occur during getting the meta data from the storage.

getEstimatedRowCount

public int getEstimatedRowCount(ICondition pFilter)
                         throws DataSourceException
Returns the number of rows in this AbstractStorage from the storage.
It consider the specified ICondition to count the rows.

Parameters:
pFilter - the ICondition to use.
Returns:
the number of rows in this AbstractStorage from the storage.
Throws:
DataSourceException - if an Exception occur during interacting with the storage.

executeFetch

protected java.util.List<java.lang.Object[]> executeFetch(ICondition pFilter,
                                                          SortDefinition pSort,
                                                          int pFromRow,
                                                          int pMinimumRowCount)
                                                   throws DataSourceException
This method has to be implemented in the Storage implementation and should have the functionality of the fetch method.

Specified by:
executeFetch in class AbstractStorage
Parameters:
pFilter - the ICondition to use.
pSort - the SortDefinition to use.
pFromRow - the from row index to request from storage.
pMinimumRowCount - the minimum row count to request, beginning from the pFromRow.
Returns:
the requested rows as List[Object[]].
Throws:
DataSourceException - if an Exception occur during interacting with the storage.
See Also:
IStorage.fetch(ICondition, SortDefinition, int, int)

executeRefetchRow

protected java.lang.Object[] executeRefetchRow(java.lang.Object[] pDataRow)
                                        throws DataSourceException
This method has to be implemented in the Storage implementation and should have the functionality of the refetchRow method.

Specified by:
executeRefetchRow in class AbstractStorage
Parameters:
pDataRow - the specified row as Object[].
Returns:
the refetched row as Object[].
Throws:
DataSourceException - if an Exception occur during interacting with the storage.
See Also:
IStorage.refetchRow(Object[])

executeInsert

protected java.lang.Object[] executeInsert(java.lang.Object[] pDataRow)
                                    throws DataSourceException
This method has to be implemented in the Storage implementation and should have the functionality of the insert method.

Specified by:
executeInsert in class AbstractStorage
Parameters:
pDataRow - the new row as Object[] to insert.
Returns:
the newly inserted row from this IStorage. null if no insert operation was performed.
Throws:
DataSourceException - if an Exception occur during insert the row to the storage
See Also:
IStorage.insert(Object[])

executeUpdate

protected java.lang.Object[] executeUpdate(java.lang.Object[] pOldDataRow,
                                           java.lang.Object[] pNewDataRow)
                                    throws DataSourceException
This method has to be implemented in the Storage implementation and should have the functionality of the update method.

Specified by:
executeUpdate in class AbstractStorage
Parameters:
pOldDataRow - the old row as Object[]
pNewDataRow - the new row as Object[] to update
Returns:
the updated row as Object[]. null if no update operation was performed.
Throws:
DataSourceException - if an Exception occur during updating the row.
See Also:
IStorage.update(Object[], Object[])

executeDelete

protected void executeDelete(java.lang.Object[] pDeleteDataRow)
                      throws DataSourceException
This method has to be implemented in the Storage implementation and should have the functionality of the delete method.

Specified by:
executeDelete in class AbstractStorage
Parameters:
pDeleteDataRow - the row as Object[] to delete.
Throws:
DataSourceException - if an Exception occur during deleting the row or if the storage isn't opened or the PrimaryKey is wrong and more/less then one row is deleted.
See Also:
IStorage.delete(Object[])

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

setMetaData

public void setMetaData(MetaData pMetaData)
                 throws DataSourceException
Sets a new meta data. This is only possible, if the storage is not open.

Parameters:
pMetaData - the new meta data.
Throws:
DataSourceException - if the Storage is already open.

open

public void open()
          throws DataSourceException
Opens the DBStorage and checks if the DBAssess is != null. If automatic link celleditors are used, then the implicit link DBStorge objects are put with "detailtablename" as sub storage.

Throws:
DataSourceException - if the DBAccess is null.

openInternal

protected void openInternal(boolean pUseRepresentationColumnsAsQueryColumns)
                     throws DataSourceException
Opens the DBStorage and checks if the DBAccess is != null. It doesn't cache the MetaData!

Parameters:
pUseRepresentationColumnsAsQueryColumns - yes if the QueryColumns are set with all representation columns including the Primary Key columns.
Throws:
DataSourceException - if the DBAccess is null.

refreshMetaData

protected void refreshMetaData()
                        throws DataSourceException
Refreshs the MetaData with initial settings.

Throws:
DataSourceException - if the DBAccess is null.

createAutomaticLinkReference

public void createAutomaticLinkReference(java.lang.String[] pColumns,
                                         java.lang.String pWritebackTable,
                                         java.lang.String[] pReferenceColumns)
                                  throws DataSourceException
Creates and sets a new StorageReferenceDefinition with the specified FromClause and columns and reference columns on all pColumns. e.g. its used to make an automatic linked celleditor from a custom written view and set it on all pColumns.

Parameters:
pColumns - the columns to use.
pWritebackTable - the FromClause. e.g. VIEW name.
pReferenceColumns - the reference columns to use.
Throws:
DataSourceException - if the StorageReferenceDefinition couldn't created.

createAutomaticLinkReference

public void createAutomaticLinkReference(java.lang.String[] pColumns,
                                         DBStorage pDBStorage,
                                         java.lang.String[] pReferenceColumns)
                                  throws DataSourceException
Creates and sets a new StorageReferenceDefinition with the specified DBStorage and columns and reference columns on all pColumns.

Parameters:
pColumns - the columns to use.
pDBStorage - the DBStorage to use.
pReferenceColumns - the reference columns to use.
Throws:
DataSourceException - if the StorageReferenceDefinition couldn't created.

installAutomaticLinkReferenceIntern

protected void installAutomaticLinkReferenceIntern(StorageReferenceDefinition pReferenceDefinition)
                                            throws DataSourceException
Creates and sets a new StorageReferenceDefinition with the specified DBStorage(or from clause) and columns and reference columns on all pColumns.

Parameters:
pReferenceDefinition - the reference definition
Throws:
DataSourceException - if the StorageReferenceDefinition couldn't created.

createSubStorageName

protected java.lang.String createSubStorageName(DBStorage pDBStorage)
Creates the sub storage name for an AutomaticLinkReference.

Parameters:
pDBStorage - the DBStorage to use.
Returns:
the substorage name for an AutomaticLinkReference.

createAutomaticLinkStorage

protected void createAutomaticLinkStorage(StorageReferenceDefinition pReferenceDefinition,
                                          java.lang.String[] pWritebackColumnNames)
                                   throws DataSourceException
Creates a new DBStorage which is configured for automatic link cell editors. The auto link reference feature is disabled for this storage.

Parameters:
pReferenceDefinition - the storage definition
pWritebackColumnNames - the write back columns
Throws:
DataSourceException - if the from clause causes errors or the metadata are not available

isAutomaticLinkNullable

protected boolean isAutomaticLinkNullable(java.lang.String[] pColumns,
                                          ServerColumnMetaData[] pColumnMetaData)
True, if one of the writable columns is nullable.

Parameters:
pColumns - the columns
pColumnMetaData - the meta data
Returns:
True, if one of the writable columns is nullable.

createMetaData

protected ServerMetaData createMetaData(java.lang.String pBeforeQueryColumns,
                                        java.lang.String[] pQueryColumns,
                                        java.lang.String pFromClause,
                                        java.lang.String pWhereClause,
                                        java.lang.String pAfterWhereClause,
                                        java.lang.String pWritebackTable,
                                        java.lang.String[] pWritebackColumns,
                                        boolean pAutoLinkReference,
                                        boolean pUseRepresentationColumnsAsQueryColumns)
                                 throws DataSourceException
Returns the meta data for the specified DBStorage with all its parameters.

Parameters:
pBeforeQueryColumns - the before query columns
pQueryColumns - the query columns
pFromClause - the from clause with query tables and join definitions
pWhereClause - the last where condition in query
pAfterWhereClause - the after where clause in query
pWritebackTable - the write back table to use.
pWritebackColumns - the write back columns to use.
pAutoLinkReference - yes if the LinkReferences are automatic set.
pUseRepresentationColumnsAsQueryColumns - yes if the QueryColumns are set with all representation columns including the Primary Key columns.
Returns:
the ServerMetaData
Throws:
DataSourceException - if the meta data couldn't determined.

isOpen

public boolean isOpen()
Returns if the DBStorage is open.

Returns:
true if the DBStorage is open.

close

public void close()
It close the DBStorage.


setDBAccess

public void setDBAccess(IDBAccess pDBAccess)
Set the IDBAccess of this DBStorage .

Parameters:
pDBAccess - the IDBAccess of this DBStorage .

getDBAccess

public IDBAccess getDBAccess()
Returns the IDBAccess of this DBStorage .

Returns:
the IDBAccess of this DBStorage .

getFromClause

public java.lang.String getFromClause()
Returns the query tables to use in the SELECT statement to get the data from the storage.

Returns:
the query tables to use in the SELECT statement to get the data from the storage.

setFromClause

public void setFromClause(java.lang.String pFromClause)
Sets the query tables to use in the SELECT statement to get the data from the storage.

Parameters:
pFromClause - the queryTables to set.

getQueryColumns

public java.lang.String[] getQueryColumns()
Returns the query columns of the SELECT statement.

Returns:
the query columns of the SELECT statement.

setQueryColumns

public void setQueryColumns(java.lang.String[] pQueryColumns)
Sets the query columns of the SELECT statement.

Parameters:
pQueryColumns - the queryColumns to set

getAdditionalQueryColumns

public java.lang.String[] getAdditionalQueryColumns()
Returns the additional query columns of the SELECT statement.

Returns:
the additional query columns of the SELECT statement.

setAdditionalQueryColumns

public void setAdditionalQueryColumns(java.lang.String[] pAdditionalQueryColumns)
Sets the additional query columns of the SELECT statement.

Parameters:
pAdditionalQueryColumns - the additional queryColumns to set

getBeforeQueryColumns

public java.lang.String getBeforeQueryColumns()
Returns the string to place in the SELECT statement between the SELECT and the first query column.

Returns:
the string to place in the SELECT statement between the SELECT and the first query column.

setBeforeQueryColumns

public void setBeforeQueryColumns(java.lang.String pBeforeQueryColumns)
Sets the string to place in the SELECT statement between the SELECT and the first query column.

Parameters:
pBeforeQueryColumns - the beforeQueryColumns to set

getWhereClause

public java.lang.String getWhereClause()
Returns the string to place in the SELECT statement after the last WHERE condition from the Filter or MasterReference (Master-Detail Condition).

Returns:
the string to place in the SELECT statement after the last WHERE condition from the Filter or MasterReference (Master-Detail Condition).

setWhereClause

public void setWhereClause(java.lang.String pWhereClause)
Sets the string to place in the SELECT statement after the last WHERE condition from the Filter or MasterReference (Master-Detail Condition).

Parameters:
pWhereClause - the last Where Condition to set

getAfterWhereClause

public java.lang.String getAfterWhereClause()
Returns the string to place in the SELECT statement after the WHERE clause and before the ORDER BY clause.

Returns:
the string to place in the SELECT statement after the WHERE clause and before the ORDER BY clause.

setAfterWhereClause

public void setAfterWhereClause(java.lang.String pAfterWhereClause)
Sets the string to place in the SELECT statement after the WHERE clause and before the ORDER BY clause. e.g. GROUP BY a, HAVING ...

Parameters:
pAfterWhereClause - the afterWhereClause to set

getOrderByClause

public java.lang.String getOrderByClause()
Returns the string to place in the ORDER BY section if no default sort is set.

Returns:
the string to place in the ORDER BY section if no default sort is set.

setOrderByClause

public void setOrderByClause(java.lang.String pOrderByClause)
Sets the string to place in the ORDER BY section if no default sort is set.

Parameters:
pOrderByClause - the string to place in the ORDER BY section if no default sort is set.

getWritebackColumns

public java.lang.String[] getWritebackColumns()
Returns the list of write back columns to use in the INSERT, UPDATE statements.

Returns:
the saWritebackColumns.

setWritebackColumns

public void setWritebackColumns(java.lang.String[] pWritebackColumns)
Sets the list of write back columns to use in the INSERT, UPDATE statements.

Parameters:
pWritebackColumns - the pWritebackColumns to set

getWritebackTable

public java.lang.String getWritebackTable()
Returns the WritebackTable, which is used for the INSERT, UPDATE, DELETE calls.

Returns:
the sWritebackTable.

setWritebackTable

public void setWritebackTable(java.lang.String pWritebackTable)
Sets the WritebackTable, which is used for the INSERT, UPDATE, DELETE calls.

Parameters:
pWritebackTable - the pWritebackTable to set

getDefaultSort

public SortDefinition getDefaultSort()
Returns the default sort. It is used, if no other sort is defined.

Returns:
the default sort.

setDefaultSort

public void setDefaultSort(SortDefinition pDefaultSort)
Sets the default sort. It is used, if no other sort is defined.

Parameters:
pDefaultSort - the default sort.

getRestrictCondition

public ICondition getRestrictCondition()
Returns the restrict condition. It is always added with And to any given condition.

Returns:
the restrict condition.

setRestrictCondition

public void setRestrictCondition(ICondition pRestrictCondition)
Sets the restrict condition. It is always added with And to any given condition.

Parameters:
pRestrictCondition - the restrict condition.

setAutoLinkReference

public void setAutoLinkReference(boolean pAutoLinkReference)
Sets if the automatic link reference detection is en- or disabled. The automatic link reference is defined through a foreign key reference in the database.

Parameters:
pAutoLinkReference - true if the automatic LinkReference mode is on, false to disable auto link reference mode

isAutoLinkReference

public boolean isAutoLinkReference()
Returns if the automatic LinkReference mode is on or off.

Returns:
trueif the automatic LinkReference mode is on, otherwise false
See Also:
setAutoLinkReference(boolean)

setDefaultAutoLinkReference

public static void setDefaultAutoLinkReference(boolean pDefaultAutoLinkReference)
Sets the default automatic link reference detection mode. The automatic link reference is defined through a foreign key reference in the database.

Parameters:
pDefaultAutoLinkReference - the default automatic LinkReference mode to use.

isDefaultAutoLinkReference

public static boolean isDefaultAutoLinkReference()
Returns the default automatic LinkReference mode.

Returns:
the default automatic LinkReference mode.
See Also:
setDefaultAutoLinkReference(boolean)

setDefaultValue

public void setDefaultValue(boolean pDefaultValue)
Sets the default value detection en- or disabled. The default value is a default value for a column in the database

Parameters:
pDefaultValue - true to enable the default value detection

isDefaultValue

public boolean isDefaultValue()
Returns the default value detection mode.

Returns:
true if the default value detection is enabled, false otherwise
See Also:
setDefaultValue(boolean)

setDefaultDefaultValue

public static void setDefaultDefaultValue(boolean pDefaultValue)
Sets the default - default value detection en- or disabled. The default value is a default value for a column in the database.

Parameters:
pDefaultValue - true to enable the default - default value detection

isDefaultDefaultValue

public static boolean isDefaultDefaultValue()
Returns the default - default value detection mode.

Returns:
true if the default - default value detection is enabled, false otherwise
See Also:
setDefaultDefaultValue(boolean)

setAllowedValues

public void setAllowedValues(boolean pAllowedValues)
Sets the allowed value detection en- or disabled. An allowed value is defined in the database through check constraints.

Parameters:
pAllowedValues - true to enable the allowed value detection, false otherwise

isAllowedValues

public boolean isAllowedValues()
Returns the allowed value detection mode.

Returns:
true if the allowed value detection is enabled, false otherwise
See Also:
setAllowedValues(boolean)

setDefaultAllowedValues

public static void setDefaultAllowedValues(boolean pAllowedValues)
Sets the default allowed value detection en- or disabled. An allowed value is defined in the database through check constraints.

Parameters:
pAllowedValues - true to enable the default allowed value detection, false otherwise

isDefaultAllowedValues

public static boolean isDefaultAllowedValues()
Returns the default allowed value detection mode.

Returns:
true if the default allowed value detection is enabled, false otherwise
See Also:
setDefaultAllowedValues(boolean)

isLazyFetchEnabled

public boolean isLazyFetchEnabled()
If lazy fetch should be enabled.

Returns:
true if lazy fetch should be enabled.

setLazyFetchEnabled

public void setLazyFetchEnabled(boolean pLazyFetchEnabled)
Sets if lazy fetch should be enabled.

Parameters:
pLazyFetchEnabled - if lazy fetch should be enabled.

isLockOnRefetch

public boolean isLockOnRefetch()
True, if refetch should lock the row.

Returns:
true if refetch should lock the row.

setLockOnRefetch

public void setLockOnRefetch(boolean pLockOnRefetch)
True, if refetch should lock the row.

Parameters:
pLockOnRefetch - if refetch should lock the row.

getWritebackTableCatalog

protected java.lang.String getWritebackTableCatalog()
Gets the catalog name of the writeback table.

Returns:
the detected catalog name or null if no writeback table is set

getWritebackTableSchema

protected java.lang.String getWritebackTableSchema()
Gets the schema name of the writeback table.

Returns:
the detected schema name or null if no writeback table is set

refetchRow

protected java.lang.Object[] refetchRow(java.lang.Object[] pDataRow,
                                        boolean pLock)
                                 throws DataSourceException
Refetch and optional locks the specified DataRow via PK.

Parameters:
pDataRow - the DataRow to refetch
pLock - true if the row is locked before.
Returns:
the refetched DataRow
Throws:
DataSourceException - if the refetch fails

getSubStorages

@Accessible
public java.util.Map<java.lang.String,DBStorage> getSubStorages()
Gets all known sub storages as key/value pair.

Returns:
the key/value pair with subtablename and substorage or null if no substorages are known


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.