From 40a9d99496e098562f090fb7ffce9e749011b131 Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Mon, 20 May 2024 17:58:16 -0400 Subject: Formatting pass --- .../java/net/wotonomy/control/EditingContext.java | 441 +++++++++------------ 1 file changed, 196 insertions(+), 245 deletions(-) (limited to 'projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EditingContext.java') diff --git a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EditingContext.java b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EditingContext.java index ee40f23..1a120a5 100644 --- a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EditingContext.java +++ b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EditingContext.java @@ -25,259 +25,210 @@ import java.util.Map; //import javax.swing.undo.UndoManager; /** -* EditingContext provides transactional support for -* fetching, editing, and committing changes made on a -* collection of objects to a parent object store. -* This subclasses EOEditingContext to provide -* java-friendly conveniences. -* -* @author michael@mpowers.net -* @author $Author: cgruber $ -* @version $Revision: 894 $ -*/ -public class EditingContext extends EOEditingContext -{ - /** - * Default constructor creates a new editing context - * that uses the default object store. If the default - * object store has not been set, an exception is thrown. - */ - public EditingContext() - { - this( defaultParentObjectStore() ); - } - - /** - * Creates a new editing context that uses the specified - * object store as its parent object store. - */ - public EditingContext( EOObjectStore anObjectStore ) - { - super( anObjectStore ); - } - - /** - * Returns a 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). - * All objects must be registered in the specified editing context. - * This implementation calls to its parent object store's - * implementation if the requested source object is not - * registered in this editing context. - * The specified relationship key must produce a result of - * type Collection for the source object or an exception is thrown. - */ - public List getArrayFaultWithSourceGlobalID ( - EOGlobalID aGlobalID, - String aRelationshipKey, - EOEditingContext aContext ) - { - return arrayFaultWithSourceGlobalID( - aGlobalID, aRelationshipKey, aContext ); - } - - /** - * Returns a snapshot of the specified object as it - * existed when it was last read or committed to the - * parent object store. - */ - public Map getCommittedSnapshotForObject ( - Object anObject ) - { - return committedSnapshotForObject( anObject ); - } - - /** - * Returns a snapshot of the specified object as it - * existed before the edits triggered by the current - * event loop were processed. - */ - public Map getCurrentEventSnapshotForObject ( - Object anObject ) - { - return currentEventSnapshotForObject( anObject ); - } - - /** - * Returns the delegate for this editing context, - * or null if no delegate has been set. - */ - public Object getDelegate () - { - return delegate(); - } - - /** - * Returns a List of all objects marked as deleted - * in this editing context. - */ - public List getDeletedObjects () - { - return deletedObjects(); - } - - /** - * Returns a List of registered editors of this - * editing context. - */ - public List getEditors() - { - return editors(); - } - - /** - * Returns the object for the specified id. - * If the object's data has not been fetched, - * it will be fetched when needed. - */ - public Object getFaultForGlobalID ( - EOGlobalID aGlobalID ) - { - return faultForGlobalID( aGlobalID, this ); - } - - /** - * Returns a fault representing an object of - * the specified entity type with values from - * the specified dictionary. - */ - public Object getFaultForRawRow ( - Map aDictionary, - String anEntityName ) - { - return faultForRawRow( aDictionary, anEntityName ); - } - - /** - * Returns the fetch timestamp for this editing context. - */ - public double getFetchTimestamp() - { - return fetchTimestamp(); - } - - /** - * Returns the id for the specified object, or null - * if the object is not registered in this context. - */ - public EOGlobalID getGlobalIDForObject ( - Object anObject ) - { - return globalIDForObject( anObject ); - } - - /** - * Returns a List of the objects that have been - * inserted into this editing context. - */ - public List getInsertedObjects () - { - return insertedObjects(); - } - - /** - * Returns the message handler for this editing context, - * or null if no message handler has been set. - */ - public Object getMessageHandler () - { - return messageHandler(); - } - - /** - * Returns the object registered in this editing context - * for the specified id, or null if that id is not - * registered. - */ - public Object getObjectForGlobalID ( - EOGlobalID aGlobalID ) - { - return objectForGlobalID( aGlobalID ); - } - - /** - * Returns a List of objects the meet the criteria of - * the supplied specification. - */ - public List getObjectsWithFetchSpecification ( - EOFetchSpecification aFetchSpec ) - { - return objectsWithFetchSpecification( aFetchSpec ); - } - - /** - * Returns the parent object store for this editing context. - * The result will not be null. - */ - public EOObjectStore getParentObjectStore () - { - return parentObjectStore(); - } - - /** - * Returns a List of all objects registered in this - * editing context. - */ - public List geRegisteredObjects () - { - return registeredObjects(); - } - - /** - * Returns the root object store, which is the parent - * of all parent object stores of this editing context. - */ - public EOObjectStore getRootObjectStore () - { - return rootObjectStore(); - } - - /** - * Returns a list of all objects marked as modified, - * but not inserted or deleted, in this editing context. - */ - public List getUpdatedObjects () - { - return updatedObjects(); - } - - // static methods - - public static double getDefaultFetchTimestampLag() - { - return defaultFetchTimestampLag(); - } - - /** - * Returns the default parent object store for all - * object stores created with the parameterless - * constructor. - */ - public static EOObjectStore getDefaultParentObjectStore() - { - return defaultParentObjectStore(); - } + * EditingContext provides transactional support for fetching, editing, and + * committing changes made on a collection of objects to a parent object store. + * This subclasses EOEditingContext to provide java-friendly conveniences. + * + * @author michael@mpowers.net + * @author $Author: cgruber $ + * @version $Revision: 894 $ + */ +public class EditingContext extends EOEditingContext { + /** + * Default constructor creates a new editing context that uses the default + * object store. If the default object store has not been set, an exception is + * thrown. + */ + public EditingContext() { + this(defaultParentObjectStore()); + } + + /** + * Creates a new editing context that uses the specified object store as its + * parent object store. + */ + public EditingContext(EOObjectStore anObjectStore) { + super(anObjectStore); + } + + /** + * Returns a 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). All objects must + * be registered in the specified editing context. This implementation calls to + * its parent object store's implementation if the requested source object is + * not registered in this editing context. The specified relationship key must + * produce a result of type Collection for the source object or an exception is + * thrown. + */ + public List getArrayFaultWithSourceGlobalID(EOGlobalID aGlobalID, String aRelationshipKey, + EOEditingContext aContext) { + return arrayFaultWithSourceGlobalID(aGlobalID, aRelationshipKey, aContext); + } + + /** + * Returns a snapshot of the specified object as it existed when it was last + * read or committed to the parent object store. + */ + public Map getCommittedSnapshotForObject(Object anObject) { + return committedSnapshotForObject(anObject); + } + + /** + * Returns a snapshot of the specified object as it existed before the edits + * triggered by the current event loop were processed. + */ + public Map getCurrentEventSnapshotForObject(Object anObject) { + return currentEventSnapshotForObject(anObject); + } + + /** + * Returns the delegate for this editing context, or null if no delegate has + * been set. + */ + public Object getDelegate() { + return delegate(); + } + + /** + * Returns a List of all objects marked as deleted in this editing context. + */ + public List getDeletedObjects() { + return deletedObjects(); + } + + /** + * Returns a List of registered editors of this editing context. + */ + public List getEditors() { + return editors(); + } + + /** + * Returns the object for the specified id. If the object's data has not been + * fetched, it will be fetched when needed. + */ + public Object getFaultForGlobalID(EOGlobalID aGlobalID) { + return faultForGlobalID(aGlobalID, this); + } + + /** + * Returns a fault representing an object of the specified entity type with + * values from the specified dictionary. + */ + public Object getFaultForRawRow(Map aDictionary, String anEntityName) { + return faultForRawRow(aDictionary, anEntityName); + } + + /** + * Returns the fetch timestamp for this editing context. + */ + public double getFetchTimestamp() { + return fetchTimestamp(); + } + + /** + * Returns the id for the specified object, or null if the object is not + * registered in this context. + */ + public EOGlobalID getGlobalIDForObject(Object anObject) { + return globalIDForObject(anObject); + } + + /** + * Returns a List of the objects that have been inserted into this editing + * context. + */ + public List getInsertedObjects() { + return insertedObjects(); + } + + /** + * Returns the message handler for this editing context, or null if no message + * handler has been set. + */ + public Object getMessageHandler() { + return messageHandler(); + } + + /** + * Returns the object registered in this editing context for the specified id, + * or null if that id is not registered. + */ + public Object getObjectForGlobalID(EOGlobalID aGlobalID) { + return objectForGlobalID(aGlobalID); + } + + /** + * Returns a List of objects the meet the criteria of the supplied + * specification. + */ + public List getObjectsWithFetchSpecification(EOFetchSpecification aFetchSpec) { + return objectsWithFetchSpecification(aFetchSpec); + } + + /** + * Returns the parent object store for this editing context. The result will not + * be null. + */ + public EOObjectStore getParentObjectStore() { + return parentObjectStore(); + } + + /** + * Returns a List of all objects registered in this editing context. + */ + public List geRegisteredObjects() { + return registeredObjects(); + } + + /** + * Returns the root object store, which is the parent of all parent object + * stores of this editing context. + */ + public EOObjectStore getRootObjectStore() { + return rootObjectStore(); + } + + /** + * Returns a list of all objects marked as modified, but not inserted or + * deleted, in this editing context. + */ + public List getUpdatedObjects() { + return updatedObjects(); + } + + // static methods + + public static double getDefaultFetchTimestampLag() { + return defaultFetchTimestampLag(); + } + + /** + * Returns the default parent object store for all object stores created with + * the parameterless constructor. + */ + public static EOObjectStore getDefaultParentObjectStore() { + return defaultParentObjectStore(); + } } /* - * $Log$ - * Revision 1.2 2006/02/16 16:47:14 cgruber - * Move some classes in to "internal" packages and re-work imports, etc. + * $Log$ Revision 1.2 2006/02/16 16:47:14 cgruber Move some classes in to + * "internal" packages and re-work imports, etc. * - * Also use UnsupportedOperationExceptions where appropriate, instead of WotonomyExceptions. + * Also use UnsupportedOperationExceptions where appropriate, instead of + * WotonomyExceptions. * - * Revision 1.1 2006/02/16 13:19:57 cgruber - * Check in all sources in eclipse-friendly maven-enabled packages. + * Revision 1.1 2006/02/16 13:19:57 cgruber Check in all sources in + * eclipse-friendly maven-enabled packages. * - * Revision 1.2 2003/08/06 23:07:52 chochos - * general code cleanup (mostly, removing unused imports) + * Revision 1.2 2003/08/06 23:07:52 chochos general code cleanup (mostly, + * removing unused imports) * - * Revision 1.1 2002/03/26 21:46:36 mpowers - * Contributing EditingContext as a java-friendly convenience. + * Revision 1.1 2002/03/26 21:46:36 mpowers Contributing EditingContext as a + * java-friendly convenience. * * */ - - -- cgit v1.2.3