Package Modeling :: Package interfaces :: Module EditingContext :: Class IEditingContext
[show private | hide private]
[frames | no frames]

Class IEditingContext

            Base --+    
                   |    
ObjectStoreInterface --+
                       |
            Base --+   |
                   |   |
  ObservingInterface --+
                       |
                      IEditingContext


EditingContext: an in-memory world/graph of objects, with the ability to ensure its own persistance, to check its consistency, etc.
Method Summary
  __init__(self, parentObjectStore)
Initializes an 'EditingContext'.
  __del__(self)
cf.
  deletedObjects(self)
  deleteObject(self, anObject)
Informs the 'EditingContext' that the supplied object should be marked as deleted, so that it will actually be deleted when the receiver saves changes.
  forgetObject(self, aDatabaseObject)
_TBD Do not call this: for internal use.
  globalIDForObject(self, anObject)
Returns the GlobalID for 'anObject', or 'None' if 'anObject' is not under the receiver's control.
  hasChanges(self)
  initializeObject(self, anObject, aGlobalID, anEditingContext)
Forwards the message to the parentObjectStore(), with the following exception: if 'anEditingContext' 's 'parentObjectStore()' is 'self', i.e.
  insertedObjects(self)
  insertObject(self, anObject)
Inserts a new object within the graph of objects.
  insertObjectWithGlobalID(self, anObject, aTemporaryGlobalID)
You should normally not call this method directly.
  invalidatesObjectsWhenFinalized(self)
default==true==when finalized, sends 'clearProperties' to all objects
  objectForGlobalID(self, aGlobalID)
Returns the object corresponding to the given 'aGlobalID', or 'None' if it cannot be found in the receiver's uniquing table.
  objectsWithFetchSpecification(self, aFetchSpecification, anEditingContext)
If parameter 'anEditingContext' is omitted or 'None', it defaults to 'self', then the message is forwarded down the hierarchy of ObjectStores, i.e.
  objectWillChange(self, anObject)
ObservingInterface implementation
  parentObjectStore(self)
Returns the parent ObjectStore for the receiver See the initializer '__init__' for details ; note that the parent ObjectStore cannot be changed during the whole object's lifetime.
  recordObject(self, anObject, aGlobalID)
  registeredObjects(self)
Returns all objects managed by the EditingContext
  rootObjectStore(self)
Returns the 'ObjectStoreCoordinator' in the underlying hierarchy of 'ObjectStore'.
  saveChanges(self)
  setInvalidatesObjectsWhenFinalized(self, aBool)
  updatedObjects(self)
    Inherited from ObjectStoreInterface
  arrayFaultWithSourceGlobalID(self, aGlobalID, aRelationshipName, anEditingContext)
ObjectStoreCoordinator: see details in interface
  editingContextDidForgetObjectWithGlobalID(self, aContext, aGlobalID)
  faultForGlobalID(self, aGlobalID, anEditingContext)
ObjectStoreCoordinator: see details in interface
  faultForRawRow(self, aRow, anEntityName, anEditingContext)
Turns a row (dictionary) into a real object.
  handlesObject(self, anObject)
An alias for ownsObject
  invalidateAllObjects(self)
ObjectStoreCoordinator: see details in interface
  invalidateObjectsWithGlobalIDs(self, globalIDs)
ObjectStoreCoordinator: see details in interface
  isObjectLockedWithGlobalID(self, aGlobalID, anEditingContext)
anEditingContext optional?
  lockObjectWithGlobalID(self, aGlobalID, anEditingContext)
  objectsCountWithFetchSpecification(self, aFetchSpecification, anEditingContext)
Returns the approximate number of objects that would be returned by objectsWithFetchSpecification() if called with the very same parameters.
  objectsForSourceGlobalID(self, aGlobalID, aRelationshipName, anEditingContext)
ObjectStoreCoordinator: see details in interface
  ownsObject(self, anObject)
Tells whether the object store can handle 'anObject'.
  refaultObject(self, anObject, aGlobalID, anEditingContext)
ObjectStoreCoordinator: see details in interface
  savesChangesInEditingContext(self, anEditingContext)
EditingContext for parent/child ECs configuration

Method Details

__init__(self, parentObjectStore=None)
(Constructor)

