|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectwave.transactionalSupport.ObjectEditor | +--com.objectwave.persist.mapping.RDBPersistentAdapter
Used to make creating persistent objects fairly painless. Much of the logic necessary for our persistence solution resides in the class and RDBBroker.
RDBBroker
,
Serialized FormNested Class Summary | |
static class |
RDBPersistentAdapter.Test
|
Nested classes inherited from class com.objectwave.transactionalSupport.ObjectEditor |
ObjectEditor.Test |
Field Summary | |
protected boolean |
brokerGeneratedPrimaryKeys
|
MapInformation |
mi
|
Fields inherited from class com.objectwave.transactionalSupport.ObjectEditor |
dataExchange, fds, security |
Constructor Summary | |
RDBPersistentAdapter(Persistence p)
Constructor: |
|
RDBPersistentAdapter(Persistence p,
java.lang.String brokerName)
Constructor: |
Method Summary | |
protected boolean |
accessed(java.lang.reflect.Field f,
java.lang.Object[] dataVal,
java.lang.Object curValue)
We are accessing Field and the contents of field F may be in a state of flux. |
void |
addCollectionQuery(java.lang.String name,
SQLQuery q)
To provide support for collections, we needed to do something clever. |
void |
addToStream(java.io.ObjectOutputStream out)
Preserve certain fields related to persistence. |
protected void |
asNoLongerProxy(RDBPersistentAdapter target,
Persistence source)
Copy the data from the object found in the database into the object that was representing our proxy. |
Persistence |
basicNew()
Create a new instance of the persistentObject. |
boolean |
containsAttributeChanges(TransactionLog log)
If we have any changes which are not the result of a collection change, return true. |
protected void |
copyFrom(Persistence newObj)
Update the current persistent object with the values from the argument. |
void |
delete()
Remove this object from the persistent store. |
boolean |
equals(java.lang.Object obj)
|
AttributeTypeColumn |
findColumnMap(java.lang.String path)
From the provided path, find the Attribute type column it represents. |
protected AttributeTypeColumn |
findMatch(AttributeTypeColumn[] types,
Persistence type)
The collection of types may contain a reference to the argument. |
AttributeTypeColumn |
foreignKeyBackRef(RDBPersistence joinObj)
Find my instance link reference to the arguments foreign key reference. |
AttributeTypeColumn |
foreignKeyJoinColumn(RDBPersistence joinObj,
java.lang.reflect.Field fieldOverride)
The foreignKeyJoin value is almost always the primaryKeyField of the other object. |
java.lang.Object |
foreignKeyJoinData(RDBPersistence joinObj)
The foreignKeyJoin value is almost always the primaryKeyField of the other object. |
java.lang.Object |
get(java.lang.reflect.Field adapt,
java.lang.Object oldValue)
This is how we manage our proxies. |
Persistence |
getAdapter()
Since we are the adapter, we should never have an adapter. |
AttributeTypeColumn[] |
getAttributeDescriptions()
|
boolean |
getBrokerGeneratedPrimaryKeys()
|
java.lang.String |
getBrokerName()
Broker names allow an application to have multiple brokers. |
java.util.Vector |
getClassDescription()
The mi contains the vector for the defined class. |
AttributeTypeColumn[] |
getCollectionDescriptions()
|
java.util.Hashtable |
getCollectionQueries()
|
AttributeTypeColumn[] |
getCollectionTypes(RDBPersistence pRef)
Default is to return the collectionDescriptions. |
AttributeTypeColumn[] |
getForeignKeyDescriptions()
|
AttributeTypeColumn[] |
getForeignKeyTypes(RDBPersistence refObj)
|
Persistence |
getInstance(RDBPersistence refObj,
java.lang.String classValue)
In the event that we don't really want a new instance of the persistent object override this method to return the Persistent object you wish to have. |
AttributeTypeColumn[] |
getInstanceLinkDescriptions()
|
AttributeTypeColumn[] |
getInstanceLinkTypes(RDBPersistence pRef)
|
ObjectEditingView |
getObjectEditor()
This method must ALWAYS return a value. |
Persistence |
getPersistentObject()
Use this convenience method to do the casting of the domain object to a persistent object. |
AttributeTypeColumn |
getPrimaryAttributeDescription()
|
java.lang.String |
getPrimaryKeyColumn()
The default primary key column name is the first entry in the attribute column name list. |
AttributeTypeColumn[] |
getPrimaryKeyDescriptions()
|
java.lang.Object |
getPrimaryKeyField()
Get the object found in my primary key field. |
java.lang.Object[] |
getPrimaryKeyFields()
Get the objects found in my primary key field. |
int |
getRecordOffset()
Record offset is used when building the objects. |
java.lang.String |
getTableName(java.lang.Object refObj)
Return the object's table name. |
int |
hashCode()
Make adapter instances hash on primary key value. |
void |
insert()
Force an object to be 'changed' so that it will be commited when the transaction is commited. |
AttributeTypeColumn |
instanceLinkJoinColumn(RDBPersistence joinObj)
Find my foreignKey or instanceLink column that points to the parameter. |
java.util.Collection |
instanceLinkJoinColumns(RDBPersistence joinObj)
Find my foreignKey or instanceLink columns that points to the parameter. |
boolean |
isDeleteThis()
Gets the DeleteThis attribute of the RDBPersistentAdapter object |
boolean |
isProxy()
The proxy attribute is used by this class to determine if this object has been fetched from the database. |
boolean |
isRetrievedFromDatabase()
Gets the RetrievedFromDatabase attribute of the Persistence object |
void |
markForDelete()
Set the delete flag, and enter this change into the current transaction log. |
protected java.lang.Object |
potentialProxyGet(java.lang.reflect.Field adapt)
The value being retrieved may 'change' if it's a proxy. |
Persistence |
realizeProxy(Persistence p)
The argument is a proxy. |
void |
save()
Save this object to the persistent store. |
void |
serializedUpdate(java.io.ObjectInputStream oin)
Get the data that should be preserved when serializing persistent objects. |
void |
set(java.lang.reflect.Field adapt,
java.lang.Object val,
java.lang.Object originalVal)
This is how we manage our proxies. |
void |
setBrokerGeneratedPrimaryKeys(boolean newValue)
|
void |
setBrokerName(java.lang.String st)
The brokerName attribute allows persistent objects from different databases to co-mingle. |
void |
setClassDescription(java.util.Vector v)
Every instance of this class must have the map for the Persistent object. |
void |
setCollectionQueries(java.util.Hashtable t)
Collections are 'proxied' until they are requested. |
void |
setCustomData(java.lang.Object key,
java.lang.Object value)
Allow broker to associate custom data with an RDBPersistentAdapter instance. |
void |
setObjectEditor(ObjectEditingView e)
|
void |
setPrimaryKeyField(java.lang.Object i)
Could be overidden for optimization. |
void |
setProxy(boolean b)
The proxy attribute is used by this class to determine if this object has been fetched from the database. |
void |
setRecordOffset(int i)
|
void |
setRetrievedFromDatabase(boolean b)
This is different from the 'proxy' attribute in that an object that came from the database will have this attribute of true. |
void |
setSkipScalarCheck(boolean newValue)
Used to optimize inserts and updates. |
void |
setTableName(java.lang.String name)
If we know the table name, we can set it here. |
protected void |
setValue(java.lang.reflect.Field adapt,
java.lang.Object val,
java.lang.Object originalVal)
The main workhorse method for all of the set methods. |
boolean |
skipScalarCheck()
If it is known that there are no Scalar arrays for this object, this value can be set to false. |
void |
update(boolean get,
java.lang.Object[] data,
java.lang.reflect.Field[] fields)
Pass my 'update' request to my represented persistent object. |
boolean |
usesAdapter()
Since we are the adapter, we should never need an adapter. |
Methods inherited from class com.objectwave.transactionalSupport.ObjectEditor |
changes, clearChanges, clearChanges, commit, containsAnyChanges, get, get, get, get, get, get, get, get, get, getCollectionChanges, getDomainField, getDomainObject, getFieldMap, getMods, getSecurity, getValue, isDirty, isTransient, lock, lockedBy, markChange, migrateChanges, noKnownLogs, putFieldMap, putMod, quickChanges, rollback, set, set, set, set, set, set, set, set, set, set, setAsTransient, setDomainField, setSecurity, unlock |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.objectwave.persist.RDBPersistence |
containsAnyChanges, getDomainObject |
Methods inherited from interface com.objectwave.persist.Persistence |
lock, unlock |
Methods inherited from interface com.objectwave.transactionalSupport.TransactionalObjectIF |
isDirty, isTransient, setAsTransient |
Field Detail |
public transient MapInformation mi
protected boolean brokerGeneratedPrimaryKeys
Constructor Detail |
public RDBPersistentAdapter(Persistence p)
p
- public RDBPersistentAdapter(Persistence p, java.lang.String brokerName)
p
- brokerName
- Method Detail |
public void setCustomData(java.lang.Object key, java.lang.Object value)
value
- If null, remove entry from custom data list.key
- The new CustomData valuepublic void set(java.lang.reflect.Field adapt, java.lang.Object val, java.lang.Object originalVal)
set
in interface SetAndGetDelegateIF
set
in class ObjectEditor
adapt
- val
- originalVal
- ObjectEditor
public void setBrokerGeneratedPrimaryKeys(boolean newValue)
newValue
- intpublic void setClassDescription(java.util.Vector v)
v
- Vector containing map information.public void setBrokerName(java.lang.String st)
setBrokerName
in interface Persistence
st
- The new BrokerName valuepublic void setCollectionQueries(java.util.Hashtable t)
setCollectionQueries
in interface RDBPersistence
t
- A collection of SQLQuery objects indexed by the field they
represent.public void setObjectEditor(ObjectEditingView e)
setObjectEditor
in interface TransactionalObjectIF
e
- The new ObjectEditor valuepublic void setPrimaryKeyField(java.lang.Object i)
setPrimaryKeyField
in interface RDBPersistence
i
- The new PrimaryKeyField valuepublic void setProxy(boolean b)
setProxy
in interface RDBPersistence
b
- The new Proxy valuepublic void setRecordOffset(int i)
setRecordOffset
in interface RDBPersistence
i
- The new RecordOffset valuegetRecordOffset()
public void setRetrievedFromDatabase(boolean b)
setRetrievedFromDatabase
in interface Persistence
b
- public void setSkipScalarCheck(boolean newValue)
setSkipScalarCheck
in interface RDBPersistence
newValue
- booleanpublic void setTableName(java.lang.String name)
name
- The name of the database table containing this object.protected void setValue(java.lang.reflect.Field adapt, java.lang.Object val, java.lang.Object originalVal)
setValue
in class ObjectEditor
adapt
- The new Value valueval
- The new Value valueoriginalVal
- The new Value valuepublic java.lang.Object get(java.lang.reflect.Field adapt, java.lang.Object oldValue)
get
in interface SetAndGetDelegateIF
get
in class ObjectEditor
adapt
- oldValue
-
ObjectEditor
public Persistence getAdapter()
getAdapter
in interface Persistence
public AttributeTypeColumn[] getAttributeDescriptions()
getAttributeDescriptions
in interface RDBPersistence
public boolean getBrokerGeneratedPrimaryKeys()
getBrokerGeneratedPrimaryKeys
in interface RDBPersistence
public java.lang.String getBrokerName()
Persistence
getBrokerName
in interface Persistence
public AttributeTypeColumn[] getCollectionDescriptions()
getCollectionDescriptions
in interface RDBPersistence
public java.util.Hashtable getCollectionQueries()
getCollectionQueries
in interface RDBPersistence
public AttributeTypeColumn[] getCollectionTypes(RDBPersistence pRef)
getCollectionTypes
in interface RDBPersistence
pRef
-
public AttributeTypeColumn[] getForeignKeyDescriptions()
getForeignKeyDescriptions
in interface RDBPersistence
public AttributeTypeColumn[] getPrimaryKeyDescriptions()
getPrimaryKeyDescriptions
in interface RDBPersistence
public AttributeTypeColumn[] getForeignKeyTypes(RDBPersistence refObj)
getForeignKeyTypes
in interface RDBPersistence
refObj
-
public Persistence getInstance(RDBPersistence refObj, java.lang.String classValue) throws java.lang.InstantiationException, java.lang.IllegalAccessException
getInstance
in interface RDBPersistence
refObj
- classValue
-
java.lang.InstantiationException
java.lang.IllegalAccessException
public AttributeTypeColumn[] getInstanceLinkDescriptions()
getInstanceLinkDescriptions
in interface RDBPersistence
public AttributeTypeColumn[] getInstanceLinkTypes(RDBPersistence pRef)
getInstanceLinkTypes
in interface RDBPersistence
pRef
-
public ObjectEditingView getObjectEditor()
TransactionalObjectIF
getObjectEditor
in interface TransactionalObjectIF
public final Persistence getPersistentObject()
getPersistentObject
in interface RDBPersistence
public AttributeTypeColumn getPrimaryAttributeDescription()
getPrimaryAttributeDescription
in interface RDBPersistence
public java.lang.String getPrimaryKeyColumn()
getPrimaryKeyColumn
in interface RDBPersistence
public java.lang.Object getPrimaryKeyField()
getPrimaryKeyField
in interface RDBPersistence
public java.lang.Object[] getPrimaryKeyFields()
getPrimaryKeyFields
in interface RDBPersistence
public int getRecordOffset()
getRecordOffset
in interface RDBPersistence
public java.lang.String getTableName(java.lang.Object refObj)
getTableName
in interface RDBPersistence
refObj
- By default the parameter is ignored. The table name should be
constant.
public boolean isDeleteThis()
isDeleteThis
in interface RDBPersistence
public boolean isProxy()
isProxy
in interface RDBPersistence
public boolean isRetrievedFromDatabase()
Persistence
isRetrievedFromDatabase
in interface Persistence
public java.util.Vector getClassDescription()
getClassDescription
in interface RDBPersistence
public void addCollectionQuery(java.lang.String name, SQLQuery q)
addCollectionQuery
in interface RDBPersistence
name
- The feature to be added to the CollectionQuery attributeq
- The feature to be added to the CollectionQuery attributepublic Persistence basicNew() throws java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.IllegalAccessException
public boolean containsAttributeChanges(TransactionLog log)
containsAttributeChanges
in class ObjectEditor
log
-
ObjectEditor.isDirty()
public void delete() throws QueryException
delete
in interface Persistence
QueryException
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
-
public int hashCode()
hashCode
in class java.lang.Object
public AttributeTypeColumn foreignKeyBackRef(RDBPersistence joinObj)
foreignKeyBackRef
in interface RDBPersistence
joinObj
-
public AttributeTypeColumn foreignKeyJoinColumn(RDBPersistence joinObj, java.lang.reflect.Field fieldOverride)
foreignKeyJoinColumn
in interface RDBPersistence
joinObj
- fieldOverride
-
public java.lang.Object foreignKeyJoinData(RDBPersistence joinObj)
joinObj
-
public void insert() throws QueryException
insert
in interface Persistence
QueryException
public AttributeTypeColumn instanceLinkJoinColumn(RDBPersistence joinObj)
instanceLinkJoinColumn
in interface RDBPersistence
joinObj
- Another persistent object to which this object may join.
public java.util.Collection instanceLinkJoinColumns(RDBPersistence joinObj)
joinObj
- Another persistent object to which this object may join.
public void markForDelete() throws QueryException
markForDelete
in interface RDBPersistence
QueryException
public Persistence realizeProxy(Persistence p)
p
-
public void save() throws QueryException
save
in interface Persistence
QueryException
public boolean skipScalarCheck()
skipScalarCheck
in interface RDBPersistence
setSkipScalarCheck(boolean)
public void update(boolean get, java.lang.Object[] data, java.lang.reflect.Field[] fields)
update
in interface TransactionalObjectIF
get
- true if this is to get values from the object, false if it is to
set values.data
- The object array containing (or going to contain) the data.fields
- The fields on the object to update.public boolean usesAdapter()
usesAdapter
in interface Persistence
public void addToStream(java.io.ObjectOutputStream out) throws java.io.IOException
out
- The feature to be added to the ToStream attribute
java.io.IOException
public void serializedUpdate(java.io.ObjectInputStream oin) throws java.io.IOException, java.lang.ClassNotFoundException
oin
-
java.io.IOException
java.lang.ClassNotFoundException
protected java.lang.Object potentialProxyGet(java.lang.reflect.Field adapt)
adapt
-
protected boolean accessed(java.lang.reflect.Field f, java.lang.Object[] dataVal, java.lang.Object curValue)
f
- The field being accessed.dataVal
- curValue
-
protected void asNoLongerProxy(RDBPersistentAdapter target, Persistence source)
source
- The object that we retrieved from the database.target
- The original object that was once a proxy.protected void copyFrom(Persistence newObj)
newObj
- protected AttributeTypeColumn findMatch(AttributeTypeColumn[] types, Persistence type)
types
- type
-
public AttributeTypeColumn findColumnMap(java.lang.String path) throws NotFoundException
findColumnMap
in interface RDBPersistence
path
-
NotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |