|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectwave.persist.broker.ObjectQuerySupport
A generic class that can assist with the query of objects in a way similar to relational databases.
Nested Class Summary | |
static class |
ObjectQuerySupport.Test
|
Field Summary | |
protected ObjectFormatter |
defaultFormatter
|
Constructor Summary | |
ObjectQuerySupport()
|
Method Summary | |
boolean |
checkAttributeValues(boolean wildCard,
RDBPersistence subject,
RDBPersistence pObj)
If the subject is retrieved from the database, only check the primary key in the query. |
protected boolean |
checkConstrainedColumns(Persistence poolElement,
RDBPersistence pObj)
|
protected boolean |
checkForeignValues(RDBPersistence subject,
RDBPersistence listElementAdapter,
java.util.ArrayList visited)
|
protected boolean |
checkInstanceValues(RDBPersistence subject,
RDBPersistence listElementAdapter,
java.util.ArrayList visited)
|
java.lang.Object |
clone()
Create an almost copy. |
java.lang.Object |
find()
Execute the query. |
java.lang.Object[] |
getAttributeData(RDBPersistence adapter)
Get the AttributeData from the persistent adapter |
protected CollectionAdapter |
getCollectionAdapter(SQLQuery query)
Get the collection adapter specified in the query. |
protected AttributeTypeColumn |
getFieldForName(Persistence persistentObject,
java.lang.String fieldName)
Find the Field object represented by the provided field name |
protected abstract java.util.Iterator |
getListOfObjects(Persistence expectedType)
Query the object pool for all objects that are of the expected type. |
protected RDBPersistence |
getReferenceAdapter(Persistence listElement,
AttributeTypeColumn col)
Get the col value from the list element. |
protected Persistence[] |
initDataElements(AttributeTypeColumn[] subjCols,
Persistence subject)
Use the AttributeTypeColumns to extract the data from the persistent subject. |
void |
initialize()
|
protected Persistence |
initializeSubject(SQLQuery query)
Set the subject of this ObjectPoolQuery to be the subject found in the query parameter. |
protected boolean |
isConsideredEqual(boolean wildCardMatch,
java.lang.Object poolObject,
java.lang.Object queryObject)
If the query object is null or a default value, then this will return true. |
protected boolean |
isMatch(boolean wildCard,
RDBPersistence subject,
Persistence poolElement,
java.util.ArrayList visited)
To prevent problems with cyclical references we keep a list of every object visited. |
protected boolean |
isMatch(RDBPersistence searchObject,
RDBPersistence listElement,
java.util.ArrayList visited)
Create a new ObjectPoolQuery using the subject of searchObject and check to see if it matches listElement. |
protected boolean |
isPersistentReferenceValid(RDBPersistence subject,
RDBPersistence pQueryReference,
RDBPersistence pObjFkData,
RDBPersistence listElementAdapter,
java.util.ArrayList visited)
|
protected boolean |
isPrimaryKeyMatch(boolean wildCardMatch,
RDBPersistence querySubject,
RDBPersistence poolElement)
Determine if the primary keys from querySubject and the poolElement have the same values. |
protected boolean |
satisfyingConstraint(Persistence poolElement,
java.lang.String columnName,
java.lang.Object value,
java.lang.Object queryValue)
Check to see if any constraints have been established for this query. |
void |
setSqlQuery(SQLQuery q)
Without this instance being initialized with a query, nothing good can be done with this class. |
protected void |
sortOnField(java.util.Vector collection,
java.lang.String fieldName)
Modify the vector parameter to be sorted based upon the field. |
protected java.lang.Object |
sortResult(java.lang.Object originalResult,
java.util.Vector orderByList)
If there the query specifies a sort order, apply that now. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ObjectFormatter defaultFormatter
Constructor Detail |
public ObjectQuerySupport()
Method Detail |
public void setSqlQuery(SQLQuery q)
q
- The new SqlQuery valuepublic java.lang.Object[] getAttributeData(RDBPersistence adapter)
adapter
-
protected CollectionAdapter getCollectionAdapter(SQLQuery query)
query
-
protected abstract java.util.Iterator getListOfObjects(Persistence expectedType)
expectedType
- The type of object specified in the query.
protected boolean isMatch(boolean wildCard, RDBPersistence subject, Persistence poolElement, java.util.ArrayList visited)
visited
- ArrayList The list of visited objects.poolElement
- wildCard
- subject
-
protected boolean isMatch(RDBPersistence searchObject, RDBPersistence listElement, java.util.ArrayList visited)
searchObject
- Foreign key or instance link data that was found in the
original query object.listElement
- The fk or instance link data from an object found in the
object pool.visited
- ArrayList The list of persistent objects to which we have
visited
protected boolean isPrimaryKeyMatch(boolean wildCardMatch, RDBPersistence querySubject, RDBPersistence poolElement) throws java.io.IOException
wildCardMatch
- true if the querySubject specified a primaryKey as a
wild cardquerySubject
- poolElement
-
java.io.IOException
protected boolean isConsideredEqual(boolean wildCardMatch, java.lang.Object poolObject, java.lang.Object queryObject) throws java.io.IOException
poolObject
- Real data from a persistent object.queryObject
- User specified data found in a query. May contain wild
cards.wildCardMatch
-
java.io.IOException
protected RDBPersistence getReferenceAdapter(Persistence listElement, AttributeTypeColumn col)
col
- AttributeTypeColumn The 'field' that should reference a
persistent object.listElement
- The persistent object having the refence to another
persistent object.
protected boolean isPersistentReferenceValid(RDBPersistence subject, RDBPersistence pQueryReference, RDBPersistence pObjFkData, RDBPersistence listElementAdapter, java.util.ArrayList visited)
subject
- visited
- pObjFkData
- listElementAdapter
- pQueryReference
-
public void initialize()
public java.lang.Object find()
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean checkAttributeValues(boolean wildCard, RDBPersistence subject, RDBPersistence pObj) throws java.io.IOException
pObj
- An element from the object poolwildCard
- subject
-
java.io.IOException
protected Persistence initializeSubject(SQLQuery query)
query
- The original query that resulted in this object being created.
protected java.lang.Object sortResult(java.lang.Object originalResult, java.util.Vector orderByList)
originalResult
- orderByList
-
protected boolean checkConstrainedColumns(Persistence poolElement, RDBPersistence pObj)
poolElement
- pObj
-
protected boolean satisfyingConstraint(Persistence poolElement, java.lang.String columnName, java.lang.Object value, java.lang.Object queryValue)
columnName
- value
- The value from the found object in the list of candidates for
query matches.queryValue
- poolElement
-
protected boolean checkForeignValues(RDBPersistence subject, RDBPersistence listElementAdapter, java.util.ArrayList visited)
visited
- ArrayList The list of visited persistent objects.subject
- listElementAdapter
-
protected Persistence[] initDataElements(AttributeTypeColumn[] subjCols, Persistence subject)
subjCols
- AttributeTypeColumn [] The attribute type columns that
identify the instance relations.subject
- Persistence The persistent object
protected boolean checkInstanceValues(RDBPersistence subject, RDBPersistence listElementAdapter, java.util.ArrayList visited)
visited
- The list objects that have been visited by this query.subject
- listElementAdapter
-
protected void sortOnField(java.util.Vector collection, java.lang.String fieldName)
collection
- Vector A result from a query.fieldName
- The name of a field on each object in the collection.protected AttributeTypeColumn getFieldForName(Persistence persistentObject, java.lang.String fieldName) throws java.lang.NoSuchFieldException
persistentObject
- The object that should contain the provided fieldfieldName
- The name of a persistent field on the provided object
java.lang.NoSuchFieldException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |