|
WebObjects 5.4.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.webobjects.eocontrol.EOObjectStore
com.webobjects.eocontrol.EOEditingContext
public class 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 Form| Nested 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. |
| Nested classes/interfaces inherited from interface 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<EOEnterpriseObject> |
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<EOEditingContext.Editor> |
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<EOEnterpriseObject> |
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()
Report whether EOEditingContext objects created by this application instance will strongly retain all EOEnterpriseObject instances registered with them. |
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<EOGlobalID> 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 : objectsWithFetchSpecification(fetchSpecification, this);. |
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()
This method invokes refreshObject on each registered EOEnterpriseObject in this context. |
void |
refreshObject(EOEnterpriseObject eo)
This method invokes refaultObject on an EOEnterpriseObject which is not inserted, updated, or deleted. |
NSArray |
registeredObjects()
|
void |
removeEditor(Object editor)
Unregisters editor from this EOEditingContext. |
void |
reset()
Forgets all objects and makes them unusable. |
boolean |
retainsRegisteredObjects()
Report whether this EOEditingContext will retain strong references to all EOEnterpriseObject instances registered with it. |
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)
Set the retain policy for EOEditingContext objects created by this application instance. |
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)
Set the retain policy for this EOEditingContext. |
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. |
boolean |
tryLock()
|
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<EOEnterpriseObject> |
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 com.webobjects.eocontrol.EOObjectStore |
|---|
setUserInfo, setUserInfoForKey, userInfo, userInfoForKey |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int EditingContextFlushChangesRunLoopOrdering
EOEditingContext also defines String constants for the names of the notifications it posts.
EditingContextDidSaveChangesNotification,
ObjectsChangedInEditingContextNotification,
Constant Field Valuespublic 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.
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 |
| 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),
EOObjectStorepublic EOEditingContext()
setSharedEditingContext.
parentObjectStore(),
defaultParentObjectStore(),
setSharedEditingContext(com.webobjects.eocontrol.EOSharedEditingContext),
EOObjectStore| Method Detail |
|---|
public static void setInstancesRetainRegisteredObjects(boolean flag)
instancesRetainRegisteredObjectspublic static boolean instancesRetainRegisteredObjects()
true, then the application will use more memory.
public void setRetainsRegisteredObjects(boolean flag)
setInstancesRetainRegisteredObjectspublic boolean retainsRegisteredObjects()
instancesRetainRegisteredObjectspublic static long defaultFetchTimestampLag()
setDefaultFetchTimestampLag(long)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 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),
Serializablepublic 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
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 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 object
coderSerializable,
usesContextRelativeEncoding(),
encodeObjectWithCoder(com.webobjects.eocontrol.EOEnterpriseObject, com.webobjects.foundation.NSCoder)@Deprecated public void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
encodeWithKeyValueArchiver in interface EOKeyValueArchivingarchiver - the EOKeyValueArchiverEOKeyValueArchiverpublic static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
public void setInvalidatesObjectsWhenFinalized(boolean yn)
yn - Has no effect.public boolean invalidatesObjectsWhenFinalized()
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 void dispose()
NSDisposable
dispose in interface NSDisposabledispose in class EOObjectStore
protected void finalize()
throws Throwable
finalize in class ObjectThrowablepublic long fetchTimestamp()
setFetchTimestamp(long)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 EOObjectStore parentObjectStore()
public EOObjectStore rootObjectStore()
public void setUndoManager(NSUndoManager undoManager)
undoManager.
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).
undoManager - the new NSUndoManager this EOEditingContext should useundoManager()public NSUndoManager undoManager()
setUndoManager(com.webobjects.foundation.NSUndoManager)public void setDelegate(Object delegate)
delegate.
delegate - public Object delegate()
setDelegate(java.lang.Object)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.Editorpublic void removeEditor(Object editor)
editor from this EOEditingContext.
editor - the editor to unregistereditors(),
addEditor(java.lang.Object)public NSArray<EOEditingContext.Editor> editors()
addEditor(java.lang.Object),
removeEditor(java.lang.Object),
EOEditingContext.Editorpublic void setMessageHandler(Object handler)
handler.
handler - The receiver's message handler is set to this.messageHandler(),
EOEditingContext.MessageHandlerpublic Object messageHandler()
setMessageHandler(java.lang.Object),
EOEditingContext.MessageHandler
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 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 void processRecentChanges()
saveChanges(),
ObjectsChangedInEditingContextNotificationpublic NSArray<EOEnterpriseObject> updatedObjects()
deletedObjects(),
insertedObjects()public NSArray registeredObjects()
public NSArray<EOEnterpriseObject> insertedObjects()
deletedObjects(),
updatedObjects()public NSArray<EOEnterpriseObject> deletedObjects()
updatedObjects(),
insertedObjects()public boolean propagatesDeletesAtEndOfEvent()
true if deletes will be propagated at the end of the eventsetPropagatesDeletesAtEndOfEvent(boolean)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 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 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 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 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,
locksObjectsBeforeFirstModification()public EOSharedEditingContext sharedEditingContext()