Home | Trees | Index | Help |
|
---|
Package Modeling :: Module Entity :: Class Entity |
|
KeyValueCoding
--+ |object
--+ |XMLCapability
--+ | Entity
Describes an entity An entity defines a class and its corresponding persistence schema. Implementation notes: - the role of 'typeName' is not clear enough for the moment being. It should probably be moved into a special recipient for parameters specifically needed at generation-time (as well as others generation-dedicated values: ...) Methods related to inheritance: %(inheritance_methods)s Unimplemented features: - fetch specifications - (beginning of-!) shared objects
Method Summary | |
---|---|
Initializes an entity. | |
Adds 'anAttribute' to the set of this entity's attributes. | |
Adds 'aRelationship' to the set of this entity's relationships. | |
Registers the supplied entity as a sub-entity (inheritance) | |
Returns the list of all sub-entities of the current entity, i.e. | |
Returns the names of the entities returned by allSubEntities(), as a list | |
Returns the attributes named 'aName' or 'None' if it does not exist. | |
Returns the full set of attributes | |
Returns the full set ('tuple') of attributes' name. | |
Returns a subset (a 'list') of the entity's attributes, those which fall into at least one of these categories: | |
TBD | |
attributesUsedForLockingNames(self)
| |
Returns the class description assigned to this entity | |
Returns the class name associated to this entity | |
Returns the list of class properties (attributes+relationships) | |
Returns the list of attributes that are class properties | |
Returns the list of relationships that are class properties | |
Returns the list of class properties' names (attributes+relationships) | |
Returns a copy of the current Entity | |
Returns the comment field | |
Returns the list of the entity's defined keys, i.e. | |
Tells whether this Entity declares the supplied property | |
Tells whether this Entity declares the supplied (python) property | |
Tells whether this entity defines table columns: if this entity has an externalName() and at least one of its attributes has a columnName(), the answer is '1' (true), '0' (false) otherwise. | |
Returns the object ('Entity' or 'Attribute') at the end of the 'keyPath'. | |
Check all relationships defined in the entity, identify all (destination) entities which belong to a different model than receiver's one, and returns the list of their model. | |
Returns the external name of the entity | |
Returns the (DOM) DocumentObject for the receiver. | |
Returns the GlobalID corresponding to the supplied raw data, as returned e.g. | |
See interfaces.KeyValueCoding for details | |
See interfaces.KeyValueCoding for details | |
Initializes an entity with the supplied xml.dom.node. | |
Indicates whether the entity is abstract. | |
Indicates whether the entity is abstract. | |
Checks that 'aName' is a valid name for an attribute. | |
Checks that 'aName' is a valid name for a relationship. | |
_TBD to be implemented | |
Tells whether the receiver is a read-only attribute | |
Returns false if the attribute is not one of the Entity's attributes, or if it answers true to the message 'isDerived()' ; otherwise, returns true. | |
Checks whether the supplied attribute is a valid possible primary key. | |
Returns the model this entity is related to | |
Returns the name of the model this entity is related to | |
Returns the module's name where the corresponding class can be found If unset, defaults to 'className' | |
Returns the Entity's name | |
Returns the list of entity's properties (attributes or relationships) which are not declared in the parent entity, or all its attributes and relationships if the entity does not have a parent entity. | |
Returns the list of the names of properties returned by newOrOverriddenProperties() | |
Returns the list of entity's python properties (attributes or relationships) which are not declared in the parent entity, or all its attributes and relationships if the entity does not have a parent entity. | |
Returns the list of the names of properties returned by newOrOverriddenPythonProperties() | |
Returns a list consisting in the Relationship instances that needs to be traversed to reach the final element, plus this final element which is either an Attribute or an Entity object. | |
Returns the model this entity is related to | |
Returns the parent entities (a la super-class, cf. | |
Returns the parent entity (a la super-class, cf. | |
Returns the parent entity's name (a la super-class, cf. | |
Returns a list containing the names of the attributes assigned to the entity's PK. | |
Returns the array of attributes used as primary keys | |
Returns the primaryKey used when 'aGlobalID' was initialized, or None if 'aGlobalID' is not a KeyGlobalID. | |
Computes the primary key from 'aRowDictionary'. | |
Returns the name to be used by SchemaGeneration and AdaptorChannel concrete subclasses, e.g. | |
Return the property named 'aName' (either an Attribute or a Relationship) | |
Internally called by Attribute and Relationship.setName() after a property's name has changed. | |
Returns the qualifier on can use to fetch the object identified by primary key values as supplied in 'row' | |
Returns the attributes named 'aName' or None if it does not exist. | |
Returns the full set of relationships ; it is returned as a dictionary where keys are 'relationshipName's and values 'Relationship' instances. | |
Returns the full set ('tuple') of relationships' name. | |
Removes the supplied entity from the registered child entities. | |
Removes the supplied relationship from the registered relationships. | |
Removes the supplied entity from the registered child entities. | |
Returns the restrcting qualifier. | |
Returns the root entity of the current entity | |
setAttributesUsedForLocking(self,
attributes)
| |
Sets the class name associated to this entity | |
Sets the comment field | |
Sets the external name | |
Tells this entity whether it is abstract, according to the supplied boolean. | |
Tells this entity whether it is abstract, according to the supplied boolean. | |
Sets the module's name where the corresponding class can be found | |
Sets the name for the entity. | |
See also: %(inheritance_methods)s | |
Assigns the set of attributes used as primary keys ; empties the list of PKs if parameter is an empty sequence. | |
Sets the read-only status for this entity | |
Sets the restricting qualifier. | |
Sets the meta-type associated with this entity. | |
See also: %(inheritance_methods)s | |
Returns the sub-entity named 'aName' or None if it does not exist. | |
Returns the meta-type associated with this entity | |
Checks whether the supplied object is valid. | |
. | |
Inherited from object | |
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 XMLCapability | |
Returns the node name corresponding to the receiver | |
| |
| |
| |
Inherited from KeyValueCoding | |
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 | |
---|---|
Inherited from KeyValueCoding | |
tuple |
__implements__ = (<class Modeling.interfaces.KeyValueCod...
|
Method Details |
---|
__init__(self,
name='',
aModel=None)
Initializes an entity. A name must be provided. |
addAttribute(self, anAttribute)Adds 'anAttribute' to the set of this entity's attributes. Raises 'ModelError' if 'anAttribute' is not a 'Attribute' instance. Raises 'ValueError' if anAttribute's name is already registered by an attribute or a relationship. See also: definedKeys() |
addRelationship(self, aRelationship)Adds 'aRelationship' to the set of this entity's relationships. Raises 'ModelError' if 'aRelationship' is not a 'Relationship' instance. Raises 'ValueError' if aRelationship's name is already registered by an attribute or a relationship. See also: definedKeys() |
addSubEntity(self, aChildEntity)Registers the supplied entity as a sub-entity (inheritance) See also: %(inheritance_methods)s |
allSubEntities(self)Returns the list of all sub-entities of the current entity, i.e. its direct sub-entities, the direct sub-entities of its sub-entities, etc. See also: %(inheritance_methods)s |
allSubEntitiesNames(self)Returns the names of the entities returned by allSubEntities(), as a list See also: %(inheritance_methods)s |
attributeNamed(self, aName)Returns the attributes named 'aName' or 'None' if it does not exist. |
attributes(self)Returns the full set of attributes |
attributesNames(self)Returns the full set ('tuple') of attributes' name. |
attributesToFetch(self)Returns a subset (a 'list') of the entity's attributes, those which fall into at least one of these categories:
|
attributesUsedForLocking(self)TBD |
classDescriptionForInstances(self)Returns the class description assigned to this entity You should rarely need to call this method directly ; instead, use the ClassDescription's static method 'classDescriptionForName()' which takes care of finding the appropriate class description.
|
className(self)Returns the class name associated to this entity |
classProperties(self)Returns the list of class properties (attributes+relationships) |
classProperties_attributes(self)Returns the list of attributes that are class properties |
classProperties_relationships(self)Returns the list of relationships that are class properties |
classPropertiesNames(self)Returns the list of class properties' names (attributes+relationships) |
clone(self, name=None, model=None)Returns a copy of the current Entity This is not used in the core, but a modelization tool could take advantage of it to prepare a subEntity for the current Entity. Note: remember that, contrary to a object-model where inherited properties are not specified again in subEntity, the goal of a model is to propose a description on how properties are mapped to a database, hence: a subentity describes each of it parent's properties as well (see documentation on howto to design a model, paragraph 'Dealing with inheritance', for further details). Parameters:
|
comment(self)Returns the comment field |
definedKeys(self)Returns the list of the entity's defined keys, i.e. its attributes' and relationships' names |
definesProperty(self, property)Tells whether this Entity declares the supplied property Parameter: property -- an Attribute or Relationship instance Returns a true value (integer 1) iff all the following conditions evaluate to true:
Otherwise, returns false. This is not used within the framework's core, rather when python code is generating from a model ; this allows the generatiion mechanism to know if an attribute is overridden or new in a subclass. See also: newOrOverriddenProperties() |
definesPythonProperty(self, property)Tells whether this Entity declares the supplied (python) property Parameter: property -- an Attribute or Relationship instance Returns a true value (integer 1) iff all the following conditions evaluate to true:
Otherwise, returns false. This is not used within the framework's core, rather when python code is generating from a model ; this allows the generatiion mechanism to know if an attribute is overridden or new in a subclass. See also: newOrOverriddenPythonProperties() |
definesTableColumns(self)Tells whether this entity defines table columns: if this entity has an externalName() and at least one of its attributes has a columnName(), the answer is '1' (true), '0' (false) otherwise. See also: SchemaGeneration.tableEntityGroupsForEntities() |
destinationObjectForKeyPath(self, keyPath)Returns the object ('Entity' or 'Attribute') at the end of the 'keyPath'. For example, say you have an entity 'Author' with a toMany relationship 'books' to the entity 'Book' which has an attribute 'title': the returned value for 'keypath="books.title"' is that Book's attribute named 'title'. Returned value is either an 'Attribute' or a 'Entity' object. Raises ValueError if keyPath is not a valid keypath (i.e. if it is None, empty or if at least one element in 'keyPath' does not correspond to a valid object in the model) See also: objectPathForKeyPath() |
externalModelsReferenced(self)Check all relationships defined in the entity, identify all (destination) entities which belong to a different model than receiver's one, and returns the list of their model. Returns a empty list when no external model are referenced. |
externalName(self)Returns the external name of the entity |
getXMLDOM(self, doc=None, parentNode=None, encoding='iso-8859-1')Returns the (DOM) DocumentObject for the receiver. Parameters 'doc' and 'parentDoc' should be both omitted or supplied. If they are omitted, a new DocumentObject is created. If they are supplied, elements are added to the parentNode. Returns: the (possibly new) DocumentObject.
|
globalIDForRow(self, aRowDictionary)Returns the GlobalID corresponding to the supplied raw data, as returned e.g. by 'AdaptorChannel.fetchRow()', to be used by an object belonging to this entity. Returned object's class is 'KeyGlobalID'. Parameter: aRowDictionary -- a dictionary whose keys are attributes'names, with their corresponding values. See also: primaryKeyForRow(), primaryKeyForGlobalID() |
handleAssignementForUnboundKey(self, value, key)See interfaces.KeyValueCoding for details
|
handleTakeStoredValueForUnboundKey(self, value, key)See interfaces.KeyValueCoding for details
|
initWithXMLDOMNode(self, aNode, phase=1, parent=None, encoding='iso-8859-1')Initializes an entity with the supplied xml.dom.node. Parameter phase can be either 1 or 2 (but nothing else). Phase 1 initializes the attribute, phase 2 initializes relationships A XMLutils.XMLImportError is raised if the entity is not empty, i.e. if it already holds some attributes and/or relationships. |
isAbstract(self)Indicates whether the entity is abstract. |
isAbstractEntity(self)Indicates whether the entity is abstract. |
isaValidAttributeName(self, aName)Checks that 'aName' is a valid name for an attribute. A name is valid iff: - its first letter is a letter or an underscore, - no attribute is already registered with the same name. |
isaValidRelationshipName(self, aName)Checks that 'aName' is a valid name for a relationship. A name is valid iff: - its first letter is a letter or an underscore, - no relationship is already registered with the same name. |
isPrimaryKeyValidInObject(self, anObject)_TBD to be implemented |
isReadOnly(self)Tells whether the receiver is a read-only attribute |
isValidAttributeUsedForLocking(self, anAttribute)Returns false if the attribute is not one of the Entity's attributes, or if it answers true to the message 'isDerived()' ; otherwise, returns true. |
isValidPrimaryKey(self, anAttribute)Checks whether the supplied attribute is a valid possible primary key. Parameter anAttribute can be either an Attribute instance or an attribute's name -- in any case the corresponding attribute's type can be either 'int' or 'string', nothing else. Returns false (integer '0') if anAttribute cannot be found in the entity, or if it does not belong to the entity ; returns '1' for true. |
model(self)Returns the model this entity is related to |
modelName(self)Returns the name of the model this entity is related to |
moduleName(self)Returns the module's name where the corresponding class can be found If unset, defaults to 'className' See also: className(), Model.packageName() |
name(self)Returns the Entity's name |
newOrOverriddenProperties(self)Returns the list of entity's properties (attributes or relationships) which are not declared in the parent entity, or all its attributes and relationships if the entity does not have a parent entity. This is not used within the framework's core, but a GUI designed to build model can take advantage of this to distinguish inherited from non-inherited properties in an entity. See also: definesProperty() See also: %(inheritance_methods)s |
newOrOverriddenPropertiesNames(self)Returns the list of the names of properties returned by newOrOverriddenProperties() See also: newOrOverriddenProperties(), newOrOverriddenPythonProperties() |
newOrOverriddenPythonProperties(self)Returns the list of entity's python properties (attributes or relationships) which are not declared in the parent entity, or all its attributes and relationships if the entity does not have a parent entity. This is not used within the framework's core, but a process generating code templates from a model can take advantage of this to distinguish inherited python properties from new ones in a given entity. For a description of what precisely is a 'python property', see definesPythonProperty() See also: newOrOverriddenProperties() |
newOrOverriddenPythonPropertiesNames(self)Returns the list of the names of properties returned by newOrOverriddenPythonProperties() |
objectsPathForKeyPath(self, keyPath)Returns a list consisting in the Relationship instances that needs to be traversed to reach the final element, plus this final element which is either an Attribute or an Entity object. Raises ValueError if 'keyPath' is not a valid path. See also: destinationObjectForKeyPath() |
parent(self)Returns the model this entity is related to |
parentEntities(self)Returns the parent entities (a la super-class, cf. inheritance) The returned set is ordered: it begins with the direct parent, and ends with the rootEntity(). See also: %(inheritance_methods)s |
parentEntity(self)Returns the parent entity (a la super-class, cf. inheritance) See also: %(inheritance_methods)s |
parentEntityName(self)Returns the parent entity's name (a la super-class, cf. inheritance) See also: %(inheritance_methods)s |
primaryKeyAttributeNames(self)Returns a list containing the names of the attributes assigned to the entity's PK. |
primaryKeyAttributes(self)Returns the array of attributes used as primary keys |
primaryKeyForGlobalID(self, aGlobalID)Returns the primaryKey used when 'aGlobalID' was initialized, or None if 'aGlobalID' is not a KeyGlobalID. The return value is a dictionary mapping the primary key's component(s) with its (their) respective value.
|
primaryKeyForRow(self, aRowDictionary)Computes the primary key from 'aRowDictionary'. 'aRowDictionary' is a database row, i.e. a dictionary mapping a (TABLE's) columns' names to their values. The returned primary key is a sub-dictionary of aRowDictionary containing only the primary key. See also: primaryKeyAttributeNames(), globalIDForRow() |
primaryKeyRootName(self)Returns the name to be used by SchemaGeneration and AdaptorChannel concrete subclasses, e.g. to generate and use SQL sequence to get primary keys of newly inserted objects. This method returns the externalName of the underlying entity's rootEntity, or simply its name if it has no externalName assigned (e.g. abstract entities). See also: rootEntity() |
propertyNamed(self, aName)Return the property named 'aName' (either an Attribute or a Relationship) |
propertyNameDidChange(self, oldName)Internally called by Attribute and Relationship.setName() after a property's name has changed. Parameter: oldName -- the name of the property before it was changed Raises ValueError if no property could be found under the supplied name |
qualifierForPrimaryKey(self, row)Returns the qualifier on can use to fetch the object identified by primary key values as supplied in 'row' This is typically called when a toOne fault ('AccessFaultHandler') is triggered and has to fetch the corresponding datas, or when an DatabaseObject is turned back into a fault. Raises ValueError if anything wrong happens (empty dictionary, keys that do not correspond to the entity's PKs, etc.) Parameter: row -- a dictionary with keys as PK attributes' names and their corresponding values. See also: interface 'Faulting', 'FaultHandler', 'AccessFaultHandler' |
relationshipNamed(self, aName)Returns the attributes named 'aName' or None if it does not exist. |
relationships(self)Returns the full set of relationships ; it is returned as a dictionary where keys are 'relationshipName's and values 'Relationship' instances. |
relationshipsNames(self)Returns the full set ('tuple') of relationships' name. |
removeAttribute(self, anAttribute)Removes the supplied entity from the registered child entities. Parameter 'anEntity' can be either an 'Entity' instance or a subentity's name. Raises 'ModelError' if 'anEntity' cannot be found. |
removeRelationship(self, aRelationship)Removes the supplied relationship from the registered relationships. Parameter 'aRelationship' can be either an 'Relationship' instance or a relation's name. Raises 'ModelError' if 'aRelationship' cannot be found. |
removeSubEntity(self, aChildEntity)Removes the supplied entity from the registered child entities. Parameter 'aChildEntity' can be either an 'Entity' instance or a subentity's name. Raises 'ModelError' if 'anEntity' cannot be found. See also: %(inheritance_methods)s |
restrictingQualifier(self)Returns the restrcting qualifier. Not implemented yet, simply returns None NB: a restricting qualifier is handy when all entities and their root entity (speaking of inheritance) map to a single database. |
rootEntity(self)Returns the root entity of the current entity See also: %(inheritance_methods)s |
setClassName(self, aName)Sets the class name associated to this entity |
setComment(self, aComment)Sets the comment field |
setExternalName(self, externalName)Sets the external name |
setIsAbstract(self, aBool)Tells this entity whether it is abstract, according to the supplied boolean. if aBool is a string equal to '0', it evaluates to 'false' |
setIsAbstractEntity(self, aBool)Tells this entity whether it is abstract, according to the supplied boolean. if aBool is a string equal to '0', it evaluates to 'false' |
setModuleName(self, aName)Sets the module's name where the corresponding class can be found See also: moduleName() |
setName(self, aName)Sets the name for the entity. Raises 'ModelError' if the name is invalid or if it is already used by an other entity in the Model or the enclosing ModelSet. See also: Model.isEntityNameDeclaredInNamespace() |
setParentEntity(self, anEntity)See also: %(inheritance_methods)s |
setPrimaryKeyAttributes(self, PKs)Assigns the set of attributes used as primary keys ; empties the list of PKs if parameter is an empty sequence. Parameter 'PKs' can be either a sequence of Attributes or a sequence of Attributes' names. Raise ValueError if parameter 'PKs' is not a sequence. Raises 'ModelError' if 'self.isValidPrimaryKey()' returns false for at least one of the attributes. |
setReadOnly(self, aBoolean)Sets the read-only status for this entity |
setRestrictingQualifier(self, aQualifier)Sets the restricting qualifier. Not implemented yet, this method unconditionally raises NotImplementedError. See also: restrictingQualifier() |
setTypeName(self, aName)Sets the meta-type associated with this entity. |
subEntities(self)See also: %(inheritance_methods)s |
subEntitiesNamed(self, aName)Returns the sub-entity named 'aName' or None if it does not exist. See also: %(inheritance_methods)s |
typeName(self)Returns the meta-type associated with this entity |
validateValue(self, object)Checks whether the supplied object is valid. Each attribute and relationship related to this entity is checked against the object's values. Raises:
|
xmlAttributesDict(self). |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Sat Mar 4 13:36:25 2006 | http://epydoc.sf.net |