pyroxide.model.domain (version 32 , 2007-01-21 02:13:52 -0800 (Sun, 21 Jan 2007) )
index
/usr/lib/python2.4/site-packages/pyroxide/model/domain.py

Domain module.
 
The domain superclass that is inherited by all domain class types.

 
Classes
       
__builtin__.object
DomainObject

 
class DomainObject(__builtin__.object)
    A Layer Supertype that factors out common behaviour of all objects.
 
This class provides the following READ-ONLY attributes:
 
keys       - the primary keys of the object in the database
version    - the concurrency version of the object to maintain off-line
             concurrency
className  - the type of the class as a string
createDate - the date and time at which this object was created in the
             database
modDate    - the date and time at which this object was last modified in the
             database
 
The class also provides the following READ attributes, however, there are
corresponing get*, init*, and update* methods that will affect change:
 
changedBy - the user that last changed this object
changedIn - the module in which this object was last changed
 
The init* method should be used to initialize attributes in a "new" object,
whereas, the update* method should be used to update attributes for objects
that have already been persisted to the datastore.  If the user uses the
init* method on an existing object's attributes, the values will not be
updated in the datastore.
 
Please note that the only attributes that are guaranteed to exist at the 
database level are the keys and the version.  The rest of the attributes
are optional and will only be persisted to the database if they exist in
the database and mapped in the mapping layer.
 
The version, createDate and modDate attributes are automatically updated
by the mapping layer.
 
  Methods defined here:
__init__(self, keys=None, version=0, new=False)
Initialize a domain object.
 
The keys parameter is a list of primary keys for the object.
The version parameter is the current version for concurrency tracking.
 
When subclassing the DomainObject, ensure to call the DomainObject's
__init__ method in the subclass's __init__ method, otherwise, you will
break the model design and be on your own.  The following would be the
preferred style of the subclass's __init__ method (Note that in this
example we auto-generate the keys):
 
def __init__(self, keys=None, version=0, new=False):
    
    if keys is None and new:
        # generate a new set of keys
        ...
        markNew()
    DomainObject.__init__(self, keys, version, new)
 
 
The only time that the client programmer should initialize a new object
is when, in fact, they actually want to create a brand new object.  The
mapping layer handles creating existing objects from the database.
If the client programmer instantiates an object with the keys set and it
is not 'new' then they must guarantee that the keys exist in the data
store otherwise any changes to the object will not persist.
getChangedBy(self)
getChangedIn(self)
getClassName(self)
Return class type of object as a string.
getCreateDate(self)
getKeys(self)
Return the id of the object.
getModDate(self)
getNew(self)
getVersion(self)
Return the concurrency version of the object.
initChangedBy(self, changedBy)
initChangedIn(self, changedIn, uow=False)
initCreateDate(self, createDate, uow=False)
Any changes effected by this method will not persist.
initModDate(self, modDate, uow=False)
Any changes effected by this method will not persist.
markClean(self)
Registers this object as clean in the current Unit of Work.
markDirty(self)
Registers this object as dirty in the current Unit of Work.
markNew(self)
Registers this object as new in the current Unit of Work.
markRemoved(self)
Registers this object as removed in the current Unit of Work.
updateChangedBy(self, changedBy)
updateChangedIn(self, changedIn)

Properties defined here:
changedBy
Which user changed this object
get = getChangedBy(self)
changedIn
In which module was this object changed
get = getChangedIn(self)
className
The name of the domain class
get = getClassName(self)
Return class type of object as a string.
createDate
The date of the creation of this object
get = getCreateDate(self)
keys
The primary keys
get = getKeys(self)
Return the id of the object.
modDate
The date of the modification of this object
get = getModDate(self)
new
Is this object new?
get = getNew(self)
version
Concurrency version of object
get = getVersion(self)
Return the concurrency version of the object.

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'DomainObject' objects>
list of weak references to the object (if defined)

 
Data
        __HeadURL__ = '$URL: http://pyroxide.org/svn/pyroxide/trunk/src/main/python/pyroxide/model/domain.py $'
__LastChangedBy__ = '$Author: kevin $'
__LastChangedDate__ = '$Date: 2007-01-21 02:13:52 -0800 (Sun, 21 Jan 2007) $'
__Revision__ = '$Rev: 32 $'
__author__ = 'Kevin J. Smith (kevin@rootsmith.ca)'
__copyright__ = '(c) 2006 rootsmith Inc.'
__credits__ = ''
__date__ = ' 2007-01-21 02:13:52 -0800 (Sun, 21 Jan 2007) '
__version__ = ' 32 '

 
Author
        Kevin J. Smith (kevin@rootsmith.ca)

 
Credits