Initializes an 'EditingContext'.

Parameter 'parentObjectStore'

determines which 'ObjectStore' the receiver will use to fetch its data and to save changes made in it ; the default (i.e. when the parameter is omitted or equals to 'None') is to use the one returned by 'defaultParentObjectStore()' --which in turn defaults to the application-wide shared 'CooperatingObjectStore.defaultCoordinator()'.

Note that the parent 'ObjectStore' of an 'EditingContext' cannot be changed during the whole object's lifetime.

You will typically use the default behaviour, or provide an parent 'EditingContext' to make the newly created 'EditingContext' a child of the former one (not supported yet __TBD).

__del__(self)
(Destructor)

cf. invalidatesObjectsWhenFinalized()

deleteObject(self, anObject)

Informs the 'EditingContext' that the supplied object should be marked as deleted, so that it will actually be deleted when the receiver saves changes. This is n ot an error to mark an object as deleted more than once: this will be silently ignored.

Parameter 'anObject' should already be registered within the 'EditingContext' ; if not, 'ValueError' is raised.

forgetObject(self, aDatabaseObject)

_TBD Do not call this: for internal use.

globalIDForObject(self, anObject)

Returns the GlobalID for 'anObject', or 'None' if 'anObject' is not under the receiver's control.

initializeObject(self, anObject, aGlobalID, anEditingContext)

Forwards the message to the parentObjectStore(), with the following exception: if 'anEditingContext' 's 'parentObjectStore()' is 'self', i.e. it is a child of 'self', and if 'self' already has an real object (not a fault) with that globalID, the values of this object is used to initialize 'anObject'.

Conformance to the ObjectStore API

Parameters:

anObject -- a DatabaseObject instance

aGlobalID -- the GlobalID of 'anObject'

anEditingContext -- the EditingContext which holds 'anObject'

Overrides:
Modeling.interfaces.ObjectStoreInterface.ObjectStoreInterface.initializeObject

insertObject(self, anObject)

Inserts a new object within the graph of objects. The 'EditingContext' builds a 'TemporaryGlobalID' for that object, registers the object as a new one in its graph of objects and registers itself as an observer for that object (see ObserverCenter).

An object should not be inserted more than once. The only valid situation where an object can be re-inserted is when this object has previously been marked as deleted (hence un-deleting the object), otherwise 'ValueError' is raised.

insertObjectWithGlobalID(self, anObject, aTemporaryGlobalID)

You should normally not call this method directly.

Parameter 'aTemporaryGlobalID' must respond 'true' to message 'isTemporary' (raises 'ValueError' otherwise)

invalidatesObjectsWhenFinalized(self)

default==true==when finalized, sends 'clearProperties' to all objects

objectForGlobalID(self, aGlobalID)

Returns the object corresponding to the given 'aGlobalID', or 'None' if it cannot be found in the receiver's uniquing table.

objectsWithFetchSpecification(self, aFetchSpecification, anEditingContext=None)

If parameter 'anEditingContext' is omitted or 'None', it defaults to 'self', then the message is forwarded down the hierarchy of ObjectStores, i.e. to the 'parentObjectStore()'

Conformance to the ObjectStore API

Overrides:
Modeling.interfaces.ObjectStoreInterface.ObjectStoreInterface.objectsWithFetchSpecification

objectWillChange(self, anObject)

ObservingInterface implementation
Overrides:
Modeling.interfaces.ObservingInterface.ObservingInterface.objectWillChange

parentObjectStore(self)

Returns the parent ObjectStore for the receiver See the initializer '__init__' for details ; note that the parent ObjectStore cannot be changed during the whole object's lifetime.

registeredObjects(self)

Returns all objects managed by the EditingContext

rootObjectStore(self)

Returns the 'ObjectStoreCoordinator' in the underlying hierarchy of 'ObjectStore'. Works by forwarding the 'rootObjectStore' message to the 'parentObjectStore()'.

Conformance to the ObjectStore API

Overrides:
Modeling.interfaces.ObjectStoreInterface.ObjectStoreInterface.rootObjectStore

setInvalidatesObjectsWhenFinalized(self, aBool)


Generated by Epydoc 2.1 on Sat Mar 4 13:36:22 2006 http://epydoc.sf.net