Package Modeling :: Module Entity :: Class Entity
[show private | hide private]
[frames | no frames]

Type 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
  __init__(self, name, aModel)
Initializes an entity.
  addAttribute(self, anAttribute)
Adds 'anAttribute' to the set of this entity's attributes.
  addRelationship(self, aRelationship)
Adds 'aRelationship' to the set of this entity's relationships.
  addSubEntity(self, aChildEntity)
Registers the supplied entity as a sub-entity (inheritance)
  allSubEntities(self)
Returns the list of all sub-entities of the current entity, i.e.
  allSubEntitiesNames(self)
Returns the names of the entities returned by allSubEntities(), as a list
  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
  attributesUsedForLockingNames(self)
  classDescriptionForInstances(self)
Returns the class description assigned to this entity
  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, model)
Returns a copy of the current Entity
  comment(self)
Returns the comment field
  definedKeys(self)
Returns the list of the entity's defined keys, i.e.
  definesProperty(self, property)
Tells whether this Entity declares the supplied property
  definesPythonProperty(self, property)
Tells whether this Entity declares the supplied (python) property
  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.
  destinationObjectForKeyPath(self, keyPath)
Returns the object ('Entity' or 'Attribute') at the end of the 'keyPath'.
  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.
  externalName(self)
Returns the external name of the entity
  getXMLDOM(self, doc, parentNode, encoding)
Returns the (DOM) DocumentObject for the receiver.
  globalIDForRow(self, aRowDictionary)
Returns the GlobalID corresponding to the supplied raw data, as returned e.g.
  handleAssignementForUnboundKey(self, value, key)
See interfaces.KeyValueCoding for details
  handleTakeStoredValueForUnboundKey(self, value, key)
See interfaces.KeyValueCoding for details
  initWithXMLDOMNode(self, aNode, phase, parent, encoding)
Initializes an entity with the supplied xml.dom.node.
  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.
  isaValidRelationshipName(self, aName)
Checks that 'aName' is a valid name for a relationship.
  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.
  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'
  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.
  newOrOverriddenPropertiesNames(self)
Returns the list of the names of properties returned by newOrOverriddenProperties()
  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.
  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.
  parent(self)
Returns the model this entity is related to
  parentEntities(self)
Returns the parent entities (a la super-class, cf.
  parentEntity(self)
Returns the parent entity (a la super-class, cf.
  parentEntityName(self)
Returns the parent entity's name (a la super-class, cf.
  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.
  primaryKeyForRow(self, aRowDictionary)
Computes the primary key from 'aRowDictionary'.
  primaryKeyRootName(self)
Returns the name to be used by SchemaGeneration and AdaptorChannel concrete subclasses, e.g.
  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.
  qualifierForPrimaryKey(self, row)
Returns the qualifier on can use to fetch the object identified by primary key values as supplied in 'row'
  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.
  removeRelationship(self, aRelationship)
Removes the supplied relationship from the registered relationships.
  removeSubEntity(self, aChildEntity)
Removes the supplied entity from the registered child entities.
  restrictingQualifier(self)
Returns the restrcting qualifier.
  rootEntity(self)
Returns the root entity of the current entity
  setAttributesUsedForLocking(self, attributes)
  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.
  setIsAbstractEntity(self, aBool)
Tells this entity whether it is abstract, according to the supplied boolean.
  setModuleName(self, aName)
Sets the module's name where the corresponding class can be found
  setName(self, aName)
Sets the name for the entity.
  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.
  setReadOnly(self, aBoolean)
Sets the read-only status for this entity
  setRestrictingQualifier(self, aQualifier)
Sets the restricting qualifier.
  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.
  typeName(self)
Returns the meta-type associated with this entity
  validateValue(self, object)
Checks whether the supplied object is valid.
  xmlAttributesDict(self)
.
  _setModel(self, aModel)
Private method called by Model.addEntity() after the necessary checks that take care of enforcing that entities share a single namespace for their names are done.
  _setParentEntity(self, anEntity)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)
    Inherited from XMLCapability
  getXMLNodeName(self)
Returns the node name corresponding to the receiver
  xmlAttributeType(self, attributeName)
  xmlGetAttribute(self, attributeName)
  xmlSetAttribute(self, attributeName)
    Inherited from KeyValueCoding
  handleQueryWithUnboundKey(self, key)
See interfaces.KeyValueCoding for details
  setStoredValueForKey(self, value, key)
DEPRECATED -- alias for 'takeStoredValueForKey()'
  setValueForKey(self, value, key)
DEPRECATED -- alias for takeValueForKey()
  setValueForKeyPath(self, value, keypath)
DEPRECATED -- alias for takeValueForKeyPath()
  storedValueForKey(self, key)
See interfaces.KeyValueCoding for details
  takeStoredValueForKey(self, value, key)
See interfaces.KeyValueCoding for details
  takeStoredValuesFromDictionary(self, dictionary)
See interfaces.KeyValueCoding for details
  takeValueForKey(self, value, key)
See interfaces.KeyValueCoding for details
  takeValueForKeyPath(self, value, key)
See interfaces.KeyValueCoding for details
  takeValuesFromDictionary(self, dictionary)
See interfaces.KeyValueCoding for details
  valueForKey(self, key)
See interfaces.KeyValueCoding for details
  valueForKeyPath(self, keypath)
See interfaces.KeyValueCoding for details
  valuesForKeys(self, keys)
See interfaces.KeyValueCoding for details

Class Variable Summary
tuple _attrsUsedForLocking = ()
str _className = ''
str _comment = ''
str _externalName = ''
int _isReadOnly = 0                                                                     
NoneType _moduleName = None                                                                  
tuple _PKs = ()
    Inherited from KeyValueCoding
tuple __implements__ = (<class Modeling.interfaces.KeyValueCod...

Method Details

__init__(self, name='', aModel=None)
(Constructor)

Initializes an entity. A name must be provided.
Overrides:
__builtin__.object.__init__

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:

  • they are not derived,
  • they are source attributes of a relationship

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.

See also: ModelSet.classDescriptionForEntityName()
ClassDescription.classDescriptionForName()

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:

name -- optional. It it is provided, the cloned entity gets that name, otherwise defaults to 'self.name()'

model -- optional. If it is provided, the cloned Entity is added to the
model ; note that in this case, it is strongly recommended to provide the name for the clone (since two entities cannot have the same name within a single Model or ModelSet --cf. Model.addEntity())

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:

  • the property and the corresponding one in 'self' have the same python type if both are attributes (cf. Attribute.type()), or the same destinationEntity if both are relationships.

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:

  • the property'name is in 'self.classPropertiesNames()'
  • the property and the corresponding one in 'self' have the same python type if both are attributes (cf. Attribute.type()), or the same destinationEntity if both are relationships.

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.

Overrides:
Modeling.XMLutils.XMLCapability.getXMLDOM

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
Overrides:
Modeling.KeyValueCoding.KeyValueCoding.handleAssignementForUnboundKey (inherited documentation)

handleTakeStoredValueForUnboundKey(self, value, key)

See interfaces.KeyValueCoding for details
Overrides:
Modeling.KeyValueCoding.KeyValueCoding.handleAssignementForUnboundKey (inherited documentation)

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.

Note: this method is NOT relative to the current Entity and is strictly
equivalent to KeyGlobalID.keyValues()
See also: globalIDForRow(), primaryKeyForRow(),
KeyGlobalID.__init__(), KeyGlobalID.keyValues()

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:

  • Validation.ValidationException if the supplied object is not related to the current entity, or if it is not under model control at all.
  • Validation.ValidationException if the validation failed

xmlAttributesDict(self)

.
Overrides:
Modeling.XMLutils.XMLCapability.xmlAttributesDict

_setModel(self, aModel)

Private method called by Model.addEntity() after the necessary checks that take care of enforcing that entities share a single namespace for their names are done.

You should never call this method directly, since this could defeat the checks described above: in that case, the Entity could become unreachable from either its Model or ModelSet.


Class Variable Details

_attrsUsedForLocking

Type:
tuple
Value:
()                                                                     

_className

Type:
str
Value:
''                                                                     

_comment

Type:
str
Value:
''                                                                     

_externalName

Type:
str
Value:
''                                                                     

_isReadOnly

Type:
int
Value:
0                                                                     

_moduleName

Type:
NoneType
Value:
None                                                                  

_PKs

Type:
tuple
Value:
()                                                                     

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