getAttributeAspect(...)
Return the value for an attribute aspect.
An attribute aspect is one of an attribute's many attributes
described in the list below. All aspects are optional.
-
required: True if the attribute is
required to have a value, False otherwise, the
default. This aspects takes a boolean value.
-
persisted: True, the default, if the
attribute's value is persisted when the owning item is saved;
False otherwise. This aspect takes a boolean
value.
-
cardinality: single, the default if
the attribute is to have one single value, list or
dict, if the attribute is to have a list or dictionary
of values. This aspect takes a string value.
-
type: a reference to the type item describing the
type(s) of value(s) this attribute can store. By default, if this
aspect is not set, an attribute can store value(s) of any type.
This aspect takes an item of kind Type as value.
-
defaultValue: the value to return when there is no
value set for this attribute. This default value is owned by the
schema attribute item and is read-only when it is a collection or a
Lob. Other mutable types, such as Structs, should be used with care
as mutating a defaultValue causes it to appear changed by all items
returning it. By default, an attribute has no default value. See
initialValue, inheritFrom and
redirectTo below. This aspect takes any type of
value.
-
initialValue: similar to defaultValue
but the initial value is set as the value of the attribute the
first time it is returned. A copy of the initial value is set when
it is a collection. This aspect takes any type of value.
-
inheritFrom: one or several attribute names chained
together by periods naming attributes to recursively inherit a
value from. When several names are used, all but the last name are
expected to name attributes containing a reference to the next item
to inherit from by applying the next name. This aspect takes a
string value.
-
redirectTo: one or several attribute names chained
together by periods naming attributes to recursively obtain a value
or aspect value from or set a value to. When several names are
used, all but the last name are expected to name attributes
containing a reference to the next item to redirect to by applying
the next name. This aspect takes a string value.
-
otherName: for bi-directional reference attributes,
this aspect names the attribute used to attach the other endpoint
on the other item, ie the referenced item. This is the aspect that
determines whether the attribute stored bi-directional references
to items. This aspect takes a string value.
-
copyPolicy: when an item is copied this policy
defines what happens to items that are referenced by this
attribute. Possible copyPolicy values are:
-
remove, the default. The reference is not
copied.
-
copy, the reference is copied.
-
cascade, the referenced item is copied
recursively and a reference to this copy is set.
This aspect takes a string value.
-
deletePolicy: when an item is deleted this policy
defines what happens to items that are referenced by this
attribute. Possible deletePolicy values are:
-
remove, the default.
-
cascade, which causes the referenced item(s) to
get deleted as well. See countPolicy below.
This aspect takes a string value.
-
countPolicy: when an attribute's
deletePolicy is cascade this aspect can
be used to modify the delete behaviour to only delete the
referenced item if its reference count is 0. The reference count of
an item is defined by the total number of references it holds in
attributes where the countPolicy is set to
count. By default, an attribute's
countPolicy is none. This aspect takes a
string value.
If the attribute's redirectTo aspect is set, this
method is redirected just like getAttributeValue.
If the attribute is not defined for the item's kind, a subclass of
AttributeError is raised.
-
- Returns:
-
a value
|