Home | Trees | Index | Help |
|
---|
Package Modeling :: Module CustomObject :: Class CustomObject |
|
KeyValueCoding
--+ |DatabaseObject
--+ |object
--+ |RelationshipManipulation
--+ | CustomObject
Validation
See Validation for details
Method Summary | |
---|---|
__editingContext(self)
| |
Returns the whole set of properties, made of attributesKeys(), toManyRelationshipKeys() and toOneRelationshipKeys(). | |
Forwards the message to the object's classDescription() and returns the result. | |
Automatically called by the framework when an object is initialized from its database row. | |
Automatically called by the framework when an object is inserted in an EditingContext. | |
Returns the object's corresponding ClassDescription ; in most cases this is an EntityClassDescription instance. | |
Returns the ClassDescription used for objects that can be referenced by the relationship 'aKey'. | |
CustomObject's implementation simply forwards the message to the underlying classDescription() and returns the result. | |
Returns the EditingContext in which the object was registered, or 'None' | |
Returns the corresponding entity's name. | |
Returns the object's globalID, or None if the object is not registered within an EditingContext | |
CustomObject's implementation simply forwards the message to the underlying classDescription() and returns the result. | |
isToManyKey(self,
aKey)
| |
Handles the deletion of the current object according to the delete rules which apply to its relationships, as defined in the model. | |
Called by an EditingContext when a object is marked as inserted or updated. | |
Returns the snapshot for the current object, i.e. | |
Returns the raw snapshot for the current object, i.e. | |
Forwards the message to the object's classDescription() and returns the result. | |
Forwards the message to the object's classDescription() and returns the result. | |
Given a snapshot, update the current object ; note that if the object is a fault, that fault will be cleared and the object initialized before the changes are made. | |
Default implementation simply sends validateObjectForDelete() to the receiver's ClassDescription. | |
Simply calls validateForSave() | |
First forwards forwards the message to the object's ClassDescription, then iterates on class properties so that they are individually checked --this is done by sending the message 'validateValueForKey()' to oneself. | |
Simply calls validateForSave() | |
Validate the value hold by 'aKey' attribute/relationship in the object. | |
Notifies the observers that the object is about to change. | |
Inherited from object | |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
Inherited from RelationshipManipulation | |
See interfaces.RelationshipManipulating | |
See interfaces.RelationshipManipulating | |
See interfaces.RelationshipManipulating | |
See interfaces.RelationshipManipulating | |
Inherited from DatabaseObject | |
Returns the name of the attribute corresponding to the 'key', i.e. | |
Returns the name of the object's class attribute corresponding to the 'key', i.e. | |
Conformance to the Faulting interface. | |
See interfaces.DatabaseObject for details | |
Conformance to the Faulting interface. | |
Conformance to the Faulting interface. | |
Creates in 'self' the list of attributes specified by keys, if they do not already exists. | |
Conformance to the Faulting interface. | |
Conformance to the Faulting interface. | |
Inherited from KeyValueCoding | |
See interfaces.KeyValueCoding for details | |
See interfaces.KeyValueCoding for details | |
DEPRECATED -- alias for 'takeStoredValueForKey()' | |
DEPRECATED -- alias for takeValueForKey() | |
DEPRECATED -- alias for takeValueForKeyPath() | |
See interfaces.KeyValueCoding for details | |
See interfaces.KeyValueCoding for details | |
See interfaces.KeyValueCoding for details | |
See interfaces.KeyValueCoding for details | |
See interfaces.KeyValueCoding for details | |
See interfaces.KeyValueCoding for details | |
See interfaces.KeyValueCoding for details | |
See interfaces.KeyValueCoding for details | |
See interfaces.KeyValueCoding for details |
Class Variable Summary | |
---|---|
tuple |
__implements__ = (<class Modeling.interfaces.DatabaseObj...
|
NoneType |
_globalID = None |
NoneType |
_v_classDescription = None |
Inherited from DatabaseObject | |
NoneType |
_DatabaseObject__faultHandler = None |
Method Details |
---|
allPropertyKeys(self)Returns the whole set of properties, made of attributesKeys(), toManyRelationshipKeys() and toOneRelationshipKeys(). |
attributesKeys(self)Forwards the message to the object's classDescription() and returns the result. In most cases, if not all, the underlying classDescription() is an EntityClassDescription instance, which only returns attributes that are marked as 'class properties' in the model. See also: toOneRelationshipKeys, toManyRelationshipKeys |
awakeFromFetch(self, anEditingContext)Automatically called by the framework when an object is initialized from its database row. Implementation simply sends 'awakeObjectFromFetch()' to the object's class description. Subclasses can override this method ; if they do, they must make sure that this method is called before making their own initialization. See also: ClassDescription.awakeObjectFromFetch(), awakeFromInsertion() |
awakeFromInsertion(self, anEditingContext)Automatically called by the framework when an object is inserted in an EditingContext. Implementation simply sends 'awakeObjectFromInsertion()' to the object's class description. Subclasses can override this method ; if they do, they must make sure that this method is called before making their own initialization. See also: ClassDescription.awakeObjectFromInsertion(), awakeFromFetch() |
classDescription(self)Returns the object's corresponding ClassDescription ; in most cases this is an EntityClassDescription instance. |
classDescriptionForDestinationKey(self, aKey)Returns the ClassDescription used for objects that can be referenced by the relationship 'aKey'. CustomObject's implementation simply forwards the message to the underlying classDescription() and returns the result. |
deleteRuleForRelationshipKey(self, aKey)CustomObject's implementation simply forwards the message to the underlying classDescription() and returns the result. |
editingContext(self)Returns the EditingContext in which the object was registered, or 'None' |
entityName(self)Returns the corresponding entity's name. Note that derived objects must override this. As a reminder this method raises 'MethodShouldBeOverridden'
|
globalID(self)Returns the object's globalID, or None if the object is not registered within an EditingContext |
inverseForRelationshipKey(self, aKey)CustomObject's implementation simply forwards the message to the underlying classDescription() and returns the result. Sometimes the framework is not able to calculate the correct relationship. For example, it might be that a relationship and its inverse are not based on inverse joins, such as in a one-to-one association, say between a Writer and its PostalAddress, where both relationships store the primary key of the destination entity in a foreign key of their own (I do not want to argue here about such a design, this can happen if you have to work on an existing database). In such a case, you will need to override this method so that the framework can find the inverse relationship. This could be done that way in class Writer: def inverseForRelationshipKey(self, aKey): """ Overrides CustomObject.inverseForRelationshipKey() so that 'toPostalAddress' relationship uses the inverse relationship 'PostalAddress.toAuthor' """ if aKey=='toPostalAddress': return 'toAuthor' else: # call super return CustomObject.inverseForRelationshipKey(self, aKey) Of course, the same needs to be done in class PostalAddress. |
propagateDeleteWithEditingContext(self, editingContext)Handles the deletion of the current object according to the delete rules which apply to its relationships, as defined in the model. CustomObject's implementation simply forwards the message to the underlying classDescription() [using propagateDeleteForObject] and returns the result. Subclasses overriding this method should call this (superclass) method.
|
propagateInsertionWithEditingContext(self, editingContext)Called by an EditingContext when a object is marked as inserted or updated. CustomObject's implementation simply forwards the method to the underlying classDescription() (sending it a propagateInsertionForObject message). Subclasses overriding this method should call this (superclass) method. See also: ClassDescription.propagateInsertionForObject() |
snapshot(self)Returns the snapshot for the current object, i.e. a dictionary whose keys are allPropertyKeys(), and whose values are :
|
snapshot_raw(self)Returns the raw snapshot for the current object, i.e. a dictionary whose keys are allAttributesKeys() with their corresponding values. Special care should be taken when examining the values for primary keys and foreign keys:
Note: this method does not care about PKs or FKs being marked as class properties. Even when they are class properties, it does NOT look at their values, instead the returned values are extracted by examining the objects related to 'self'.
|
toManyRelationshipKeys(self)Forwards the message to the object's classDescription() and returns the result. In most cases, if not all, the underlying classDescription() is an EntityClassDescription instance, which only returns toMany relationships that are marked as 'class properties' in the model. See also: attributesKeys, toOneRelationshipKeys |
toOneRelationshipKeys(self)Forwards the message to the object's classDescription() and returns the result. In most cases, if not all, the underlying classDescription() is an EntityClassDescription instance, which only returns toOne relationships that are marked as 'class properties' in the model. See also: attributesKeys, toManyRelationshipKeys |
updateFromSnapshot(self, aSnapshotDictionary)Given a snapshot, update the current object ; note that if the object is a fault, that fault will be cleared and the object initialized before the changes are made. Parameter: aSnapshotDictionary -- a dictionary, as returned by snapshot() See also: snapshot |
validateForDelete(self)Default implementation simply sends validateObjectForDelete() to the receiver's ClassDescription. Subclasses overriding this method should call it prior to any other checks, and exceptions raised here should be aggegated with custom validation. See also: EntityClassDescription.validateObjectForDelete() |
validateForInsert(self)Simply calls validateForSave() |
validateForSave(self)First forwards forwards the message to the object's ClassDescription, then iterates on class properties so that they are individually checked --this is done by sending the message 'validateValueForKey()' to oneself. Subclasses overriding this method must call it prior to any other checks, and exceptions raised here must be aggegated with custom validation.
|
validateForUpdate(self)Simply calls validateForSave() |
validateValueForKey(self, aValue, aKey)Validate the value hold by 'aKey' attribute/relationship in the object. Default implementation first forwards the message to the object's ClassDescription, which checks that the constraints defined in the underlying model are respected. Then it searches if the object defines a method named 'validate<AKey>' (e.g., with 'aKey=lastName', that method's name would be 'validateLastName': you have already noticed that the first letter of the key is capitalized in the name of the method). If such a method is actually defined by the object, then it is called. You will typically define such a method to define your own validation mechanism (per-key validation). Subclasses should never override this method. If you want to specify your own validation mechanism for a given key, say 'name', you should define a method named 'validateName()' in your class instead, as described above. See: EntityClassDescription.validateValueForKey() |
willChange(self)Notifies the observers that the object is about to change. CustomObject's default implementation calls willRead() on itself before notifying the ObserverCenter |
Class Variable Details |
---|
_globalID
|
_v_classDescription
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Sat Mar 4 13:36:23 2006 | http://epydoc.sf.net |