|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ephman.abra.database.GenericFactoryBase
FactoryBase class - base for all the JDBC based db factories.
Nested Class Summary | |
(package private) class |
GenericFactoryBase.QueryResult
|
Field Summary | |
protected int |
DEEP
|
protected boolean |
endDates
|
protected int |
SHALLOW
|
static java.lang.String |
VERSION_NUMBER
|
Constructor Summary | |
GenericFactoryBase()
|
Method Summary | |
protected void |
checkRefresh(DatabaseSession dbSess,
Identified item)
|
protected void |
checkRefresh(DatabaseSession dbSess,
Identified item,
java.sql.ResultSet rs)
routine to check if an object is up to date.. |
int |
countRows(DatabaseSession dbSess,
QueryFilter filter)
A routine to count the number of rows in a query which returns the count of hits |
DatabaseCursor |
cursorQuery(DatabaseSession dbSess,
QueryFilter query)
A routine to perform a search given a filter which returns the Vector of oid hits in a DatabaseCursor object this allows small range retrievals with any type of data abstraction |
DatabaseCursor |
cursorQuery(DatabaseSession dbSess,
QueryFilter query,
SortCriteria sortBy)
A routine to perform a search given a filter and an ordering which returns the Vector of oid hits in a DatabaseCursor object this allows small range retrievals with any type of data abstraction |
DatabaseCursor |
cursorQuery(DatabaseSession dbSess,
SortCriteria sortBy)
A routine to perform a search given an ordering which returns the Vector of oid hits in a DatabaseCursor object this allows small range retrievals with any type of data abstraction |
protected DatabaseCursor |
cursorRawQuery(DatabaseSession dbSess,
java.lang.String sql)
Raw query returns DatabaseCursor - to be used in descendant classes |
protected DatabaseCursor |
cursorStoredProcCall(DatabaseSession dbSess,
java.lang.String procCall,
java.util.Vector args,
SortCriteria sort)
|
abstract boolean |
dbNeedsId()
|
protected void |
deepRetrieval(DatabaseSession dbSess,
Identified item)
|
protected void |
deepStorage(DatabaseSession dbSess,
Identified item)
|
protected boolean |
defaultNeedsWhereLogic()
|
protected void |
deleteObject(DatabaseSession dbSess,
Identified item)
|
protected int |
deleteObjects(DatabaseSession dbSess,
QueryFilter filter)
deleteObjects will delete all the rows which match the given filter |
void |
flushCache()
|
protected java.lang.String |
getBooleanAsString(java.lang.Boolean b)
|
java.util.Vector |
getCollection(DatabaseSession dbSess,
java.sql.ResultSet rs)
|
protected java.sql.Connection |
getConnection(DatabaseSession dbSess)
|
protected java.lang.String |
getDeleteSql(QueryFilter filter)
|
protected abstract int |
getLastId(DatabaseSession dbSess)
|
protected int |
getLastId(DatabaseSession dbSess,
java.sql.PreparedStatement stmt)
|
Identified |
getObject(DatabaseSession dbSess,
QueryFilter query)
A routine to get a single object given a filter |
protected Identified |
getObject(DatabaseSession dbSess,
java.lang.String columnName,
int value)
|
protected Identified |
getObject(DatabaseSession dbSess,
java.lang.String columnName,
java.lang.String value)
|
protected abstract java.lang.String |
getPrimaryColumn()
|
protected GenericFactoryBase.QueryResult |
getResults(DatabaseSession dbSess,
java.lang.String sql,
int key)
get results and set key in first arg.. |
protected GenericFactoryBase.QueryResult |
getResults(DatabaseSession dbSess,
java.lang.String sql,
QueryFilter filter,
SortCriteria sc)
a helper routine to build a query and execute |
protected GenericFactoryBase.QueryResult |
getResults(DatabaseSession dbSess,
java.lang.String sql,
QueryFilter filter,
SortCriteria sc,
boolean needsWhereLogic,
java.lang.String tableName)
|
protected java.lang.String |
getSelectCountSql()
|
protected java.lang.String |
getSelectSql()
|
protected java.lang.String |
getSelectSql(java.lang.String columnName)
|
protected java.lang.Boolean |
getStringAsBoolean(java.lang.String s)
|
protected abstract java.lang.String |
getTableName()
|
protected abstract boolean |
hasClobs()
sub factory overrides returning true or false |
void |
lock(DatabaseSession dbSess,
Identified item)
A routine to lock an object and all of its sub parts in the database (thread locking) which is only released when this thread commits/rollsback |
protected abstract Identified |
makeFromResultSet(java.sql.ResultSet rs)
|
protected abstract java.lang.String |
makeInsertCall()
call to a stored proc for this object.. |
protected java.sql.PreparedStatement |
makeInsertStmt(DatabaseSession dbSess)
generic. |
protected abstract java.lang.String |
makeInsertString()
|
protected Identified |
makeObject(DatabaseSession dbSess,
java.sql.ResultSet rs)
|
protected abstract java.lang.String |
makeUpdateCall()
call to a stored proc for this object.. |
protected java.sql.PreparedStatement |
makeUpdateStmt(DatabaseSession dbSess)
|
protected abstract java.lang.String |
makeUpdateString()
|
protected void |
marshalObjects(Identified item)
|
protected boolean |
needsAndBeforeFilter()
|
protected void |
preStorage(DatabaseSession dbSess,
Identified item)
|
protected void |
putNewObject(DatabaseSession dbSess,
Identified item)
routine to place a new object in the db |
protected void |
putNewObject(DatabaseSession dbSess,
Identified item,
int storageDepth)
putNewObject stores an object for the first time using insert stmts |
protected java.util.Vector |
queryAll(DatabaseSession dbSess)
A routine to get a all from the table |
protected java.util.Vector |
queryAllSorted(DatabaseSession dbSess,
SortCriteria sortBy)
A routine to get a all from the table - sorted |
java.util.Vector |
queryObjects(DatabaseSession dbSess,
QueryFilter query)
A routine to get a hits given the filter |
java.util.Vector |
queryObjects(DatabaseSession dbSess,
java.lang.String column,
int key)
|
java.util.Vector |
queryObjects(DatabaseSession dbSess,
ViewLookup lookup,
QueryFilter filter)
a routine to get objects with a given DatabaseLookup.. |
java.util.Vector |
queryObjects(DatabaseSession dbSess,
ViewLookup lookup,
QueryFilter filter,
SortCriteria sortCriteria)
|
java.util.Vector |
querySorted(DatabaseSession dbSess,
QueryFilter query,
SortCriteria sortBy)
A routine to get a objects from a table using the filter and sorted w/ the criteria |
protected abstract void |
refreshFromResultSet(Identified item,
java.sql.ResultSet rs)
|
protected abstract void |
setArguments(java.sql.PreparedStatement stmt,
java.lang.Object item,
boolean update)
|
protected abstract void |
setClob(DatabaseSession dbSess,
java.sql.ResultSet rs,
java.lang.String columnName,
java.lang.String value)
need specific db type libraries to do see oracle/FactoryBase |
protected void |
setClobs(DatabaseSession dbSess,
java.sql.ResultSet rs,
Identified item)
|
protected int |
storedProcCall(DatabaseSession dbSess,
java.lang.String procCall,
java.util.Vector args)
Execute a stored proc with some arguments that returns an integer. |
protected void |
storeObject(DatabaseSession dbSess,
Identified item)
routine to store an object -- if new putNew is called else update is called |
protected void |
storeObject(DatabaseSession dbSess,
Identified item,
int storageDepth)
routine to store an object -- if new putNew is called else update is called |
(package private) void |
trace(java.lang.String text)
|
protected void |
updateObject(DatabaseSession dbSess,
Identified item)
|
protected void |
updateObject(DatabaseSession dbSess,
Identified item,
int storageDepth)
|
protected abstract boolean |
useStoredProcs()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int SHALLOW
protected int DEEP
public static final java.lang.String VERSION_NUMBER
protected boolean endDates
Constructor Detail |
public GenericFactoryBase()
Method Detail |
public void flushCache()
protected java.sql.Connection getConnection(DatabaseSession dbSess)
protected Identified getObject(DatabaseSession dbSess, java.lang.String columnName, java.lang.String value) throws java.sql.SQLException
java.sql.SQLException
protected Identified getObject(DatabaseSession dbSess, java.lang.String columnName, int value) throws java.sql.SQLException
java.sql.SQLException
protected void storeObject(DatabaseSession dbSess, Identified item) throws java.sql.SQLException
java.sql.SQLException
protected void storeObject(DatabaseSession dbSess, Identified item, int storageDepth) throws java.sql.SQLException
java.sql.SQLException
protected void putNewObject(DatabaseSession dbSess, Identified item) throws java.sql.SQLException
java.sql.SQLException
protected void putNewObject(DatabaseSession dbSess, Identified item, int storageDepth) throws java.sql.SQLException
java.sql.SQLException
public abstract boolean dbNeedsId()
protected java.sql.PreparedStatement makeInsertStmt(DatabaseSession dbSess) throws java.sql.SQLException
java.sql.SQLException
protected java.sql.PreparedStatement makeUpdateStmt(DatabaseSession dbSess) throws java.sql.SQLException
java.sql.SQLException
protected void deleteObject(DatabaseSession dbSess, Identified item) throws java.sql.SQLException
java.sql.SQLException
protected int deleteObjects(DatabaseSession dbSess, QueryFilter filter) throws java.sql.SQLException
dbSess
- the database connectionfilter
- the query filter to apply
java.sql.SQLException
protected void updateObject(DatabaseSession dbSess, Identified item) throws java.sql.SQLException
java.sql.SQLException
protected void updateObject(DatabaseSession dbSess, Identified item, int storageDepth) throws java.sql.SQLException
java.sql.SQLException
public java.util.Vector queryObjects(DatabaseSession dbSess, java.lang.String column, int key) throws java.sql.SQLException
java.sql.SQLException
public java.util.Vector queryObjects(DatabaseSession dbSess, ViewLookup lookup, QueryFilter filter) throws java.sql.SQLException
dbSess
- is the in-transaction database sessionlookup
- a ViewLookup from the generated descendant of this classfilter
- an option filter to restrict hits
java.sql.SQLException
public java.util.Vector queryObjects(DatabaseSession dbSess, ViewLookup lookup, QueryFilter filter, SortCriteria sortCriteria) throws java.sql.SQLException
java.sql.SQLException
public void lock(DatabaseSession dbSess, Identified item) throws java.sql.SQLException
dbSess
- the current merlin sessionitem
- the Identified item to be locked (and even refreshed)
java.sql.SQLException
- when db-error occursprotected abstract boolean useStoredProcs()
protected abstract Identified makeFromResultSet(java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
protected abstract void refreshFromResultSet(Identified item, java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
protected abstract java.lang.String makeUpdateString()
protected abstract java.lang.String makeInsertString()
protected abstract java.lang.String makeInsertCall()
protected abstract java.lang.String makeUpdateCall()
protected abstract java.lang.String getPrimaryColumn()
protected abstract java.lang.String getTableName()
protected abstract void setArguments(java.sql.PreparedStatement stmt, java.lang.Object item, boolean update) throws java.sql.SQLException
java.sql.SQLException
protected void deepRetrieval(DatabaseSession dbSess, Identified item) throws java.sql.SQLException
java.sql.SQLException
protected void deepStorage(DatabaseSession dbSess, Identified item) throws java.sql.SQLException
java.sql.SQLException
protected void marshalObjects(Identified item) throws java.sql.SQLException
java.sql.SQLException
protected void preStorage(DatabaseSession dbSess, Identified item) throws java.sql.SQLException
java.sql.SQLException
public java.util.Vector getCollection(DatabaseSession dbSess, java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
public java.util.Vector queryObjects(DatabaseSession dbSess, QueryFilter query) throws java.sql.SQLException
dbSess
- the current merlin sessionquery
- the filter to delimit hits..
java.sql.SQLException
- if a db error occursprotected java.util.Vector queryAll(DatabaseSession dbSess) throws java.sql.SQLException
dbSess
- the current merlin session
java.sql.SQLException
- if a db error occursprotected java.util.Vector queryAllSorted(DatabaseSession dbSess, SortCriteria sortBy) throws java.sql.SQLException
dbSess
- the current merlin sessionsortBy
- the sorting criteria
java.sql.SQLException
- if a db error occurspublic java.util.Vector querySorted(DatabaseSession dbSess, QueryFilter query, SortCriteria sortBy) throws java.sql.SQLException
dbSess
- the current merlin sessionsortBy
- the sorting criteriaquery
- the filter to search with
java.sql.SQLException
- if a db error occurspublic Identified getObject(DatabaseSession dbSess, QueryFilter query) throws java.sql.SQLException
dbSess
- the current merlin sessionquery
- one which should find 0-1 objects
java.sql.SQLException
- if a db error occurs or more than 1 object is found on this
filterprotected Identified makeObject(DatabaseSession dbSess, java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
protected boolean defaultNeedsWhereLogic()
protected boolean needsAndBeforeFilter()
protected GenericFactoryBase.QueryResult getResults(DatabaseSession dbSess, java.lang.String sql, int key) throws java.sql.SQLException
java.sql.SQLException
protected GenericFactoryBase.QueryResult getResults(DatabaseSession dbSess, java.lang.String sql, QueryFilter filter, SortCriteria sc) throws java.sql.SQLException
java.sql.SQLException
protected GenericFactoryBase.QueryResult getResults(DatabaseSession dbSess, java.lang.String sql, QueryFilter filter, SortCriteria sc, boolean needsWhereLogic, java.lang.String tableName) throws java.sql.SQLException
java.sql.SQLException
public int countRows(DatabaseSession dbSess, QueryFilter filter) throws java.sql.SQLException
dbSess
- the current merlin sessionfilter
- a QueryFilter
java.sql.SQLException
public DatabaseCursor cursorQuery(DatabaseSession dbSess, SortCriteria sortBy) throws java.sql.SQLException
dbSess
- the current merlin sessionsortBy
- a list of columns on which to sort the data
java.sql.SQLException
public DatabaseCursor cursorQuery(DatabaseSession dbSess, QueryFilter query) throws java.sql.SQLException
dbSess
- the current merlin sessionquery
- a query filter with any lookup specific criteria
java.sql.SQLException
public DatabaseCursor cursorQuery(DatabaseSession dbSess, QueryFilter query, SortCriteria sortBy) throws java.sql.SQLException
dbSess
- the current merlin sessionquery
- a query filter with any lookup specific criteriasortBy
- a list of columns on which to sort the data
java.sql.SQLException
protected DatabaseCursor cursorRawQuery(DatabaseSession dbSess, java.lang.String sql) throws java.sql.SQLException
dbSess
- sql
-
java.sql.SQLException
protected int storedProcCall(DatabaseSession dbSess, java.lang.String procCall, java.util.Vector args) throws java.sql.SQLException
java.sql.SQLException
protected DatabaseCursor cursorStoredProcCall(DatabaseSession dbSess, java.lang.String procCall, java.util.Vector args, SortCriteria sort) throws java.sql.SQLException
java.sql.SQLException
protected void checkRefresh(DatabaseSession dbSess, Identified item) throws java.sql.SQLException
java.sql.SQLException
protected void checkRefresh(DatabaseSession dbSess, Identified item, java.sql.ResultSet rs) throws java.sql.SQLException
dbSess
- this threads connectionitem
- the dbObject in questionrs
- an open ResultSet represneting this object in the db
java.sql.SQLException
- on error.protected int getLastId(DatabaseSession dbSess, java.sql.PreparedStatement stmt) throws java.sql.SQLException
java.sql.SQLException
protected void setClobs(DatabaseSession dbSess, java.sql.ResultSet rs, Identified item) throws java.sql.SQLException
java.sql.SQLException
protected abstract boolean hasClobs()
protected abstract void setClob(DatabaseSession dbSess, java.sql.ResultSet rs, java.lang.String columnName, java.lang.String value) throws java.sql.SQLException
java.sql.SQLException
protected abstract int getLastId(DatabaseSession dbSess) throws java.sql.SQLException
java.sql.SQLException
protected java.lang.String getSelectSql(java.lang.String columnName)
protected java.lang.String getSelectSql()
protected java.lang.String getSelectCountSql()
protected java.lang.String getDeleteSql(QueryFilter filter)
protected java.lang.String getBooleanAsString(java.lang.Boolean b)
protected java.lang.Boolean getStringAsBoolean(java.lang.String s)
void trace(java.lang.String text)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |