|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ashridgetech.prevdb.client.PersistentManager
A manager (factory) object for one class of Persistent
objects.
Field Summary | |
protected int |
lastOid
|
Constructor Summary | |
PersistentManager(PrevDb prevDb,
Class persistentClass,
PersistentField oidField)
Create a PersistentManager for a class. |
Method Summary | |
protected void |
addNewObject(Persistent obj)
Add a new object to this manager. |
Object |
allocateOid()
Allocate a new object id for a new object. |
protected void |
applyChanges(FieldChangeMap fieldChanges)
Put an object back into its state after a transaction. |
void |
defineNonUniqueIndex(PersistentField field)
Define a non-unique index required for the class managed by this PersistentManager . |
Persistent |
findByOid(Object oid)
Find an object by its oid. |
List |
findIndexedCollection(PersistentField field,
Object fieldValue)
Find the collection of objects that have a given value in a given indexed. |
protected Iterator |
getObjectIterator()
Get an iterator over a notional set of FieldMap s for
the objects in this PersistentManager |
PersistentField |
getOidField()
Get the PersistentField that holds the oid
of the class which this PersistentManager manages. |
Class |
getPersistentClass()
Get the class which this PersistentManager manages |
PrevDb |
getPrevDb()
Get the PrevDb that owns this PersistentManager |
protected void |
loadObject(FieldMap fieldMap)
Load a persistent object into the PrevDb . |
void |
loadOid(Object oid)
For any Integer oid, set the next oid returned by
allocateOid() to one greater, if it is not already greater. |
void |
notifyFieldUpdate(Persistent obj,
PersistentField field,
Object oldValue,
Object newValue)
Notify this manager that a field in one of its persistent objects has been updated. |
void |
notifyNewObject(Persistent obj)
Notify this manager that a new persistent object has been created. |
protected void |
rollbackNewObject(FieldMap fieldMap)
Remove a new object added within the current transaction. |
protected void |
rollbackObject(FieldChangeMap fieldChanges)
Put an object back into its state before a transaction. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int lastOid
Constructor Detail |
public PersistentManager(PrevDb prevDb, Class persistentClass, PersistentField oidField)
PersistentManager
for a class.
prevDb
- the PrevDb
that owns this PersistentManager
persistentClass
- the class which this PersistentManager
managesoidField
- the oid field of the class which this PersistentManager
managesMethod Detail |
public PrevDb getPrevDb()
PrevDb
that owns this PersistentManager
PrevDb
public Class getPersistentClass()
PersistentManager
manages
public PersistentField getOidField()
PersistentField
that holds the oid
of the class which this PersistentManager
manages.
This is the unique identifier for objects of this object's class.
public Object allocateOid()
Integer
with the next in a series of
numbers that starts at one, but is then set to one greater than the highest
Integer
oid passed to loadOid(java.lang.Object)
.
If this method is overridden, loadOid(java.lang.Object)
should also be overridden.
loadOid(java.lang.Object)
public void loadOid(Object oid)
Integer
oid, set the next oid returned by
allocateOid()
to one greater, if it is not already greater.
Non-integer oids are ignored.
oid
- the oidallocateOid()
public Persistent findByOid(Object oid)
oid
- the oid - must be a valid oid for the class managed by this PersistentManager
ObjectNotFoundException
- if there is no object with the given oidpublic void defineNonUniqueIndex(PersistentField field)
PersistentManager
.
field
- the field to be indexedpublic List findIndexedCollection(PersistentField field, Object fieldValue)
field
- the indexed field - must have an index defined with defineNonUniqueIndex(com.ashridgetech.prevdb.client.PersistentField)
.fieldValue
- the value of the field for which the collection of objects is requiredpublic void notifyNewObject(Persistent obj)
obj
- the new objectprotected void addNewObject(Persistent obj)
obj
- the new objectpublic void notifyFieldUpdate(Persistent obj, PersistentField field, Object oldValue, Object newValue)
obj
- the new objectfield
- the field changedoldValue
- the value of the field before this changenewValue
- the value of the field after this changepublic String toString()
toString
in class Object
protected void loadObject(FieldMap fieldMap) throws DataException
PrevDb
.
fieldMap
- the fields of the object to load.
DataException
protected Iterator getObjectIterator()
FieldMap
s for
the objects in this PersistentManager
protected void applyChanges(FieldChangeMap fieldChanges)
fieldChanges
- the changes madeprotected void rollbackObject(FieldChangeMap fieldChanges)
fieldChanges
- the changes madeprotected void rollbackNewObject(FieldMap fieldMap)
fieldMap
- the fieldMap of the new object's fields
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |