|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.webobjects.eocontrol.EOObjectStore | +--com.webobjects.eocontrol.EOEditingContext
An EOEditingContext object manages a graph of enterprise objects in an application; this object graph represents an internally consistent view of one or more external stores (most often a database).
objectsWithFetchSpecification | Fetches objects from an external store. |
insertObject | Registers a new object to be inserted into the parent EOObjectStore when changes are saved. |
deleteObject | Registers that an object should be removed from the parent EOObjectStore when changes are saved. |
objectsWithFetchSpecification | Fetches a set of objects into this context. |
saveChanges | Commits changes made in this context to its parent EOObjectStore. |
faultForGlobalID | Given a globalID, returns its associated object or creates and returns a fault for it. |
globalIDForObject | Given an object, returns its globalID. |
revert | Throws away all pending changes and restores this context to its previously commited state. |
An EOEditingContext object represents a single "object space"
or document in an application. Its primary responsibility is managing a
graph of enterprise objects. This object graph
is a group of
related business objects that represent an internally consistent view
of one or more external stores (usually a database).
All objects fetched from an external store are registered in an editing context along with a global identifier (EOGlobalID) that's used to uniquely identify each object to the external store. The editing context is responsible for watching for changes in its objects (using the EOObserving interface) and recording snapshots for object-based undo. A single enterprise object instance exists in one and only one editing context, but multiple copies of an object can exist in different editing contexts. Thus object uniquing is scoped to a particular editing context.
For more information on EOEditingContext, see the sections:
insertObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
deleteObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification, com.webobjects.eocontrol.EOEditingContext)
,
saveChanges()
,
faultForGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
globalIDForObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
revert()
,
EOEnterpriseObject
,
EOObjectStore
,
EOObjectStoreCoordinator
,
EOCooperatingObjectStore
,
EOObserving
, Serialized FormInner Class Summary | |
static interface |
EOEditingContext.Delegate
The EOEditingContext.Delegate interface defines methods that an EOEditingContext can invoke in its delegate. |
static class |
EOEditingContext.EditingContextEvent
A subclass provided to track events triggered by EOEditingContexts. |
static interface |
EOEditingContext.Editor
An interface for objects that act as higher-level editors of the objects an EOEditingContext contains. |
static interface |
EOEditingContext.MessageHandler
This interface is used for error reporting and determining fetch limits. |
Inner classes inherited from class com.webobjects.eocontrol.EOKeyValueArchiving |
EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support |
Field Summary | |
static String |
EditingContextDidSaveChangesNotification
This notification is broadcast after changes are saved to the EOEditingContext's parent EOObjectStore. |
static int |
EditingContextFlushChangesRunLoopOrdering
Messages with lower order numbers are processed before messages with higher order numbers. |
static String |
ObjectsChangedInEditingContextNotification
This notification is broadcast whenever changes are made in an EOEditingContext. |
Fields inherited from class com.webobjects.eocontrol.EOObjectStore |
DeletedKey, InsertedKey, InvalidatedAllObjectsInStoreNotification, InvalidatedKey, ObjectsChangedInStoreNotification, UpdatedKey |
Fields inherited from interface com.webobjects.foundation.NSLocking |
OneCentury, OneDay, OneHour, OneMinute, OneSecond, OneWeek, OneYear |
Constructor Summary | |
EOEditingContext()
Creates a new EOEditingContext object with the default parent object store as its parent object store. |
|
EOEditingContext(EOObjectStore parent)
Creates a new EOEditingContext object with parent as its
parent object store. |
Method Summary | |
void |
addEditor(Object editor)
Adds editor to this EOEditingContext's set of EOEditingContext.Editors. |
NSArray |
arrayFaultWithSourceGlobalID(EOGlobalID gid,
String name,
EOEditingContext context)
Overrides the implementation inherited from EOObjectStore. |
NSDictionary |
committedSnapshotForObject(EOEnterpriseObject object)
Returns a dictionary containing a snapshot of object that reflects
its committed values (that is, its values as they were last committed
to the database). |
NSDictionary |
currentEventSnapshotForObject(EOEnterpriseObject object)
Returns a dictionary containing a snapshot of object that reflects
its state as it was at the beginning of the current event loop. |
static Object |
decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
|
static long |
defaultFetchTimestampLag()
|
static EOObjectStore |
defaultParentObjectStore()
Returns the EOObjectStore that is the default parent object store for new editing contexts. |
Object |
delegate()
|
NSArray |
deletedObjects()
|
void |
deleteObject(EOEnterpriseObject object)
Specifies that object should be removed from this EOEditingContext's parent
EOObjectStore when changes are committed. |
void |
dispose()
Invoked when the receiver should prepare itself for destruction. |
void |
editingContextDidForgetObjectWithGlobalID(EOEditingContext context,
EOGlobalID gid)
Invoked to inform the EOObjectStore that it can stop keeping data about an object it passed to a child. |
NSArray |
editors()
Returns this EOEditingContext's list of editors. |
boolean |
editorsHaveChanges()
|
static void |
encodeObjectWithCoder(EOEnterpriseObject object,
NSCoder coder)
Invoked by an EOEnterpriseObject object to ask the EOEditingContext
to encode object using encoder . |
void |
encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
Deprecated. Use Java Serialization instead. |
EOEnterpriseObject |
faultForGlobalID(EOGlobalID gid,
EOEditingContext context)
Overrides the implementation inherited from EOObjectStore. |
EOEnterpriseObject |
faultForRawRow(NSDictionary row,
String entityName)
Returns a fault for the raw row row . |
EOEnterpriseObject |
faultForRawRow(NSDictionary row,
String entityName,
EOEditingContext context)
Returns a fault for the raw row row by invoking
faultForRawRow on this EOEditingContext's parent EOObjectStore with context as the editing context. |
long |
fetchTimestamp()
The fetch timestamp is a hint to refresh stale data on a subsequent fetch. |
protected void |
finalize()
|
void |
forgetObject(EOEnterpriseObject object)
Removes object from the uniquing tables and causes this EOEditingContext
to remove itself from the object's list of observers. |
EOGlobalID |
globalIDForObject(EOEnterpriseObject object)
Returns the EOGlobalID associated with object in this EOEditingContext or its
shared context. |
boolean |
hasChanges()
|
void |
initializeObject(EOEnterpriseObject object,
EOGlobalID gid,
EOEditingContext context)
Overrides the implementation inherited from EOObjectStore to build the properties for the object identified by gid . |
static Object |
initObjectWithCoder(EOEnterpriseObject object,
NSCoder coder)
Invoked by an EOEnterpriseObject object to ask the
EOEditingContext to initialize object from data in decoder . |
NSArray |
insertedObjects()
|
void |
insertObject(EOEnterpriseObject object)
Registers (by invoking insertObjectWithGlobalID ) object to be inserted
in this EOEditingContext's parent EOObjectStore the next time changes are
saved. |
void |
insertObjectWithGlobalID(EOEnterpriseObject object,
EOGlobalID gid)
Registers a new object identified by globalID that should be inserted
in the parent EOObjectStore when changes are saved. |
static boolean |
instancesRetainRegisteredObjects()
|
void |
invalidateAllObjects()
Overrides the implementation inherited from EOObjectStore to discard the values of objects cached in memory and refault them, which causes them to be refetched from the external store the next time they're accessed. |
void |
invalidateObjectsWithGlobalIDs(NSArray gids)
Overrides the implementation inherited from EOObjectStore to signal to the parent object store that the cached values for the objects identified by globalIDs should no longer be considered valid and
that they should be refaulted. |
boolean |
invalidatesObjectsWhenFinalized()
This method should not be used. |
Object |
invokeRemoteMethod(EOEditingContext context,
EOGlobalID gid,
String methodName,
Class[] argumentTypes,
Object[] arguments)
Executes a remote method on the server. |
boolean |
isObjectLockedWithGlobalID(EOGlobalID gid,
EOEditingContext context)
Returns true if the object identified by gid in context
is locked, false otherwise. |
void |
lock()
Locks access to this EOEditingContext to prevent other threads from accessing it. |
void |
lockObject(EOEnterpriseObject object)
Attempts to lock object in the external store. |
void |
lockObjectStore()
|
void |
lockObjectWithGlobalID(EOGlobalID gid,
EOEditingContext context)
Overrides the implementation inherited from EOObjectStore to attempt to lock the object identified by gid in context in
the external store. |
boolean |
locksObjectsBeforeFirstModification()
Returns true if this EOEditingContext locks object in the external store
with lockObject the first time object is modified. |
Object |
messageHandler()
Returns the EOEditingContext's message handler. |
EOEnterpriseObject |
objectForGlobalID(EOGlobalID gid)
Returns the EOEnterpriseObject associated with gid in this EOEditingContext or its
shared context, or null if no such object exists. |
NSArray |
objectsForSourceGlobalID(EOGlobalID gid,
String name,
EOEditingContext context)
Overrides the implementation inherited from EOObjectStore to service a to-many fault for a relationship named name . |
NSArray |
objectsWithFetchSpecification(EOFetchSpecification fetchSpecification)
Equivalent to : |
NSArray |
objectsWithFetchSpecification(EOFetchSpecification fetchSpec,
EOEditingContext context)
Overrides the implementation inherited from EOObjectStore to fetch objects from an external store according to the criteria specified by fetchSpec and return them in an array. |
void |
objectWillChange(Object object)
This method is automatically invoked when any of the objects registered in this EOEditingContext invokes its willChange method. |
EOObjectStore |
parentObjectStore()
|
void |
processRecentChanges()
Forces this EOEditingContext to process pending insertions, deletions, and updates. |
boolean |
propagatesDeletesAtEndOfEvent()
Returns true if this EOEditingContext propagates deletes at the end of the event in which a change was made, false if it propagates deletes only right before saving changes. |
protected Object |
readResolve()
|
void |
recordObject(EOEnterpriseObject object,
EOGlobalID gid)
Makes this EOEditingContext aware of an object identified by gid existing
in its parent object store. |
void |
redo()
Sends editingContextWillSaveChanges messages to this EOEditingContext's
editors, and sends a redo message to its NSUndoManager,
asking it to reverse the latest undo operation applied to objects
in the object graph. |
void |
refaultAllObjects()
Refaults all objects cached in this EOEditingContext that have not been inserted, deleted, or updated. |
void |
refaultObject(EOEnterpriseObject object)
|
void |
refaultObject(EOEnterpriseObject object,
EOGlobalID gid,
EOEditingContext ctx)
Overrides the implementation inherited from EOObjectStore to refault the enterprise object object identified by
gid in ctx . |
void |
refaultObjects()
Deprecated. Use refaultAllObjects instead. |
void |
refetch()
Deprecated. Use refaultAllObjects instead. |
void |
refreshAllObjects()
|
void |
refreshObject(EOEnterpriseObject eo)
|
NSArray |
registeredObjects()
|
void |
removeEditor(Object editor)
Unregisters editor from this EOEditingContext. |
void |
reset()
Forgets all objects and makes them unusable. |
boolean |
retainsRegisteredObjects()
|
void |
revert()
Sends editingContextWillSaveChanges messages to the EOEditingContext's
editors, and removes everything from the undo stack, discards all
insertions and deletions, and restores updated objects to their
last committed values. |
EOObjectStore |
rootObjectStore()
Returns the EOObjectStore at the base of the object store hierarchy (usually an EOObjectStoreCoordinator). |
void |
saveChanges()
Sends editingContextWillSaveChanges messages to this EOEditingContext's
editors, and commits changes made to its parent
EOObjectStore by sending it the message saveChangesInEditingContext
If the parent is an EOObjectStoreCoordinator, it guides its
EOCooperatingObjectStores,
typically EODatabaseContexts, through a multi-pass save operation
If a database error occurs, a RuntimeException is thrown. |
void |
saveChanges(Object sender)
Deprecated. Use saveChanges() instead. |
void |
saveChangesInEditingContext(EOEditingContext context)
Overrides the implementation inherited from EOObjectStore to tell this EOEditingContext's EOObjectStore to accept changes from a child EOEditingContext. |
static void |
setDefaultFetchTimestampLag(long lag)
Sets the default timestamp lag for newly instantiated editing contexts to lag . |
static void |
setDefaultParentObjectStore(EOObjectStore store)
Sets the default parent EOObjectStore to store . |
void |
setDelegate(Object delegate)
Set this EOEditingContext's delegate to be delegate . |
void |
setFetchTimestamp(long timestamp)
Sets the receiver's fetch timestamp. |
static void |
setInstancesRetainRegisteredObjects(boolean flag)
|
void |
setInvalidatesObjectsWhenFinalized(boolean yn)
This method should not be used. |
void |
setLocksObjectsBeforeFirstModification(boolean yn)
Sets according to yn whether this EOEditingContext locks
object in the external store (with lockObject ) the first
time object is modified. |
void |
setMessageHandler(Object handler)
Set this EOEditingContext's message handler to be handler . |
void |
setPropagatesDeletesAtEndOfEvent(boolean propagatesDeletesAtEndOfEvent)
Sets according to propagatesDeletesAtEndOfEvent whether this EOEditingContext propagates
deletes at the end of the event in which a change was made, or only
just before saving changes. |
void |
setRetainsRegisteredObjects(boolean flag)
|
void |
setSharedEditingContext(EOSharedEditingContext sharedEC)
Sets this EOEditingContext shared editing context. |
void |
setStopsValidationAfterFirstError(boolean yn)
Sets according to yn whether this EOEditingContext stops validating after
the first error is encountered, or continues for all objects
(validation typically occurs during a save operation). |
static void |
setSubstitutionEditingContext(EOEditingContext ec)
Assigns ec as the global replacement EOEditingContext to substitute
for one in the process of being de-serialized. |
void |
setUndoManager(NSUndoManager undoManager)
Sets the receiver's NSUndoManager to undoManager . |
static void |
setUsesContextRelativeEncoding(boolean flag)
Sets according to flag whether Serialization or |
EOSharedEditingContext |
sharedEditingContext()
|
boolean |
stopsValidationAfterFirstError()
|
static EOEditingContext |
substitutionEditingContext()
Returns the global substitution EOEditingContext if you have been specified. |
Throwable |
tryToSaveChanges()
Deprecated. Use saveChanges() instead. |
void |
undo()
Sends editingContextWillSaveChanges messages to this EOEditingContext's
editors, and sends an undo message to its NSUndoManager,
asking it to reverse the latest uncommitted changes applied to
objects in the object graph. |
NSUndoManager |
undoManager()
|
void |
unlock()
Unlocks access to this EOEditingContext so that other threads may access it. |
void |
unlockObjectStore()
|
NSArray |
updatedObjects()
Returns an array of objects in this EOEditingContext's object graph that have been updated. |
static boolean |
usesContextRelativeEncoding()
Returns true to indicate whether Serialization and |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String EditingContextDidSaveChangesNotification
Key | Value |
EOObjectStore.UpdatedKey |
An NSArray containing the changed objects |
EOObjectStore.InsertedKey |
An NSArray containing the inserted objects |
EOObjectStore.DeletedKey |
An NSArray containing the deleted objects |
public static final int EditingContextFlushChangesRunLoopOrdering
EOEditingContext also defines String constants for the names of the notifications it posts.
EditingContextDidSaveChangesNotification
,
ObjectsChangedInEditingContextNotification
public static final String ObjectsChangedInEditingContextNotification
ObjectsChangedInStoreNotification
, except that it
contains objects rather than globalIDs. The notification contains:
a notification object; an EOEditingContext; a userInfo dictionary with
the following keys (constants) and values:Key | Value |
EOObjectStore.UpdatedKey |
An NSArray containing the changed objects |
EOObjectStore.DeletedKey |
An NSArray containing the deleted objects |
EOObjectStore.InsertedKey |
An NSArray containing the inserted objects |
EOObjectStore.InvalidatedKey |
An NSArray containing invalidated objects. |
Interface layer EODisplayGroups (not WebObjects WODisplayGroups) listen for this notification to redisplay their contents.
Constructor Detail |
public EOEditingContext(EOObjectStore parent)
parent
as its
parent object store. Shares objects with the default shared editing
context (if any) unless you change its shared editing context with
setSharedEditingContext
.parent
- the parent object store of new EOEditingContext
object createdparentObjectStore()
,
defaultParentObjectStore()
,
setSharedEditingContext(com.webobjects.eocontrol.EOSharedEditingContext)
,
EOObjectStore
public EOEditingContext()
setSharedEditingContext
.parentObjectStore()
,
defaultParentObjectStore()
,
setSharedEditingContext(com.webobjects.eocontrol.EOSharedEditingContext)
,
EOObjectStore
Method Detail |
public void addEditor(Object editor)
editor
to this EOEditingContext's set of EOEditingContext.Editors.editor
- the editor to be added to the editors seteditors()
,
removeEditor(java.lang.Object)
,
EOEditingContext.Editor
public NSArray arrayFaultWithSourceGlobalID(EOGlobalID gid, String name, EOEditingContext context)
gid
are already registered
in this EOEditingContext, it returns an array of those objects. Otherwise, this method propagates the
message up the object store hierarchy, through the parent object
store, ultimately to the associated EODatabaseContext. The EODatabaseContext
creates and returns a to-many fault.
When a parent EOEditingContext receives this on behalf of a child
EOEditingContext and the EOGlobalID gid
identifies a newly
inserted object in the parent, the parent returns a copy of its
object's relationship array with the member objects translated
into objects in the child EOEditingContext.
arrayFaultWithSourceGlobalID
in class EOObjectStore
gid
- EOGlobalID of the source object of the relationshipname
- name of the relationshipcontext
- context in which to register the faultgid
for the relationship name
faultForGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EOObjectStore.arrayFaultWithSourceGlobalID(com.webobjects.eocontrol.EOGlobalID, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
public NSDictionary committedSnapshotForObject(EOEnterpriseObject object)
object
that reflects
its committed values (that is, its values as they were last committed
to the database). This snapshot represents the state
of the object before any modifications were made to it. The snapshot
is updated to the newest object state after a save.object
- Snapshot of this reflecting its committed values
has to be returned.currentEventSnapshotForObject(com.webobjects.eocontrol.EOEnterpriseObject)
public NSDictionary currentEventSnapshotForObject(EOEnterpriseObject object)
object
that reflects
its state as it was at the beginning of the current event loop.
After the end of the current event, upon invocation of
processRecentChanges
, this snapshot is updated to hold the modified state of the object.object
- Snapshot of this reflecting its state at the beginning
of the current event loop has to be returned.committedSnapshotForObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
processRecentChanges()
public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
public static long defaultFetchTimestampLag()
setDefaultFetchTimestampLag(long)
public static EOObjectStore defaultParentObjectStore()
defaultCoordinator
.setDefaultParentObjectStore(com.webobjects.eocontrol.EOObjectStore)
,
substitutionEditingContext()
,
usesContextRelativeEncoding()
,
Serializable
public Object delegate()
setDelegate(java.lang.Object)
public void deleteObject(EOEnterpriseObject object)
object
should be removed from this EOEditingContext's parent
EOObjectStore when changes are committed. At that time, the object
will be removed from the uniquing tables.object
- the object to be deleteddeletedObjects()
public NSArray deletedObjects()
updatedObjects()
,
insertedObjects()
public void dispose()
NSDisposable
dispose
in class EOObjectStore
public void editingContextDidForgetObjectWithGlobalID(EOEditingContext context, EOGlobalID gid)
editingContextDidForgetObjectWithGlobalID
in class EOObjectStore
context
- An EOEditingContext object manages a graph
of enterprise objects in an application.gid
- a compact, universal identifier
for a persistent objectEOObjectStore.editingContextDidForgetObjectWithGlobalID(com.webobjects.eocontrol.EOEditingContext, com.webobjects.eocontrol.EOGlobalID)
public NSArray editors()
addEditor(java.lang.Object)
,
removeEditor(java.lang.Object)
,
EOEditingContext.Editor
public boolean editorsHaveChanges()
true
if any of the editors associated with this EOEditingContext
have pending changes.EOEditingContext.Editor
,
addEditor(java.lang.Object)
public static void encodeObjectWithCoder(EOEnterpriseObject object, NSCoder coder)
object
to ask the EOEditingContext
to encode object
using encoder
.object
- object to be encodedcoder
- the target NSCoderSerializable
,
usesContextRelativeEncoding()
,
initObjectWithCoder(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.foundation.NSCoder)
public void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
encodeWithKeyValueArchiver
in interface EOKeyValueArchiving
archiver
- the EOKeyValueArchiverEOKeyValueArchiver
public EOEnterpriseObject faultForGlobalID(EOGlobalID gid, EOEditingContext context)
globalID
is already registered
in this EOEditingContext (or its shared context), this
method returns that object. Otherwise, the method propagates the
message up the object store hierarchy, through the parent object
store, ultimately to the associated EODatabaseContext. The EODatabaseContext
creates and returns a to-one fault.
For example, suppose you want the department object whose deptID
has a particular value. The most efficient way to get it is to look
it up by its globalID using faultForGlobalID
.
If the department object is already registered in the EOEditingContext,
faultForGlobalID
returns that object (without going to the database).
If not, a fault for this object is created, and the object is fetched from the database
only when you trigger the fault.
In a nested editing context configuration, where a parent EOEditingContext
is sent faultForGlobalID
on behalf of a child EOEditingContext and
globalID
identifies a newly inserted object in the parent, the parent
registers a copy of the object in the child.
For more information refer to: "Working with Objects Across Multiple EOEditingContexts"
faultForGlobalID
in class EOObjectStore
gid
- the identifier for the desired objectcontext
- the EOEditingContext to search and register the faultEOObjectStore.faultForGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
EOUtilities.localInstanceOfObject(com.webobjects.eocontrol.EOEditingContext, com.webobjects.eocontrol.EOEnterpriseObject)
,
EODatabaseContext
,
arrayFaultWithSourceGlobalID(com.webobjects.eocontrol.EOGlobalID, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
,
EOFaultHandler
public EOEnterpriseObject faultForRawRow(NSDictionary row, String entityName, EOEditingContext context)
row
by invoking
faultForRawRow
on this EOEditingContext's parent EOObjectStore with context
as the editing context.faultForRawRow
in class EOObjectStore
row
- a dictionary representing the raw rowentityName
- name of the entity for which the fault is to be returnedcontext
- the target EOEditingContextpublic EOEnterpriseObject faultForRawRow(NSDictionary row, String entityName)
row
.
It is equivalent to invoking
faultForRawRow(row, entityName, this);
row
- a dictionary representing the raw rowentityName
- the name of the entity to create the fault forfaultForRawRow(NSDictionary row, String entityName, EOEditingContext context)
public long fetchTimestamp()
setFetchTimestamp(long)
protected void finalize() throws Throwable
finalize
in class Object
public void forgetObject(EOEnterpriseObject object)
object
from the uniquing tables and causes this EOEditingContext
to remove itself from the object's list of observers.
You should never invoke this method directly. The correct way to
remove an object from its editing context is to remove every reference
to the object by refaulting any object that references it (using
refaultAllObjects
or invalidateAllObjects
). Also note that
this method does not have the effect of deleting an object. In order to delete
an object, you should either use the deleteObject
method or remove
the object from an owning relationship.object
- the object to be forgottenrefaultAllObjects()
,
invalidateAllObjects()
,
deleteObject(com.webobjects.eocontrol.EOEnterpriseObject)
public EOGlobalID globalIDForObject(EOEnterpriseObject object)
object
in this EOEditingContext or its
shared context. All objects fetched from an
external store are registered in an EOEditingContext along with
a global identifier (EOGlobalID) that's used to uniquely identify
each object to the external store. If object
has not been registered
in the EOEditingContext or in its shared editing context (that is,
if no match is found), this method returns null
. Objects are registered
in an EOEditingContext using the insertObject
method, or when fetching,
with recordObject
.object
- the target of the searchobject
EOGlobalID
,
objectForGlobalID(com.webobjects.eocontrol.EOGlobalID)
,
insertObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
recordObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID)
,
sharedEditingContext()
public boolean hasChanges()
public static Object initObjectWithCoder(EOEnterpriseObject object, NSCoder coder)
object
to ask the
EOEditingContext to initialize object
from data in decoder
.object
- an enterprise objectcoder
- the target NSCoder objectcoder
Serializable
,
usesContextRelativeEncoding()
,
encodeObjectWithCoder(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.foundation.NSCoder)
public void initializeObject(EOEnterpriseObject object, EOGlobalID gid, EOEditingContext context)
gid
. When a parent
EOEditingContext receives this on behalf of a child EOEditingContext
(as represented by context
), and the gid
identifies
an object instantiated in the parent, the parent returns properties
extracted from its object and translated into the child's context.
This ensures that a nested context "inherits" modified values
from its parent EOEditingContext. If this EOEditingContext does not have
object
, the request is forwarded its parent EOObjectStore.initializeObject
in class EOObjectStore
object
- the object identified by globalIDgid
- the EOGlobalID corresponding to object
context
- the EOEditingContext in which to initialize the objectEOObjectStore.initializeObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
public void insertObject(EOEnterpriseObject object)
insertObjectWithGlobalID
) object
to be inserted
in this EOEditingContext's parent EOObjectStore the next time changes are
saved. In the meantime, object
is registered in the receiver with
a temporary globalID.object
- object to be inserted in the receiver's parent EOObjectStoreinsertedObjects()
,
deletedObjects()
,
insertObjectWithGlobalID(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID)
public void insertObjectWithGlobalID(EOEnterpriseObject object, EOGlobalID gid)
globalID
that should be inserted
in the parent EOObjectStore when changes are saved. Works by invoking
recordObject
, unless this EOEditingContext already contains the object. Sends
object
the message awakeFromInsertion
. globalID
must respond true
to isTemporary
. When the external store commits object
, it re-records
it with the appropriate permanent EOGlobalID.It is an error to insert an object that's already registered in an editing context unless you are effectively undeleting the object by reinserting it.
object
- the new object to be identified by gidgid
- a compact, universal identifier
for a persistent objectinsertObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
recordObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID)
public NSArray insertedObjects()
deletedObjects()
,
updatedObjects()
public static boolean instancesRetainRegisteredObjects()
public void invalidateAllObjects()
invalidateObjectsWithGlobalIDs
to the parent object store with the globalIDs of all of the objects
cached in the receiver. When an EOEditingContext receives this message,
it propagates the message down the object store hierarchy. EODatabaseContexts
discard their snapshots for invalidated objects and broadcast an
ObjectsChangedInStoreNotification. (EODatabaseContext is defined
in EOAccess.)The final effect of this method is to refault all objects currently in memory. The next time you access one of these objects, it's refetched from the database. To flush the entire application's cache of all values fetched from an external store, you have to use a statement such as the following:
If you just want to discard uncommitted changes but do not want to sacrifice the values cached in memory, the EOEditingContextEOEditingContext.rootObjectStore().invalidateAllObjects();
revert
method is to be used, which reverses all changes and clears
the undo stack.
For more information, see the sections:
invalidateAllObjects
in class EOObjectStore
revert()
,
refaultAllObjects()
,
invalidateObjectsWithGlobalIDs(com.webobjects.foundation.NSArray)
,
EOObjectStore.invalidateAllObjects()
public void invalidateObjectsWithGlobalIDs(NSArray gids)
globalIDs
should no longer be considered valid and
that they should be refaulted. Invokes processRecentChanges
before
refaulting the objects. This message is propagated to any underlying
object store, resulting in a refetch the next time the objects are
accessed. Any related (child or peer) object stores are notified
that the objects are no longer valid. All uncommitted changed to
the objects are lost.
For more information, see the sections:
invalidateObjectsWithGlobalIDs
in class EOObjectStore
gids
- An array of EOGlobalIDs corresponding to objects which should be invalidatedinvalidateAllObjects()
,
EOObjectStore.invalidateObjectsWithGlobalIDs(com.webobjects.foundation.NSArray)
,
processRecentChanges()
public boolean invalidatesObjectsWhenFinalized()
public Object invokeRemoteMethod(EOEditingContext context, EOGlobalID gid, String methodName, Class[] argumentTypes, Object[] arguments)
argumentTypes
argument holds
the types of the remote method's (specified by methodName
) arguments.invokeRemoteMethod
in class EOObjectStore
context
- An EOEditingContext object manages a graph
of enterprise objects in an applicationgid
- a compact, universal identifier
for a persistent objectmethodName
- name of the remote method to be invokedargumentTypes
- types of the remote method's argumentsarguments
- argument of the remote methodpublic boolean isObjectLockedWithGlobalID(EOGlobalID gid, EOEditingContext context)
true
if the object identified by gid
in context
is locked, false
otherwise. This method works by forwarding the
message isObjectLockedWithGlobalID
to its parent object store.isObjectLockedWithGlobalID
in class EOObjectStore
gid
- the EOGlobalID for the target objectcontext
- the target EOEditingContexttrue
if the object identified by gid
in context
is lockedlockObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
lockObjectWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
locksObjectsBeforeFirstModification()
public void lock()
lock
in interface NSLocking
lock
in class EOObjectStore
unlock()
,
sharedEditingContext()
public void lockObject(EOEnterpriseObject object)
object
in the external store. This method works
by invoking lockObjectWithGlobalID
. Throws an RuntimeException if it cannot
find the globalID for object
to pass to lockObjectWithGlobalID
.object
- the object to be locked in the external store.lockObjectWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
isObjectLockedWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
locksObjectsBeforeFirstModification()
public void lockObjectStore()
public void lockObjectWithGlobalID(EOGlobalID gid, EOEditingContext context)
gid
in context
in
the external store. Throws a RuntimeException if unable to obtain the
lock. This method works by forwarding the message lockObjectWithGlobalID
to its parent object store.lockObjectWithGlobalID
in class EOObjectStore
gid
- the EOGlobalID for the target objectcontext
- the target EOEditingContextlockObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
EOObjectStore.lockObjectWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
isObjectLockedWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
locksObjectsBeforeFirstModification()
public boolean locksObjectsBeforeFirstModification()
object
in the external store
with lockObject
the first time object
is modified.true
if the object is locked in the external store the first time it is modified.lockObjectWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
isObjectLockedWithGlobalID(com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
lockObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
setLocksObjectsBeforeFirstModification(boolean)
public Object messageHandler()
setMessageHandler(java.lang.Object)
,
EOEditingContext.MessageHandler
public EOEnterpriseObject objectForGlobalID(EOGlobalID gid)
gid
in this EOEditingContext or its
shared context, or null if no such object exists.gid
- the identifier to search fornull
EOGlobalID
,
globalIDForObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
sharedEditingContext()
public void objectWillChange(Object object)
willChange
method. This method
is EOEditingContext's implementation of the EOObserving interface.objectWillChange
in interface EOObserving
object
- the objects registered in the receiverEOEnterpriseObject.willChange()
public NSArray objectsForSourceGlobalID(EOGlobalID gid, String name, EOEditingContext context)
name
. When a parent
EOEditingContext receives a objectsForSourceGlobalID
message on behalf
of a child editing context and gid
matches an object instantiated
in the parent, the parent returns a copy of its relationship array and
translates its objects into the child editing context. This ensures
that a child editing context "inherits" modified values from
its parent. If the receiving editing context does not have the specified
object or if the parent's relationship property is still a fault,
the request is fowarded to its parent object store.objectsForSourceGlobalID
in class EOObjectStore
gid
- EOGlobalID for the source objectname
- name of the relationshipcontext
- the target EOEditingContextEOObjectStore.objectsForSourceGlobalID(com.webobjects.eocontrol.EOGlobalID, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
public NSArray objectsWithFetchSpecification(EOFetchSpecification fetchSpec, EOEditingContext context)
fetchSpec
and return them in an array. If one of these
objects is already present in memory, this method doesn't overwrite
its values with the new values from the database. This method throws
a RuntimeException if an error occurs; the error message indicates the
nature of the problem.
When an EOEditingContext receives this message, it forwards the
message to its root object store. Typically the root object store
is an EOObjectStoreCoordinator with underlying EODatabaseContexts.
In this case, the object store coordinator forwards the request
to the appropriate database context based on the entity name in
fetchSpec
. The database context then obtains an EODatabaseChannel
and performs the fetch, registering all fetched objects in context
or in the receiver if context
isn't provided. (You should note
that EODatabaseContext and EODatabaseChannel are defined in EOAccess.)
For more information refer to: "Fetching Objects"
objectsWithFetchSpecification
in class EOObjectStore
fetchSpecification
- the criteria specified for fetchcontext
- the destination EOEditingContextEOObjectStore.objectsWithFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification, com.webobjects.eocontrol.EOEditingContext)
public NSArray objectsWithFetchSpecification(EOFetchSpecification fetchSpecification)
objectsWithFetchSpecification(fetchSpecification, this);
fetchSpecification
- the criteria specified for fetchobjectsWithFetchSpecification(EOFetchSpecification fetchSpec, EOEditingContext context)
public EOObjectStore parentObjectStore()
public void processRecentChanges()
saveChanges()
,
ObjectsChangedInEditingContextNotification
public boolean propagatesDeletesAtEndOfEvent()
true
if deletes will be propagated at the end of the eventsetPropagatesDeletesAtEndOfEvent(boolean)
protected Object readResolve() throws ObjectStreamException
public void recordObject(EOEnterpriseObject object, EOGlobalID gid)
gid
existing
in its parent object store. EOObjectStores (such as the access layer's
EODatabaseContext) usually invoke this method for each object fetched.
When it receives this message, the EOEditingContext enters the object in
its uniquing table and registers itself as an observer of the object.object
- object identified by globalIDgid
- a compact, universal identifier
for a persistent objectpublic void redo()
editingContextWillSaveChanges
messages to this EOEditingContext's
editors, and sends a redo
message to its NSUndoManager,
asking it to reverse the latest undo operation applied to objects
in the object graph.undo()
,
editors()
,
revert()
,
EOEditingContext.Delegate.editingContextWillSaveChanges(com.webobjects.eocontrol.EOEditingContext)
public void refaultAllObjects()
processRecentChanges
, then
invokes refaultObject
for all objects that haven't been inserted,
deleted, or updated.refaultObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
EOObjectStore.refaultObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
processRecentChanges()
public void refaultObject(EOEnterpriseObject object)
public void refaultObject(EOEnterpriseObject object, EOGlobalID gid, EOEditingContext ctx)
object
identified by
gid
in ctx
.
This method should be used with caution since refaulting an object
does not remove the object snapshot from the undo stack. Objects
that have been newly inserted or deleted should not be refaulted.The main purpose of this method is to break reference cycles between enterprise objects. For example, suppose you have an Employee object that has a to-one relationship to its Department, and the Department object in turn has an array of Employee objects. You can use this method to break the reference cycle. Note that reference cycles are automatically broken if the EOEditingContext is finalized.
For more information, see the sections:
refaultObject
in class EOObjectStore
object
- the enterprise object to be refaultedgid
- the EOs corresponding EOGlobalIDctx
- the target EOEditingContextEOObjectStore.refaultObject(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.eocontrol.EOGlobalID, com.webobjects.eocontrol.EOEditingContext)
,
invalidateObjectsWithGlobalIDs(com.webobjects.foundation.NSArray)
public void refaultObjects()
refaultAllObjects
instead.
refaultAllObjects()
,
revert()
public void refetch()
refaultAllObjects
instead.
refreshAllObjects()
,
refaultAllObjects()
public void refreshAllObjects()
refaultAllObjects()
,
revert()
public void refreshObject(EOEnterpriseObject eo)
refreshAllObjects()
,
refaultAllObjects()
public NSArray registeredObjects()
public void removeEditor(Object editor)
editor
from this EOEditingContext.editor
- the editor to unregistereditors()
,
addEditor(java.lang.Object)
public void reset()
revert
is preferrable.
This method also resets the fetchTimestamp
as if the editing context were just
initialized.This method should not be invoked on an EOEditingContext which has newly inserted objects.
revert()
,
fetchTimestamp()
public boolean retainsRegisteredObjects()
public void revert()
editingContextWillSaveChanges
messages to the EOEditingContext's
editors, and removes everything from the undo stack, discards all
insertions and deletions, and restores updated objects to their
last committed values. Does not refetch from the database. You should
note that revert
does not automatically cause higher level display groups
(WebObject's WODisplayGroups or the interface layer's EODisplayGroups)
to refetch. Display groups that allow insertion and deletion of
objects need to be explicitly synchronized whenever this method
is invoked on their EOEditingContext.EOEditingContext.Delegate.editingContextWillSaveChanges(com.webobjects.eocontrol.EOEditingContext)
,
editors()
,
invalidateAllObjects()
,
refaultAllObjects()
public EOObjectStore rootObjectStore()
public void saveChanges()
editingContextWillSaveChanges
messages to this EOEditingContext's
editors, and commits changes made to its parent
EOObjectStore by sending it the message saveChangesInEditingContext
If the parent is an EOObjectStoreCoordinator, it guides its
EOCooperatingObjectStores,
typically EODatabaseContexts, through a multi-pass save operation
If a database error occurs, a RuntimeException is thrown. The error message
indicates the nature of the problem.saveChangesInEditingContext(com.webobjects.eocontrol.EOEditingContext)
,
EOEditingContext.Delegate.editingContextWillSaveChanges(com.webobjects.eocontrol.EOEditingContext)
,
editors()
public void saveChanges(Object sender)
saveChanges()
instead.
sender
- ignoredsaveChanges()
public void saveChangesInEditingContext(EOEditingContext context)
saveChanges
,
it propagates any changes received from the child along with any
other changes to its parent EOObjectStore. Throws an exception if
an error occurs; the error message indicates the nature of the problem.saveChangesInEditingContext
in class EOObjectStore
context
- the target EOEditingContextsaveChanges()
,
EOObjectStore.saveChangesInEditingContext(com.webobjects.eocontrol.EOEditingContext)
public static void setDefaultFetchTimestampLag(long lag)
lag
. The default lag is 3,600,000 milliseconds (one hour).
When a new editing context is initialized, it is assigned a fetch timestamp equal to the current time less the default timestamp lag. Setting the lag to a large number might cause every new editing context to accept very old cached data. Setting the lag to too low a value might degrade performance due to excessive fetching. A negative lag value is treated as 0.
lag
- the new fetch timestamp lag in millisecondspublic static void setDefaultParentObjectStore(EOObjectStore store)
store
. You can use this method
before de-serializing to set the default parent EOObjectStores of the EOEditingContexts
in the serialized stream. The object you supply
for store
can be a different EOObjectStoreCoordinator or another
EOEditingContext (if you are using a nested EOEditingContext).
After de-serialization, you should restore the default behavior
by setting the default parent EOObjectStore to null
A default parent object store is global until it is changed again.
store
- the new global default parent EOObjectStoredefaultParentObjectStore()
,
setSubstitutionEditingContext(com.webobjects.eocontrol.EOEditingContext)
,
setUsesContextRelativeEncoding(boolean)
,
Serializable
public void setDelegate(Object delegate)
delegate
.delegate
- public void setFetchTimestamp(long timestamp)
Note: Changing the fetch timestamp has no effect on existing
objects in the editing context; it can affect only subsequent fetches.
To refresh existing objects, invoke refaultAllObjects before you
invoke setFetchTimestamp: . |
defaultFetchTimestampLag
. A
nested editing context always uses its parent's fetch timestamp.
setFetchTimestamp
raises if it's invoked on a nested editing
context.timestamp
- The new fetch timestamp value, in millisecondspublic static void setInstancesRetainRegisteredObjects(boolean flag)
public void setInvalidatesObjectsWhenFinalized(boolean yn)
yn
- Has no effect.public void setLocksObjectsBeforeFirstModification(boolean yn)
Sets according to yn
whether this EOEditingContext locks
object
in the external store (with lockObject
) the first
time object
is modified. The default is false. If
yn
is true, an exception will be thrown if a lock cannot
be obtained when object
invokes willChange
. There are two
reasons a lock might fail: because the row is already locked in
the server, or because the snapshot is out of date. If the
snapshot is out of date, you can explicitly refetch the object
using an EOFetchSpecification with setRefreshesRefetchedObjects
set to true. To handle the exception, you can implement the
EODatabaseContext delegate method
databaseContextShouldRaiseExceptionForLockFailure
.
You should avoid using this method or pessimistic locking in an interactive end-user application. For example, a user might make a change in a text field and neglect to save it, thereby leaving the data locked in the server indefinitely. Consider using optimistic locking or application level explicit check in/check out instead.
yn
- decides whether this EOEditingContext locks object in the
external store the first time object is modifiedlockObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
EOEnterpriseObject.willChange()
,
EOFetchSpecification.setRefreshesRefetchedObjects(boolean)
,
locksObjectsBeforeFirstModification()
public void setMessageHandler(Object handler)
handler
.handler
- The receiver's message handler is set to this.messageHandler()
,
EOEditingContext.MessageHandler
public void setPropagatesDeletesAtEndOfEvent(boolean propagatesDeletesAtEndOfEvent)
Sets according to propagatesDeletesAtEndOfEvent
whether this EOEditingContext propagates
deletes at the end of the event in which a change was made, or only
just before saving changes.
If propagatesDeletesAtEndOfEvent
is true, deleting an enterprise object triggers
delete propagation at the end of the event in which the deletion
occurred (this is the default behavior). If propagatesDeletesAtEndOfEvent
is false,
delete propagation isn't performed until
saveChanges
is invoked.
You can delete enterprise objects explicitly by using the
deleteObject
method or implicitly by removing the enterprise object
from an owning relationship. Delete propagation uses the delete
rules in the EOClassDescription to determine whether objects related
to the deleted object should also be deleted. If delete propagation
fails (that is, if an enterprise object refuses to be
deleted possibly due to a deny rule), all changes made during the
event are rolled back.
propagatesDeletesAtEndOfEvent
- deletes should be propagated at the end of the event in which a change was madesaveChanges()
,
deleteObject(com.webobjects.eocontrol.EOEnterpriseObject)
,
propagatesDeletesAtEndOfEvent()
public void setRetainsRegisteredObjects(boolean flag)
public void setSharedEditingContext(EOSharedEditingContext sharedEC)
sharedEC
both contain the same object (otherwise object
uniquing would be violated) or if sharedEC
is not an instance
of the EOSharedEditingContext class.
By default, an editing context that has no shared editing context listens for DefaultSharedEditingContextWasInitializedNotifications. If a notification is posted while the context has no registered objects, the editing context sets its shared editing context to the newly initialized default shared editing context.
Invoke this method with null to remove this EOEditingContext as an observer of this notification and to prevent the context from accessing any objects in the default shared editing context.
sharedEC
- the shared editing context to be used by this EOEditingContextEOSharedEditingContext
,
EOSharedEditingContext.DefaultSharedEditingContextWasInitializedNotification
public void setStopsValidationAfterFirstError(boolean yn)
yn
whether this EOEditingContext stops validating after
the first error is encountered, or continues for all objects
(validation typically occurs during a save operation). The default
is true. Setting it to false is useful if the delegate implements
editingContextShouldPresentException
to handle the presentation of aggregate exceptions.yn
- whether this EOEditingContext stops validating after
the first error is encounteredstopsValidationAfterFirstError()
public static void setSubstitutionEditingContext(EOEditingContext ec)
ec
as the global replacement EOEditingContext to substitute
for one in the process of being de-serialized. Using
this method causes all of the serialized references to the serialized EOEditingContext to be
redirected to ec
. This can be extremely useful when you want
to de-serialize the contents of an EOEditingContext into an existing one, instead
of a transitory EC within the serialized stream.
After de-serializing with a substitution EOEditingContext, you should
restore the default behavior by setting the substitution
EOEditingContext to null
.
A substitution editing context is global until it is changed again.
The Enterprise Objects Frameworks do not ensure thread safe access to the substitution EC.
If you expect several threads to deserialize EOEditingContexts concurrently, you should provide
your own lock object to manage it.
For more information, see: "Using EOEditingContext to Archive Custom Objects in WebObjects Framework"
ec
- the new global substitution EOEditingContextsubstitutionEditingContext()
,
setUsesContextRelativeEncoding(boolean)
,
setDefaultParentObjectStore(com.webobjects.eocontrol.EOObjectStore)
,
Serializable
public void setUndoManager(NSUndoManager undoManager)
undoManager
. You might invoke
this method with null if the application doesn't need undo and
you want to avoid the overhead of an undo stack.
EOEditingContext includes the undo, redo, and revert methods for managing
changes to objects in the object graph. undo
asks the
EOEditingContext's NSUndoManager to reverse the latest changes to objects
in the object graph. redo
asks the NSUndoManager to reverse the
latest undo operation. revert
clears the undo stack, discards
all insertions and deletions, and restores updated objects to their
last committed (saved) values.
EOEditingContext's undo support is arbitrarily deep; you can undo an object repeatedly until you restore it to the state it was in when it was first created or fetched into its editing context. Even after saving, you can undo a change. To support this feature, the NSUndoManager can keep a lot of data in memory.
For example, whenever an object is removed from a relationship, the corresponding editing context creates a snapshot of the modified, source object. The snapshot, which has a reference to the removed object, is referenced by the editing context and by the undo manager. The editing context releases the reference to the snapshot when the change is saved, but the undo manager doesn't. It continues holding the snapshot, so it can undo the deletion if requested.
If the typical usage patterns for your application generate a lot of
change processing, you might want to limit the undo feature to keep its
memory usage in check. For example, you could clear an undo manager
whenever its editing context saves. To do so, simply send the undo
manager a removeAllActions
message (or a
removeAllActionsWithTarget
message with the editing context as
the argument). If your application doesn't need undo at all, you can
avoid any undo overhead by setting the editing context's undo manager
to null
with setUndoManager.
undoManager
- the new NSUndoManager this EOEditingContext should useundoManager()
public static void setUsesContextRelativeEncoding(boolean flag)
flag
whether Serialization
or For more information, see: "Using EOEditingContext to Archive Custom Objects in WebObjects Framework"
flag
- whether Serialization uses context relative encodingusesContextRelativeEncoding()
,
setSubstitutionEditingContext(com.webobjects.eocontrol.EOEditingContext)
,
setDefaultParentObjectStore(com.webobjects.eocontrol.EOObjectStore)
,
Serializable
public EOSharedEditingContext sharedEditingContext()
public boolean stopsValidationAfterFirstError()
true
to indicate that the receiver should stop validating
after it encounters the first error, or false
to indicate
that it should continue for all objectssetStopsValidationAfterFirstError(boolean)
public static EOEditingContext substitutionEditingContext()
For more information, see: "Using EOEditingContext to Archive Custom Objects in WebObjects Framework"
setSubstitutionEditingContext(com.webobjects.eocontrol.EOEditingContext)
,
usesContextRelativeEncoding()
,
defaultParentObjectStore()
,
Serializable
public Throwable tryToSaveChanges()
saveChanges()
instead.
public void undo()
editingContextWillSaveChanges
messages to this EOEditingContext's
editors, and sends an undo message to its NSUndoManager,
asking it to reverse the latest uncommitted changes applied to
objects in the object graph.
EOEditingContext includes the undo, redo, and revert methods
for managing changes to objects in the object graph. undo
asks
the EOEditingContext's NSUndoManager to reverse the latest changes
to objects in the object graph. redo
asks the NSUndoManager
to reverse the latest undo operation. revert
clears the undo
stack, discards all insertions and deletions, and restores updated
objects to their last committed (saved) values.
EOEditingContext's undo support is arbitrarily deep; you can undo an object repeatedly until you restore it to the state it was in when it was first created or fetched into its editing context. Even after saving, you can undo a change. To support this feature, the NSUndoManager can keep a lot of data in memory.
For example, whenever an object is removed from a relationship, the corresponding editing context creates a snapshot of the modified, source object. The snapshot, which has a reference to the removed object, is referenced by the editing context and by the undo manager. The editing context releases the reference to the snapshot when the change is saved, but the undo manager doesn't. It continues holding the snapshot, so it can undo the deletion if requested.
If the typical usage patterns for your application generate a lot
of change processing, you might want to limit the undo feature to
keep its memory usage in check. For example, you could clear an undo
manager whenever its editing context saves. To do so, simply send
the undo manager a removeAllActions
message (or a
removeAllActionsWithTarget
message with the editing context
as the argument). If your application doesn't need undo at all, you
can avoid any undo overhead by setting the editing context's undo
manager to null
with setUndoManager
.
redo()
,
editors()
,
revert()
public NSUndoManager undoManager()
setUndoManager(com.webobjects.foundation.NSUndoManager)
public void unlock()
unlock
in interface NSLocking
unlock
in class EOObjectStore
lock()
,
sharedEditingContext()
public void unlockObjectStore()
public NSArray updatedObjects()
deletedObjects()
,
insertedObjects()
public static boolean usesContextRelativeEncoding()
Serialization
and For more information, see: "Using EOEditingContext to Archive Custom Objects in WebObjects Framework"
true
when Serialization should use context relative encodingsetUsesContextRelativeEncoding(boolean)
,
substitutionEditingContext()
,
defaultParentObjectStore()
,
Serializable
|
Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |