org.opensubsystems.patterns.listdata.persist.db
Interface ListDatabaseSchema

All Superinterfaces:
org.opensubsystems.core.persist.db.DatabaseSchema
All Known Implementing Classes:
ListDatabaseSchemaImpl, ModifiableListDatabaseSchemaImpl

public interface ListDatabaseSchema
extends org.opensubsystems.core.persist.db.DatabaseSchema

Base class for schemas allowing retrieving list of data objects.

Version:
$Id: ListDatabaseSchema.java,v 1.10 2007/01/07 06:14:23 bastafidli Exp $
Author:
Peter Satury
Code reviewer:
Miro Halas
Code reviewed:
1.8 2006/08/07 22:28:19 jlegeny

Method Summary
 java.lang.StringBuffer getColumns(boolean specific, int[] columns, java.lang.Object[] prefixes, java.lang.Object[] postfixes, java.lang.StringBuffer buffer)
          Convert any attribute regardless if it is in the main table or in join table into database column name.
 java.lang.String[] getJoinFromWhere(java.util.List conditions, int[] columns)
          Get from and where clause parts of the query in situation that the specified conditions refer to attributes, which are located in multiple tables.
 java.util.Map getMandatoryRetrieveColumns()
          Get collection of all columns that has to be retrieved for each data object supported by this schema.
 java.lang.String getSelectList(ListOptions options, int iDataType)
          Get query to select list of data objects.
 java.util.Map getSortableColumns()
          Get collection of all columns that can be used to sort data objects supported by this schema.
 boolean isExistingIndex(java.lang.String strIndexName)
          Check if the the data object will use specified index for constructing query to retrieve records into the list.
 
Methods inherited from interface org.opensubsystems.core.persist.db.DatabaseSchema
create, getDependentSchemas, getName, getVersion, handleSQLException, isInDomain, upgrade
 

Method Detail

getSelectList

java.lang.String getSelectList(ListOptions options,
                               int iDataType)
                               throws org.opensubsystems.core.error.OSSException
Get query to select list of data objects.

Parameters:
options - - options describing what data objects to retrieve
iDataType - - data type for which to retrieve the list
Returns:
String - query
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getJoinFromWhere

java.lang.String[] getJoinFromWhere(java.util.List conditions,
                                    int[] columns)
Get from and where clause parts of the query in situation that the specified conditions refer to attributes, which are located in multiple tables.

Parameters:
conditions - - list of DataConditions specifying what attributes will be included in the query
columns - - array of all columns to retrieve
Returns:
String[] - index 0 - from clause specifying all tables where the attributes are located without the from - index 1 - where clause specifying if there are multiple tables how to navigate from one to another

getColumns

java.lang.StringBuffer getColumns(boolean specific,
                                  int[] columns,
                                  java.lang.Object[] prefixes,
                                  java.lang.Object[] postfixes,
                                  java.lang.StringBuffer buffer)
                                  throws org.opensubsystems.core.error.OSSException
Convert any attribute regardless if it is in the main table or in join table into database column name.

Parameters:
specific - - if true - table_name.table_column, if false only table_column
columns - - specific array of columns codes
prefixes - - specific array of prefixes to prepend before each column, each prefix will be mapped with column and the same index they will be directly prepended or appended to the column name and therefore they need to contain any extra space if necessary, specify null, if no prefixes should be prepended
postfixes - - specific array of postfixes to prepend before each column, each prefix will be mapped with column and the same index they will be directly prepended or appended to the column name and therefore they need to contain any extra space if necessary, specify null, if no prefixes should be prepended
buffer - - buffer to use for column codes construction, it may already contain some value, if null, new one will be allocated
Returns:
StringBuffer - specific columns of table divided by comma with specified prefixes and postfixes
Throws:
org.opensubsystems.core.error.OSSException - - error in columns find

getMandatoryRetrieveColumns

java.util.Map getMandatoryRetrieveColumns()
Get collection of all columns that has to be retrieved for each data object supported by this schema. This method is required because the ListOptions allow use to specify columns that should be retrieved. If user interface allows user to specify these columns, the application may still need additional perhaps internal columns that needs to be retrieved as well for it to function correctly.

Returns:
Map - key is the data type, value is the int array (int[]) of column codes which has to be retrieved for a given data object.

getSortableColumns

java.util.Map getSortableColumns()
Get collection of all columns that can be used to sort data objects supported by this schema. This method is required since some databases do not allow use all columns in ORDER BY clases depending on the type of the column.

Returns:
Map - Key is the data type, value is the array of column codes (int[])which can be used for sorting.

isExistingIndex

boolean isExistingIndex(java.lang.String strIndexName)
Check if the the data object will use specified index for constructing query to retrieve records into the list.

Parameters:
strIndexName - - name of the index that will be checked for existency
Returns:
boolean - true if data object will use index


Copyright © 2003 - 2006 OpenSubsystems s.r.o.