Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne
Class BaseContext

    java.lang.Object
      org.apache.cayenne.BaseContext

All Implemented Interfaces:
  Serializable, ObjectContext

Direct Known Subclasses:
  CayenneContext, DataContext

    public abstract class BaseContext

extends Object
implements ObjectContext

A common base superclass for Cayenne ObjectContext implementors.

Since:
  3.0
Author:
  Andrus Adamchik
See Also:
  Serialized Form

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
`<T> T`
` | `newObject(Class<T> persistentClass)` Creates a new persistent object of a given class 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

### channel

    protected transient DataChannel channel

Constructor Detail

### BaseContext

    public BaseContext()

Method Detail

### commitChanges

    public abstract void commitChanges()

  Description copied from interface: `ObjectContext`
  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.

  Specified by:
    `commitChanges` in interface `ObjectContext`

### commitChangesToParent

    public abstract void commitChangesToParent()

  Description copied from interface: `ObjectContext`
  Flushes all changes to objects in this context to the parent DataChannel. Same as `ObjectContext.commitChanges()`, but no cascading flush occurs.

  Specified by:
    `commitChangesToParent` in interface `ObjectContext`

### deleteObject

    public abstract void deleteObject(Object object)
                               throws DeleteDenyException

  Description copied from interface: `ObjectContext`
  Schedules a persistent object for deletion on next commit.

  Specified by:
    `deleteObject` in interface `ObjectContext`
  Throws:
    `DeleteDenyException` - if a `DeleteRule.DENY` delete rule is applicable for object deletion.

### deletedObjects

    public abstract Collection<?> deletedObjects()

  Description copied from interface: `ObjectContext`
  Returns a collection of objects that are registered with this ObjectContext and have a state PersistenceState.DELETED

  Specified by:
    `deletedObjects` in interface `ObjectContext`

### getChannel

    public DataChannel getChannel()

  Description copied from interface: `ObjectContext`
  Returns an DataChannel used by this context.

  Specified by:
    `getChannel` in interface `ObjectContext`

### getEntityResolver

    public abstract EntityResolver getEntityResolver()

  Description copied from interface: `ObjectContext`
  Returns EntityResolver that stores all mapping information accessible by this ObjectContext.

  Specified by:
    `getEntityResolver` in interface `ObjectContext`

### getGraphManager

    public abstract GraphManager getGraphManager()

  Description copied from interface: `ObjectContext`
  Returns GraphManager that manages object graph associated with this context.

  Specified by:
    `getGraphManager` in interface `ObjectContext`

### localObject

    public abstract Persistent localObject(ObjectId id,
                                           Object prototype)

  Description copied from interface: `ObjectContext`
  Returns an object local to this ObjectContext and matching the ObjectId. If `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).

  Specified by:
    `localObject` in interface `ObjectContext`

### modifiedObjects

    public abstract Collection<?> modifiedObjects()

  Description copied from interface: `ObjectContext`
  Returns a collection of objects that are registered with this ObjectContext and have a state PersistenceState.MODIFIED

  Specified by:
    `modifiedObjects` in interface `ObjectContext`

### newObject

    public abstract <T> T newObject(Class<T> persistentClass)

  Description copied from interface: `ObjectContext`
  Creates a new persistent object of a given class scheduled to be inserted to the database on next commit.

  Specified by:
    `newObject` in interface `ObjectContext`

### registerNewObject

    public abstract void registerNewObject(Object object)

  Description copied from interface: `ObjectContext`
  Registers a transient object with the context. The difference with `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.

  Specified by:
    `registerNewObject` in interface `ObjectContext`
  Parameters:
    `object` - new object that needs to be made persistent.

### newObjects

    public abstract Collection<?> newObjects()

  Description copied from interface: `ObjectContext`
  Returns a collection of objects that are registered with this ObjectContext and have a state PersistenceState.NEW

  Specified by:
    `newObjects` in interface `ObjectContext`

### performGenericQuery

    public abstract QueryResponse performGenericQuery(Query query)

  Description copied from interface: `ObjectContext`
  Executes any kind of query providing the result in a form of QueryResponse.

  Specified by:
    `performGenericQuery` in interface `ObjectContext`

### performQuery

    public abstract List performQuery(Query query)

  Description copied from interface: `ObjectContext`
  Executes a selecting query, returning a list of persistent objects or data rows.

  Specified by:
    `performQuery` in interface `ObjectContext`

### prepareForAccess

    public void prepareForAccess(Persistent object,
                                 String property)

  Deprecated. since 3.0 this method is replaced by `prepareForAccess(Persistent, String, boolean)`.

  Specified by:
    `prepareForAccess` in interface `ObjectContext`

### prepareForAccess

    public void prepareForAccess(Persistent object,
                                 String property,
                                 boolean lazyFaulting)

  Description copied from interface: `ObjectContext`
  A callback method that child Persistent objects are expected to call before accessing property values. This callback allows ObjectContext to "inflate" unresolved objects on demand and also resolve properties that rely on lazy faulting.

  Specified by:
    `prepareForAccess` in interface `ObjectContext`

### propertyChanged

    public abstract void propertyChanged(Persistent object,
                                         String property,
                                         Object oldValue,
                                         Object newValue)

  Description copied from interface: `ObjectContext`
  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.

  Specified by:
    `propertyChanged` in interface `ObjectContext`

### rollbackChanges

    public abstract void rollbackChanges()

  Description copied from interface: `ObjectContext`
  Resets all uncommitted changes made to the objects in this ObjectContext, cascading rollback operation all the way through the stack.

  Specified by:
    `rollbackChanges` in interface `ObjectContext`

### rollbackChangesLocally

    public abstract void rollbackChangesLocally()

  Description copied from interface: `ObjectContext`
  Resets all uncommitted changes made to the objects in this ObjectContext. Same as `ObjectContext.rollbackChanges()()`, but rollback is local to this context and no cascading changes undoing occurs.

  Specified by:
    `rollbackChangesLocally` in interface `ObjectContext`

### uncommittedObjects

    public abstract Collection<?> uncommittedObjects()

  Description copied from interface: `ObjectContext`
  Returns a collection of MODIFIED, DELETED or NEW objects.

  Specified by:
    `uncommittedObjects` in interface `ObjectContext`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.