|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.dataobjects.BaseDataObject
com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
Base class for JDBC-based data objects.
| Field Summary | |
boolean |
anyFieldsDistinct
If setFieldDistinct has been used to specify distinct/unique fields for the next query. |
protected boolean |
anyFieldsToRetrieve
If setFieldsToRetrieve has been used to specify fields which will be retrieve by the next query. |
protected boolean |
appendCustomWhere
Flag to indicate whether we append any custom WHERE clause to the one generated, or just use the supplied custom WHERE clause |
protected boolean |
caseSensitiveQuery
This flag tells the buildWhereClause method(s) to either be case sensitive (normal queries) or to be case insensitive. |
protected String |
customWhereClause
If we are using a custom where clause for this query, it's stored here. |
protected String |
dbKey
dbKey is used to indicate that this object is actually stored in other than the default database. |
protected HashMap |
distinctFields
Map of any distinct fields for retrieval. |
protected DBConnection |
localConnection
Local connection that we use if it's initialized, but if it's null we generate our own connection |
static int |
LONGBINARY_READ_DEFAULT_SIZE
|
protected int |
maxRecords
|
protected String |
myClassName
We use getClass().getName() a lot in this class, however, it takes actually significant time to use this over the time it takes to do, say, a concurrentReaderHashMap lookup. |
protected ArrayList |
myUpdates
Holds the FieldUpdate objects representing any changes made to this object since it was retrieved |
protected int |
offsetRecord
The number of records we must skip over before we start reading the ResultSet proper in a searchAndRetrieve.
0 means no limit
author Peter Pilgrim, Thu Jun 21 10:30:59 BST 2001 |
protected ArrayList |
recordSet
The ArrayList of DB objects retrieved by the last searchAndRetrieve method |
HashMap |
retrieveFields
The actual fields retrieved |
protected static EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap |
sMetadataMap
DBObjects themselves do not contain the "meta data" or the definition of what fields they contain and other information. |
protected ArrayList |
sortKeys
The list of fields by which this object should be sorted when records are retrieved |
| Fields inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject |
currentStatus, globalMask |
| Fields inherited from interface com.jcorporate.expresso.core.dataobjects.DataObject |
STATUS_CURRENT, STATUS_DELETED, STATUS_NEW, STATUS_UPDATED |
| Constructor Summary | |
JDBCDataObject()
Default constructor |
|
| Method Summary | |
protected void |
addInParam(String inFieldName)
Add a new field to the list of fields that are part of this object's list of input parameters. |
protected void |
addOutParam(String outFieldName)
Add a new field to the list of fields that are part of this object's list of output parameter. |
String |
buildWhereClause(boolean useAllFields)
Build and return a string consisting of an SQL 'where' clause using the current field values as criteria for the search. |
protected FastStringBuffer |
buildWhereClauseBuffer(boolean useAllFields,
FastStringBuffer allocatedBuffer)
Build and return a FastStringBuffer ring consisting of an SQL 'where' clause using the current field values as criteria for the search. |
boolean |
checkZeroUpdate()
Returns the checkzero update as defined by the object's metadata. |
protected DBObjectDef |
constructNewMetaData()
Construction method to allow for specialized metadata with specialized fields other than DBObjectDef. |
DBConnection |
createAndExecuteSearch(ArrayList retrievedFieldList)
Refactoring to split the execution of a query statement into the query part and the load part. |
DBConnection |
createAndRunStoreProcedure(ArrayList retrievedFieldList)
Refactoring to split the execution of a query statement into the query part and the load part. |
DBConnectionPool |
getConnectionPool()
Retrieve the connection pool associated with this DBObject. |
String |
getCustomStringFieldValue(DBConnection connection,
String oneFieldName)
This convenience method retrieve through the resultSet.MetaData the date value of field define as date or time DBObject |
protected DBObjectDef |
getDef()
Return the DBObjectRef object that contains the definition of the current DBObject. |
ArrayList |
getDistinctFieldArrayList()
Get a special ArrayList object list of all
of the fields in this object that are set to distinct |
DataExecutorInterface |
getExecutor()
Use this function to acquire the Executor interface that is associated with this data object |
Iterator |
getFieldsToRetrieveIterator()
Get a special Iterator object list of all
of the fields in this object that are set to retrieve
Author Yves henri Amaizo |
JDBCObjectMetaData |
getJDBCMetaData()
Retrieve the JDBCObjectMetaData |
protected JDBCUtil |
getJDBCUtil()
Get the JDBC Util functions |
DBConnection |
getLocalConnection()
Return local DBConnection value author Yves Henri AMAIZO <amy_amaizo@compuserve.com> |
String |
getMappedDataContext()
Returns the name of the physical database that we're talking with. |
DataObjectMetaData |
getMetaData()
Retrieve the database object's metadata |
DataQueryInterface |
getQueryInterface()
Use this function to acquire the DataQueryInterface that is associated with this data object |
String |
getSerialForm(DataFieldMetaData theField)
This function is called whenever the DBField is about to be written to the database. |
void |
loadFromConnection(JDBCDataObject myObj,
DBConnection myConnection,
ArrayList retrievedFieldList)
Fills the given constructed data object with data from the connection given the field order specified in retrievedFieldList. |
protected String |
makeLimitationStub(DBConnection theConnection)
Creates the limitation syntax optimisation stub to embed inside the SQL command that performs search and retrieve. |
String |
quoteIfNeeded(String fieldName,
String rangeString)
Return the value of this field, placing double quotes around it if the field's datatype requires it. |
void |
runStoredProcedure()
Run a particular store procedure in the database into this object's fields |
protected ArrayList |
runStoredProcedureAndRetrieveList()
Run a particular store procedure in the database into this object's fields |
String |
selectFieldString(String fieldName)
Build an appropriate String for use in the select part of an SQL statement by doing the |
void |
setCaseSensitiveQuery(boolean caseSensitiveQuery)
This tells the buildWhereClause to either respect case (true) or ignore case (false). |
void |
setConnection(DBConnection newConnection)
Set a specific DB connection for use with this db object. |
void |
setConnection(DBConnection newConnection,
String setupTablesContext)
Set a specific DB connection for use with this db object. |
protected void |
setDBConnectionPool(DBConnectionPool newPool)
Sets the connection pool associated with this dbobject. |
void |
setDBName(String newOther)
Set the database name/context for this db object. |
protected void |
setMappedDataContext(String newMappedName)
|
protected void |
setOriginalDBName(String newOriginalName)
Set the name of the db context that was the "original" context for this object - e.g. before any database mapping took place. |
void |
setTargetStoreProcedure(String theStoreProcedure)
Set the target store procedure for this DBObject. |
| Methods inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject |
getGlobalMask, getStatus, isGlobalMasked, setFieldsWithDefaults, setGlobalMask, setStatus |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.jcorporate.expresso.core.dataobjects.DataObject |
add, checkField, clear, count, delete, equals, find, get, getAllAttributes, getAttribute, getDataField, getField, getFieldMetaData, getLocale, getMaxRecords, getOffsetRecord, getValidValuesList, searchAndRetrieveList, searchAndRetrieveList, set, setAttribute, setLocale, setMaxRecords, setOffsetRecord, update |
| Methods inherited from interface com.jcorporate.expresso.core.cache.Cacheable |
getKey |
| Methods inherited from interface com.jcorporate.expresso.core.dataobjects.ContextNested |
getDataContext, setDataContext |
| Field Detail |
public static int LONGBINARY_READ_DEFAULT_SIZE
protected String customWhereClause
protected boolean appendCustomWhere
protected String dbKey
protected ArrayList recordSet
protected transient String myClassName
protected HashMap distinctFields
public HashMap retrieveFields
protected static transient volatile EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap sMetadataMap
protected boolean anyFieldsToRetrieve
protected transient DBConnection localConnection
protected transient int offsetRecord
ResultSet proper in a searchAndRetrieve.
0 means no limit
author Peter Pilgrim, Thu Jun 21 10:30:59 BST 2001
protected transient int maxRecords
protected transient ArrayList sortKeys
protected transient ArrayList myUpdates
public boolean anyFieldsDistinct
protected boolean caseSensitiveQuery
| Constructor Detail |
public JDBCDataObject()
| Method Detail |
public String getMappedDataContext()
public DBConnectionPool getConnectionPool()
throws DataException
DataException - upon error getting the connection pool instanceprotected void setDBConnectionPool(DBConnectionPool newPool)
newPool - the new DBConnectionPool to set
public String getSerialForm(DataFieldMetaData theField)
throws DataException
theField - A DBField object
DataException - upon error
public void setDBName(String newOther)
throws DBException
newOther - The name of the context or database to use
DBExceptionpublic final DataObjectMetaData getMetaData()
public final JDBCObjectMetaData getJDBCMetaData()
protected final DBObjectDef getDef()
protected DBObjectDef constructNewMetaData()
throws DBException
DBException - upon construction errorpublic boolean checkZeroUpdate()
protected void setOriginalDBName(String newOriginalName)
newOriginalName - new value to setprotected void setMappedDataContext(String newMappedName)
public void setCaseSensitiveQuery(boolean caseSensitiveQuery)
caseSensitiveQuery - boolean
public String selectFieldString(String fieldName)
throws DBException
fieldName - The name of the field to be handled
DBException
public String quoteIfNeeded(String fieldName,
String rangeString)
throws DBException
fieldName - The name of the field to be usedrangeString - the appropriately formatted string
DBException - If there is no such field or it's value cannot be
determined
public void setConnection(DBConnection newConnection)
throws DBException
newConnection - The new DBConnection object to be used by this DB Object
DBException
public void setConnection(DBConnection newConnection,
String setupTablesContext)
throws DBException
The difference between this and setConnection(DBConnection) is that this is used for using otherDB capabilities within a transaction. So you use a dbconnection from your other pool, but the setup tables are in a different context
newConnection - The new DBConnection object to be used by this DB ObjectsetupTablesContext - the data context that is used for the expresso setup tables.
DBExceptionsetConnection(DBConnection)
public DBConnection createAndExecuteSearch(ArrayList retrievedFieldList)
throws DBException
retrievedFieldList - instantiate an ArrayList and the function will
fill out the field order that the SQL statement will have it's fields in.
DBException - upon database communication error
public void loadFromConnection(JDBCDataObject myObj,
DBConnection myConnection,
ArrayList retrievedFieldList)
throws DBException
myObj - the Object to have the values filled out. [in/out parameter]myConnection - [in] the connection to retrieve the fields fromretrievedFieldList - [in] An array of Strings representing the field
names to retrieve in the order they exist in the connection.
DBException - upon errorprotected String makeLimitationStub(DBConnection theConnection)
This method takes the limitation syntax string and performs a string replacement on the following tokens
ResultSet to skip
before reading the data.
ResultSet.
Also known as the rowlength.
ResultSet that the
search and retrieved should retrieve. The end record number
is equal to ( %offset% + %maxrecord% - 1 )
theConnection - the db connection to make this stub from
DataObject.searchAndRetrieveList(),
DataObject.setOffsetRecord( int ),
DataObject.setMaxRecords( int )
public ArrayList getDistinctFieldArrayList()
throws DBException
ArrayList object list of all
of the fields in this object that are set to distinct
DBException - If the list cannot be retrieved
author Peter Pilgrim
public Iterator getFieldsToRetrieveIterator()
throws DBException
Iterator object list of all
of the fields in this object that are set to retrieve
Author Yves henri Amaizo
DBException - If the list cannot be retrieved
public String buildWhereClause(boolean useAllFields)
throws DBException
useAllFields - True if all fields are to be used,
false for only key fields
DBException
protected FastStringBuffer buildWhereClauseBuffer(boolean useAllFields,
FastStringBuffer allocatedBuffer)
throws DBException
useAllFields - True if all fields are to be used,
false for only key fieldsallocatedBuffer - - An already allocated FastStringBuffer to fill out.
This allows for compatability with, for example, object pools.
DBExceptionprotected JDBCUtil getJDBCUtil()
public DataExecutorInterface getExecutor()
public DataQueryInterface getQueryInterface()
public String getCustomStringFieldValue(DBConnection connection,
String oneFieldName)
throws DBException
This convenience method retrieve through the resultSet.MetaData
the date value of field define as date or time DBObject
connection - The DBConnectiononeFieldName - the field name to get the custom field value from
DBException - author Yves Henri AMAIZO public DBConnection getLocalConnection()
Return local DBConnection value
author Yves Henri AMAIZO <amy_amaizo@compuserve.com>
public DBConnection createAndRunStoreProcedure(ArrayList retrievedFieldList)
throws DBException
retrievedFieldList - instantiate an ArrayList and the function will
fill out the field order that the SQL statement will have it's fields in.
DBException - upon database communication error
protected void addInParam(String inFieldName)
throws DBException
inFieldName - The name of the field to add as part of the key
DBException - if the field name is not valid or the field
allows nulls
protected void addOutParam(String outFieldName)
throws DBException
outFieldName - The name of the field to add as part of the key
DBException - if the field name is not valid or the field
allows nulls
public void setTargetStoreProcedure(String theStoreProcedure)
throws DBException
theStoreProcedure - Table for this object
DBException - upon execution error.
public void runStoredProcedure()
throws DBException
DBException - If the record could not be retrieved.
protected ArrayList runStoredProcedureAndRetrieveList()
throws DBException
DBException - If the record could not be retrieved.
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||