|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.wotonomy.control.EOObjectStore net.wotonomy.control.EOEditingContext
public class EOEditingContext
EOEditingContext provides transactional support for
fetching, editing, and committing changes made on a
collection of objects to a parent object store.
EOEditingContext is itself a subclass of EOObjectStore,
and this means that EOEditingContexts can use other
EOEditingContexts as their parent. However, there
still must exist an EOObjectStore as the root of the
editing hierarchy that can maintain persistent state.
Nested Class Summary | |
---|---|
static interface |
EOEditingContext.Delegate
Used by EditingContext to delegate behavior to another class. |
static interface |
EOEditingContext.Editor
Editors register themselves with the editing context so that they may receive notification before the context commits changes. |
static interface |
EOEditingContext.MessageHandler
Used by EditingContext to delegate messaging handling to another class, typically the display group that has the currently active association. |
Field Summary | |
---|---|
static java.lang.String |
EditingContextDidSaveChangesNotification
Key for the NSNotification posted after this editing context saves changes. |
static int |
EditingContextFlushChangesRunLoopOrdering
The default run loop ordering processes recent changes before delayed observers are notified and before dispatching the AWT event queue. |
protected static java.lang.String |
MessageChangeConflict
|
static java.lang.String |
ObjectsChangedInEditingContextNotification
Key for the NSNotification posted after this editing context observes changes. |
Fields inherited from class net.wotonomy.control.EOObjectStore |
---|
DeletedKey, InsertedKey, InvalidatedAllObjectsInStoreNotification, InvalidatedKey, ObjectsChangedInStoreNotification, UpdatedKey |
Constructor Summary | |
---|---|
EOEditingContext()
Default constructor creates a new editing context that uses the default object store. |
|
EOEditingContext(EOObjectStore anObjectStore)
Creates a new editing context that uses the specified object store as its parent object store. |
Method Summary | |
---|---|
void |
addEditor(java.lang.Object anEditor)
Registers the specified object as an editor for this context. |
net.wotonomy.foundation.NSArray |
arrayFaultWithSourceGlobalID(EOGlobalID aGlobalID,
java.lang.String aRelationshipKey,
EOEditingContext aContext)
Returns a read-only List of objects associated with the object with the specified id for the specified property relationship, or may return a placeholder array that will defer the fetch until needed (aka an array fault). |
net.wotonomy.foundation.NSDictionary |
committedSnapshotForObject(java.lang.Object anObject)
Returns a snapshot of the specified object as it existed when it was last read or committed to the parent object store. |
net.wotonomy.foundation.NSDictionary |
currentEventSnapshotForObject(java.lang.Object anObject)
Returns a snapshot of the specified object as it existed before the edits triggered by the current event loop were processed. |
static double |
defaultFetchTimestampLag()
|
static EOObjectStore |
defaultParentObjectStore()
Returns the default parent object store for all object stores created with the parameterless constructor. |
java.lang.Object |
delegate()
Returns the delegate for this editing context, or null if no delegate has been set. |
net.wotonomy.foundation.NSArray |
deletedObjects()
Returns a read-only List of all objects marked as deleted in this editing context. |
void |
deleteObject(java.lang.Object anObject)
Deletes the specified object from this editing context. |
void |
editingContextDidForgetObjectWithGlobalID(EOEditingContext aContext,
EOGlobalID aGlobalID)
Called by child editing contexts when they no longer need to track the specified id. |
net.wotonomy.foundation.NSArray |
editors()
Returns a read-only List of registered editors of this editing context. |
java.lang.Object |
faultForGlobalID(EOGlobalID aGlobalID,
EOEditingContext aContext)
Returns the object for the specified id. |
java.lang.Object |
faultForRawRow(java.util.Map aDictionary,
java.lang.String anEntityName)
Returns a fault representing an object of the specified entity type with values from the specified dictionary. |
java.lang.Object |
faultForRawRow(java.util.Map aDictionary,
java.lang.String anEntityName,
EOEditingContext aContext)
Returns a fault representing an object of the specified entity type with values from the specified dictionary. |
double |
fetchTimestamp()
Returns the fetch timestamp for this editing context. |
void |
flushRecentChanges(java.lang.Object anObject)
This method is called by the event queue run loop and calls processRecentChanges. |
void |
forgetObject(java.lang.Object anObject)
Unregisters the specified object from this editing context, removing all references to it. |
EOGlobalID |
globalIDForObject(java.lang.Object anObject)
Returns the id for the specified object, or null if the object is not registered in this context. |
void |
handleNotification(net.wotonomy.foundation.NSNotification aNotification)
Handles notifications from parent store, looking for InvalidatedAllObjectsInStoreNotification and ObjectsChangedInStoreNotification. |
boolean |
hasChanges()
Returns whether this editing context has changes that have not yet been committed to the parent object store. |
void |
initializeObject(java.lang.Object anObject,
EOGlobalID aGlobalID,
EOEditingContext aContext)
Given a newly instantiated object, this method initializes its properties to values appropriate for the specified id. |
net.wotonomy.foundation.NSArray |
insertedObjects()
Returns a read-only List of the objects that have been inserted into this editing context. |
void |
insertObject(java.lang.Object anObject)
Inserts the specified object into this editing context. |
void |
insertObjectWithGlobalID(java.lang.Object anObject,
EOGlobalID aGlobalID)
Inserts the specified object into this editing context with the specified id, which is expected to be a temporary id. |
static boolean |
instancesRetainRegisteredObjects()
Returns whether editing contexts are configured to retain strong references to their registered objects. |
void |
invalidateAllObjects()
Turn all objects in this editing context into faults, so that they will be fetched the next time they are accessed, and calls invalidateObjectsWithGlobalIDs on the parent object store. |
void |
invalidateObjectsWithGlobalIDs(java.util.List anArray)
Turns the objects with the specified ids into faults, so that they will be fetched the next time they are accessed, and forwards the call to the parent object store. |
boolean |
isObjectLockedWithGlobalID(EOGlobalID aGlobalID,
EOEditingContext aContext)
Returns whether the object referenced by the specified id is locked. |
void |
lockObject(java.lang.Object anObject)
Locks the specified object in this editing context by calling lockObjectWithGlobalID on the parent store. |
void |
lockObjectWithGlobalID(EOGlobalID aGlobalID,
EOEditingContext aContext)
Locks the object referenced by the specified id in the specified editing context. |
boolean |
locksObjectsBeforeFirstModification()
Returns whether this editing context attempts to lock objects when they are first modified. |
java.lang.Object |
messageHandler()
Returns the message handler for this editing context, or null if no message handler has been set. |
java.lang.Object |
objectForGlobalID(EOGlobalID aGlobalID)
Returns the object registered in this editing context for the specified id, or null if that id is not registered. |
net.wotonomy.foundation.NSArray |
objectsForSourceGlobalID(EOGlobalID aGlobalID,
java.lang.String aRelationshipKey,
EOEditingContext aContext)
Returns a read-only List of objects associated with the object with the specified id for the specified property relationship. |
net.wotonomy.foundation.NSArray |
objectsWithFetchSpecification(EOFetchSpecification aFetchSpec)
Returns a read-only List of objects the meet the criteria of the supplied specification. |
net.wotonomy.foundation.NSArray |
objectsWithFetchSpecification(EOFetchSpecification aFetchSpec,
EOEditingContext aContext)
Returns a read-only List of objects the meet the criteria of the supplied specification. |
void |
objectWillChange(java.lang.Object anObject)
Implementation of the EOObserving interface. |
EOObjectStore |
parentObjectStore()
Returns the parent object store for this editing context. |
void |
processRecentChanges()
Updates the inserted, updated, and deleted objects lists, and posts notifications about which objects have been changed. |
boolean |
propagatesDeletesAtEndOfEvent()
Returns whether this editing context propagates deletes immediately after the event that triggered the delete. |
void |
recordObject(java.lang.Object anObject,
EOGlobalID aGlobalID)
Registers the specified object in this editing context for the specified id. |
void |
redo()
Undoes the last undo operation. |
void |
refault()
Refaults this editing context, turning all unmodified objects into faults. |
void |
refaultObject(java.lang.Object anObject,
EOGlobalID aGlobalID,
EOEditingContext aContext)
Refaults the specified object, turning it into a fault for the specified global id in the specified context. |
void |
refaultObjects()
Turns all unmodified objects into faults, calling processRecentChanges() and then refaultObject() for each unmodified object. |
void |
refetch()
Calls editingContextWillSaveChanges() on all editors, and then calls invalidateAllObjects(). |
net.wotonomy.foundation.NSArray |
registeredObjects()
Returns a read-only List of all objects registered in this editing context. |
void |
removeEditor(java.lang.Object anObject)
Unregisters the specified editor with this editing context. |
void |
reset()
Unregisters all objects from this editing context, and resets the fetch timestamp. |
void |
revert()
Reverts the objects in this editing context to their original state. |
EOObjectStore |
rootObjectStore()
Returns the root object store, which is the parent of all parent object stores of this editing context. |
void |
saveChanges()
Calls editingContextWillSaveChanges on all editors, and commits all changes in this editing context to the parent editing context by calling saveChangesInEditingContext to the parent. |
void |
saveChangesInEditingContext(EOEditingContext aContext)
Commits all changes in the specified editing context to this one. |
static void |
setDefaultFetchTimestampLag(double aDouble)
Sets the global default fetch timestamp lag. |
static void |
setDefaultParentObjectStore(EOObjectStore anObjectStore)
Sets the global default parent object store, used for the parameterless constructor. |
void |
setDelegate(java.lang.Object anObject)
Sets the delegate for this editing context. |
void |
setFetchTimestamp(double aDouble)
Sets the fetch timestamp for this editing context. |
static void |
setInstancesRetainRegisteredObjects(boolean retainsObjects)
|
void |
setLocksObjectsBeforeFirstModification(boolean locksObjects)
Sets whether this editing context attempts to lock objects when they are first modified. |
void |
setMessageHandler(java.lang.Object anObject)
Sets the message handler for this editing context. |
void |
setPropagatesDeletesAtEndOfEvent(boolean propagatesDeletes)
Sets whether this editing context propagates deletes immediately after the event that triggered the delete. |
void |
setStopsValidationAfterFirstError(boolean stopsValidation)
Sets whether validation is stopped after the first error occurs. |
boolean |
stopsValidationAfterFirstError()
Returns whether validation is stopped after the first error occurs. |
java.lang.String |
toString()
|
void |
undo()
Reverts the last change on the undo stack. |
net.wotonomy.foundation.NSArray |
updatedObjects()
Returns a read-only list of all objects marked as modified, but not inserted or deleted, in this editing context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EditingContextDidSaveChangesNotification
public static final java.lang.String ObjectsChangedInEditingContextNotification
public static int EditingContextFlushChangesRunLoopOrdering
protected static java.lang.String MessageChangeConflict
Constructor Detail |
---|
public EOEditingContext()
public EOEditingContext(EOObjectStore anObjectStore)
Method Detail |
---|
public void addEditor(java.lang.Object anEditor)
public net.wotonomy.foundation.NSArray arrayFaultWithSourceGlobalID(EOGlobalID aGlobalID, java.lang.String aRelationshipKey, EOEditingContext aContext)
arrayFaultWithSourceGlobalID
in class EOObjectStore
public net.wotonomy.foundation.NSDictionary committedSnapshotForObject(java.lang.Object anObject)
public net.wotonomy.foundation.NSDictionary currentEventSnapshotForObject(java.lang.Object anObject)
public java.lang.Object delegate()
public void deleteObject(java.lang.Object anObject)
public net.wotonomy.foundation.NSArray deletedObjects()
public void editingContextDidForgetObjectWithGlobalID(EOEditingContext aContext, EOGlobalID aGlobalID)
editingContextDidForgetObjectWithGlobalID
in class EOObjectStore
public net.wotonomy.foundation.NSArray editors()
public java.lang.Object faultForGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext)
faultForGlobalID
in class EOObjectStore
public java.lang.Object faultForRawRow(java.util.Map aDictionary, java.lang.String anEntityName)
public java.lang.Object faultForRawRow(java.util.Map aDictionary, java.lang.String anEntityName, EOEditingContext aContext)
faultForRawRow
in class EOObjectStore
public double fetchTimestamp()
public void forgetObject(java.lang.Object anObject)
public EOGlobalID globalIDForObject(java.lang.Object anObject)
public boolean hasChanges()
public void initializeObject(java.lang.Object anObject, EOGlobalID aGlobalID, EOEditingContext aContext)
initializeObject
in class EOObjectStore
public void insertObject(java.lang.Object anObject)
public void insertObjectWithGlobalID(java.lang.Object anObject, EOGlobalID aGlobalID)
public net.wotonomy.foundation.NSArray insertedObjects()
public void invalidateAllObjects()
invalidateAllObjects
in class EOObjectStore
public void invalidateObjectsWithGlobalIDs(java.util.List anArray)
invalidateObjectsWithGlobalIDs
in class EOObjectStore
public boolean isObjectLockedWithGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext)
isObjectLockedWithGlobalID
in class EOObjectStore
public void lockObject(java.lang.Object anObject)
public void lockObjectWithGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext)
lockObjectWithGlobalID
in class EOObjectStore
public boolean locksObjectsBeforeFirstModification()
public java.lang.Object messageHandler()
public java.lang.Object objectForGlobalID(EOGlobalID aGlobalID)
public net.wotonomy.foundation.NSArray objectsForSourceGlobalID(EOGlobalID aGlobalID, java.lang.String aRelationshipKey, EOEditingContext aContext)
objectsForSourceGlobalID
in class EOObjectStore
public net.wotonomy.foundation.NSArray objectsWithFetchSpecification(EOFetchSpecification aFetchSpec)
public net.wotonomy.foundation.NSArray objectsWithFetchSpecification(EOFetchSpecification aFetchSpec, EOEditingContext aContext)
objectsWithFetchSpecification
in class EOObjectStore
public EOObjectStore parentObjectStore()
public void processRecentChanges()
public boolean propagatesDeletesAtEndOfEvent()
public void recordObject(java.lang.Object anObject, EOGlobalID aGlobalID)
public void redo()
public void refault()
public void refaultObject(java.lang.Object anObject, EOGlobalID aGlobalID, EOEditingContext aContext)
refaultObject
in class EOObjectStore
public void refaultObjects()
public void refetch()
public net.wotonomy.foundation.NSArray registeredObjects()
public void removeEditor(java.lang.Object anObject)
public void reset()
public void revert()
public EOObjectStore rootObjectStore()
public void saveChanges()
public void saveChangesInEditingContext(EOEditingContext aContext)
saveChangesInEditingContext
in class EOObjectStore
public void setDelegate(java.lang.Object anObject)
public void setFetchTimestamp(double aDouble)
public void setLocksObjectsBeforeFirstModification(boolean locksObjects)
public void setMessageHandler(java.lang.Object anObject)
public void setPropagatesDeletesAtEndOfEvent(boolean propagatesDeletes)
public void setStopsValidationAfterFirstError(boolean stopsValidation)
public boolean stopsValidationAfterFirstError()
public void undo()
public net.wotonomy.foundation.NSArray updatedObjects()
public void handleNotification(net.wotonomy.foundation.NSNotification aNotification)
public void objectWillChange(java.lang.Object anObject)
objectWillChange
in interface EOObserving
public static double defaultFetchTimestampLag()
public static EOObjectStore defaultParentObjectStore()
public static boolean instancesRetainRegisteredObjects()
public static void setDefaultFetchTimestampLag(double aDouble)
public static void setDefaultParentObjectStore(EOObjectStore anObjectStore)
public static void setInstancesRetainRegisteredObjects(boolean retainsObjects)
public java.lang.String toString()
toString
in class java.lang.Object
public void flushRecentChanges(java.lang.Object anObject)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |