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

Type Attribute

KeyValueCoding --+
                 |
        object --+
                 |
 XMLCapability --+
                 |
                Attribute


Describes an attribute
Method Summary
  __init__(self, aName, anEntity)
Initializes an attribute.
  __str__(self)
Returns a printable representation of the attribute ; the format is <entityName>.<attributeName>.
  allowsNone(self)
Indicates whether the attribute can be empty (None) or not (see isRequired inverse method)
  allowsNull(self)
Indicates whether the attribute can be empty (None) or not (see isRequired inverse method)
  availableIndexTypeNames(self)
Returns all available type names, as a tuple
  availableTypes(self)
Returns all available types
  clone(self, name)
Returns a copy of the current Attribute
  columnName(self)
...
  comment(self)
Returns the comment field
  convertStringToAttributeType(self, aValue)
Internally used to convert a string value (taken from a GUI, for example) to the correct type.
  defaultValue(self)
Returns the default value associated to this attribute
  defaultValueAsPythonStatement(self)
Returns the default value in a string that can be used in python code, e.g.
  definition(self)
Returns the definition for a flattened or derived attribute
  displayLabel(self)
Returns the label associated to the current attribute
  entity(self)
Returns the associated 'Entity'
  externalType(self)
  finalAttribute(self)
Returns the final attribute pointed by a flattened attribute.
  flattenedPropertySet(self)
  fullPropertySet(self)
  getXMLDOM(self, doc, parentNode, encoding)
Returns the (DOM) DocumentObject for the receiver.
  handleAssignementForUnboundKey(self, value, key)
See interfaces.KeyValueCoding for details
  handleTakeStoredValueForUnboundKey(self, value, key)
See interfaces.KeyValueCoding for details
  initWithXMLDOMNode(self, aNode, encoding)
Initializes a model with the supplied xml.dom.node.
  isClassProperty(self)
Indicates whether the attribute belongs to the class properties/fields
  isDerived(self)
Tells whether the attribute is derived.
  isFlattened(self)
Indicates whether the attribute is flattened
  isNotClassProperty(self)
negation of isClassProperty
  isRequired(self)
Returns whether the attribute is required (see also: allowsNone)
  name(self)
Returns the attribute's name
  nonDerivedPropertySet(self)
  parent(self)
Returns the associated 'Entity'
  precision(self)
  readFormat(self)
Simply returns the attribute's columnName()
  relationshipPath(self)
Returns the relationshipPath (string) for a flattened attribute, or None if the attribute is not flattened
  relationshipPathObjects(self)
Returns the list ('tuple')of Relationship objects that should be traversed to obtain the finalAttribute(), or None if the attribute is not flattened
  scale(self)
  setAllowsNone(self, allowsNone)
Tells the attribute whether it may have 'None' value or not (see inverse method setIsRequired)
  setColumnName(self, columnName)
...
  setComment(self, aComment)
Sets the comment field
  setDefaultValue(self, aValue)
Sets the default value associated to this attribute
  setDefinition(self, definition)
Sets the definition for a flattened or derived attribute
  setDisplayLabel(self, aName)
Sets the label associated to the attribute
  setExternalType(self, externalType)
  setIsClassProperty(self, aBool)
Tells the receiver whether it belongs to the class properties/fields
  setIsFlattened(self, aBool)
Tells the attribute that it is flattened See also: setDefinition()
  setIsRequired(self, isRequired)
Tells the attribute whether is required or not (inverse of setAllowNone)
  setName(self, aName)
Sets the attribute's name.
  setPrecision(self, precision)
  setScale(self, scale)
  setType(self, aType, check)
Sets the type associated to the attribute.
  setWidth(self, width)
Sets the maximum size for that attribute
  type(self)
Returns the type associated to the attribute.
  validateAttribute(self)
Validates the attributes against general model consistency: - attribute cannot be both public and catalogable - defaultValue should have the correct type - no columnName() for flattened attributes - etc.
  validateValue(self, value, object)
Checks whether the supplied object is valid, i.e.
  width(self)
Returns the maximum width for this attribute.
  xmlAttributesDict(self, select)
    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
    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
    Inherited from KeyValueCoding
tuple __implements__ = (<class Modeling.interfaces.KeyValueCod...

Method Details

__init__(self, aName='', anEntity=None)
(Constructor)

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

__str__(self)
(Informal representation operator)

Returns a printable representation of the attribute ; the format is <entityName>.<attributeName>. If self.entity() is not already set, then it returns None. Note: this string uniquely identificates an attribute in a given ModelSet or Model since entities'names share the same namespace
Overrides:
__builtin__.object.__str__

allowsNone(self)

Indicates whether the attribute can be empty (None) or not (see isRequired inverse method)

allowsNull(self)

Indicates whether the attribute can be empty (None) or not (see isRequired inverse method)

availableIndexTypeNames(self)

Returns all available type names, as a tuple

availableTypes(self)

Returns all available types

clone(self, name=None)

Returns a copy of the current Attribute

Parameter:

name -- optional. If provided the clone gets that name, otherwise defaults to 'self.name()'.

See also: Entity.clone()

columnName(self)

...

comment(self)

Returns the comment field

convertStringToAttributeType(self, aValue)

Internally used to convert a string value (taken from a GUI, for example) to the correct type.

See: setDefaultValue()

defaultValue(self)

Returns the default value associated to this attribute

defaultValueAsPythonStatement(self)

Returns the default value in a string that can be used in python code, e.g. in assignments

This is mainly for use in the generation of templates of code

definition(self)

Returns the definition for a flattened or derived attribute

displayLabel(self)

Returns the label associated to the current attribute

entity(self)

Returns the associated 'Entity'

finalAttribute(self)

Returns the final attribute pointed by a flattened attribute. Returns None if none can be found, or if the attribute is not flattened

See also: isFlattened(), definition(), relationshipPath(),
relationshipPathObjects()

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

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, encoding='iso-8859-1')

Initializes a model with the supplied xml.dom.node.

isClassProperty(self)

Indicates whether the attribute belongs to the class properties/fields

isDerived(self)

Tells whether the attribute is derived. Note that a flattened attribute is also considered derived

isFlattened(self)

Indicates whether the attribute is flattened

isNotClassProperty(self)

negation of isClassProperty

isRequired(self)

Returns whether the attribute is required (see also: allowsNone)

name(self)

Returns the attribute's name

parent(self)

Returns the associated 'Entity'

readFormat(self)

Simply returns the attribute's columnName()

relationshipPath(self)

Returns the relationshipPath (string) for a flattened attribute, or None if the attribute is not flattened

The relationshipPath consists of the definition() from which the last part (which designates the finalAttribute()) is stripped off. For example, the relationshipPath for an attribute whose definition is 'relationship1.relationship2.attribute' is 'relationship1.relationship2'.

See also: isFlattened(), definition(), finalAttribute(),
relationshipPathObjects()

relationshipPathObjects(self)

Returns the list ('tuple')of Relationship objects that should be traversed to obtain the finalAttribute(), or None if the attribute is not flattened

See also: isFlattened(), definition(), finalAttribute(),
relationshipPath()

setAllowsNone(self, allowsNone)

Tells the attribute whether it may have 'None' value or not (see inverse method setIsRequired)

setColumnName(self, columnName)

...

setComment(self, aComment)

Sets the comment field

setDefaultValue(self, aValue)

Sets the default value associated to this attribute

setDefinition(self, definition)

Sets the definition for a flattened or derived attribute

setDisplayLabel(self, aName)

Sets the label associated to the attribute

setIsClassProperty(self, aBool)

Tells the receiver whether it belongs to the class properties/fields

setIsFlattened(self, aBool)

Tells the attribute that it is flattened See also: setDefinition()

setIsRequired(self, isRequired)

Tells the attribute whether is required or not (inverse of setAllowNone)

setName(self, aName)

Sets the attribute's name. Raises if invalid

setType(self, aType, check=1)

Sets the type associated to the attribute. aType object should be an available type's name (see Modeling.Attribute.availableTypes() for a complete list Specify 'check=0' if you do not want the 'defaultValue' to be verified against the new type.

setWidth(self, width)

Sets the maximum size for that attribute

type(self)

Returns the type associated to the attribute.

validateAttribute(self)

Validates the attributes against general model consistency: - attribute cannot be both public and catalogable - defaultValue should have the correct type - no columnName() for flattened attributes - etc. TBD

validateValue(self, value, object=None)

Checks whether the supplied object is valid, i.e. the following tests are made:

  1. value cannot be void ('not value' equals to 1) if attribute is required
  2. value has the same type than the attribute's one
  3. if self.type() is 'string' and self.width() is set and non-zero, the length of 'value' should not exceeded self.width()
  4. (Not implemented yet) if attribute is constrained, the value is part of the constrained set (repeat: not implemented yet)

Parameter 'value' is required, and 'object' is optional --it is only used to make the error message clearer in case of failure.

Silently returns if it succeeds.

In case of failure, it raises 'Modeling.Validation.ValidationException' ; in this case, exception's value ('sys.exc_info[1]') consists in a set of lines, describing line per line the different tests which failed.

width(self)

Returns the maximum width for this attribute. Should be '0' (zero) for date and numbers

xmlAttributesDict(self, select=0)

Overrides:
Modeling.XMLutils.XMLCapability.xmlAttributesDict

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