|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.BaseContext
public abstract class BaseContext
A common base superclass for Cayenne ObjectContext implementors.
Field Summary | |
---|---|
protected DataChannel |
channel
|
Constructor Summary | |
---|---|
BaseContext()
|
Method Summary | |
---|---|
abstract void |
commitChanges()
Flushes all changes to objects in this context to the parent DataChannel, cascading flush operation all the way through the stack, ultimately saving data in the database. |
abstract void |
commitChangesToParent()
Flushes all changes to objects in this context to the parent DataChannel. |
abstract Collection |
deletedObjects()
Returns a collection of objects that are registered with this ObjectContext and have a state PersistenceState.DELETED |
abstract void |
deleteObject(Object object)
Schedules a persistent object for deletion on next commit. |
DataChannel |
getChannel()
Returns an DataChannel used by this context. |
abstract EntityResolver |
getEntityResolver()
Returns EntityResolver that stores all mapping information accessible by this ObjectContext. |
abstract GraphManager |
getGraphManager()
Returns GraphManager that manages object graph associated with this context. |
abstract Persistent |
localObject(ObjectId id,
Object prototype)
Returns an object local to this ObjectContext and matching the ObjectId. |
abstract Collection |
modifiedObjects()
Returns a collection of objects that are registered with this ObjectContext and have a state PersistenceState.MODIFIED |
abstract Persistent |
newObject(Class persistentClass)
Creates a new persistent object scheduled to be inserted to the database on next commit. |
abstract Collection |
newObjects()
Returns a collection of objects that are registered with this ObjectContext and have a state PersistenceState.NEW |
abstract QueryResponse |
performGenericQuery(Query query)
Executes any kind of query providing the result in a form of QueryResponse. |
abstract List |
performQuery(Query query)
Executes a selecting query, returning a list of persistent objects or data rows. |
void |
prepareForAccess(Persistent object,
String property)
Deprecated. since 3.0 this method is replaced by prepareForAccess(Persistent, String, boolean) . |
void |
prepareForAccess(Persistent object,
String property,
boolean lazyFaulting)
A callback method that child Persistent objects are expected to call before accessing property values. |
abstract void |
propertyChanged(Persistent object,
String property,
Object oldValue,
Object newValue)
A callback method that child Persistent objects are expected to call from inside the setter after modifying a value of a persistent property, including "simple" and "arc" properties. |
abstract void |
registerNewObject(Object object)
Registers a transient object with the context. |
abstract void |
rollbackChanges()
Resets all uncommitted changes made to the objects in this ObjectContext, cascading rollback operation all the way through the stack. |
abstract void |
rollbackChangesLocally()
Resets all uncommitted changes made to the objects in this ObjectContext. |
abstract Collection |
uncommittedObjects()
Returns a collection of MODIFIED, DELETED or NEW objects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient DataChannel channel
Constructor Detail |
---|
public BaseContext()
Method Detail |
---|
public abstract void commitChanges()
ObjectContext
commitChanges
in interface ObjectContext
public abstract void commitChangesToParent()
ObjectContext
ObjectContext.commitChanges()
, but no cascading flush occurs.
commitChangesToParent
in interface ObjectContext
public abstract void deleteObject(Object object) throws DeleteDenyException
ObjectContext
deleteObject
in interface ObjectContext
DeleteDenyException
- if a DeleteRule.DENY
delete rule is applicable for object deletion.public abstract Collection deletedObjects()
ObjectContext
deletedObjects
in interface ObjectContext
public DataChannel getChannel()
ObjectContext
getChannel
in interface ObjectContext
public abstract EntityResolver getEntityResolver()
ObjectContext
getEntityResolver
in interface ObjectContext
public abstract GraphManager getGraphManager()
ObjectContext
getGraphManager
in interface ObjectContext
public abstract Persistent localObject(ObjectId id, Object prototype)
ObjectContext
prototype
is not null, local object is refreshed with the prototype
values.
This method can do both "mapping" (i.e. finding an object with the same id in this context) and "synchronization" (i.e. updating the state of the found object with the state of the prototype object).
localObject
in interface ObjectContext
public abstract Collection modifiedObjects()
ObjectContext
modifiedObjects
in interface ObjectContext
public abstract Persistent newObject(Class persistentClass)
ObjectContext
newObject
in interface ObjectContext
public abstract void registerNewObject(Object object)
ObjectContext
ObjectContext.newObject(Class)
is that a user creates an object herself, before
attaching it to the context, instead of relying on Cayenne to do that.
registerNewObject
in interface ObjectContext
object
- new object that needs to be made persistent.public abstract Collection newObjects()
ObjectContext
newObjects
in interface ObjectContext
public abstract QueryResponse performGenericQuery(Query query)
ObjectContext
performGenericQuery
in interface ObjectContext
public abstract List performQuery(Query query)
ObjectContext
performQuery
in interface ObjectContext
public void prepareForAccess(Persistent object, String property)
prepareForAccess(Persistent, String, boolean)
.
prepareForAccess
in interface ObjectContext
public void prepareForAccess(Persistent object, String property, boolean lazyFaulting)
ObjectContext
prepareForAccess
in interface ObjectContext
public abstract void propertyChanged(Persistent object, String property, Object oldValue, Object newValue)
ObjectContext
propertyChanged
in interface ObjectContext
public abstract void rollbackChanges()
ObjectContext
rollbackChanges
in interface ObjectContext
public abstract void rollbackChangesLocally()
ObjectContext
ObjectContext.rollbackChanges()()
, but rollback is local to this context and no
cascading changes undoing occurs.
rollbackChangesLocally
in interface ObjectContext
public abstract Collection uncommittedObjects()
ObjectContext
uncommittedObjects
in interface ObjectContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |