|
WebObjects 5.3 | ||||||||||
| 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
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 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()
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 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 |
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,
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.
| 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 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 EOObjectStoregid - EOGlobalID of the source object of the relationshipname - name of the relationshipcontext - context in which to register the fault
gid for the relationship namefaultForGlobalID(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(),
Serializablepublic 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 interface NSDisposabledispose in class EOObjectStore
public void editingContextDidForgetObjectWithGlobalID(EOEditingContext context,
EOGlobalID gid)
editingContextDidForgetObjectWithGlobalID in class EOObjectStorecontext - 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.Editorpublic 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 EOKeyValueArchivingarchiver - 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 EOObjectStoregid - the identifier for the desired objectcontext - the EOEditingContext to search and register the fault
EOObjectStore.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 EOObjectStorerow - a dictionary representing the raw rowentityName - name of the entity for which the fault is to be returnedcontext - the target EOEditingContext
faultForRawRow(com.webobjects.foundation.NSDictionary, java.lang.String, com.webobjects.eocontrol.EOEditingContext),
EODatabaseContext.faultForRawRow(com.webobjects.foundation.NSDictionary, java.lang.String, com.webobjects.eocontrol.EOEditingContext)
public 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 for
faultForRawRow(NSDictionary row, String entityName, EOEditingContext context)public long fetchTimestamp()
setFetchTimestamp(long)
protected void finalize()
throws Throwable
Throwablepublic 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 search
objectEOGlobalID,
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 object
coderSerializable,
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 EOObjectStoreobject - the object identified by globalIDgid - the EOGlobalID corresponding to objectcontext - 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()
true, then the application will
use more memory.
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