|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.domain.DomainObject
This is the base class that all other persistent classes would extend. It provides methods that delegate to a contained DataObject.
DataObject
Field Summary | |
static String |
versionId
|
Constructor Summary | |
DomainObject(DataObject dataObject)
Constructor. |
|
DomainObject(ObjectType type)
Constructor. |
|
DomainObject(OID oid)
Constructor. |
|
DomainObject(String typeName)
Constructor. |
Method Summary | |
protected DataObject |
add(String propertyName,
DataObject dataObject)
Adds to associations with multiplicty > 1. |
protected DataObject |
add(String propertyName,
DomainObject dobj)
Adds to associations with multiplicty > 1. |
DataObject |
addToAssociation(DataAssociation da)
Add the DomainObject to a DataAssociation |
protected void |
afterDelete()
|
protected void |
afterSave()
|
protected void |
beforeDelete()
|
protected void |
beforeSave()
|
protected void |
clear(String propertyName)
Clears an association with multiplicity > 1. |
void |
delete()
Deletes this object. |
void |
disconnect()
Disconnects the encapsulated data object from the current transaction. |
boolean |
equals(Object object)
Is this domain object equal to another domain object? Default implementation only compares OID (provided it isn't empty). |
protected Object |
get(String attr)
Get a property of the DomainObjects DataObject. |
protected String |
getBaseDataObjectType()
Returns the base data object type for this domain object class. |
ObjectType |
getObjectType()
Returns the type of this persistent object. |
OID |
getOID()
Return the OID of this domain object. |
Session |
getSession()
|
int |
hashCode()
We override the standard hashCode method because we have overridden equals. |
protected void |
initialize()
Called from all of the DomainObject constructors
to initalize or validate the new domain object or its
encapsulated data object. |
boolean |
isDeleted()
Returns true if this persistent object has been deleted from the database. |
boolean |
isDisconnected()
Returns true if the encapsulated data object has been disconnected from the transaction context. |
boolean |
isModified()
Returns true if this persistent object has been modified since it was retrieved. |
boolean |
isNew()
Return true if this persistent object is newly created, false otherwise. |
boolean |
isPropertyModified(String name)
Returns true if the property specified by name has been modified since this persistent object was retrieved. |
boolean |
isValid()
Returns true if this persistent object is in a valid state. |
protected void |
remove(String propertyName,
DataObject dataObject)
Removes from associations with multiplicity > 1. |
protected void |
remove(String propertyName,
DomainObject dobj)
Removes from associations with multiplicity > 1. |
protected void |
remove(String propertyName,
OID oid)
Removes. |
void |
removeFromAssociation(DataAssociation da)
Remove the DomainObject from a DataAssociation |
void |
save()
Persists any changes made to this object. |
protected void |
set(String attr,
Object value)
Set a property of the DomainObjects DataObject. |
protected static void |
setAssociation(DataObject dobj,
String attr,
DomainObject target)
|
protected void |
setAssociation(String attr,
DomainObject dobj)
Set an association DomainObjects DataObject. |
protected void |
specializeDataObject(ObjectType subtype)
Specializes the encapsulated data object by turning it into a subtype of this object's current type. |
protected void |
specializeDataObject(String subtypeName)
Specializes the encapsulated data object by turning it into a subtype of this object's current type. |
String |
toString()
Return the OID plus the flags N,M,D,U depending on
whether the object is new, modified, deleted, or unknown. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String versionId
Constructor Detail |
public DomainObject(String typeName)
DataObject
is
initialized with a new DataObject
with an
ObjectType
specified by the string
typeName.
typeName
- The name of the ObjectType
of the
new instance.Session.create(String)
,
DataObject
,
ObjectType
public DomainObject(ObjectType type)
DataObject
is
initialized with a new DataObject
with an
ObjectType
specified by type.
type
- The ObjectType
of the new instance.Session.create(ObjectType)
,
DataObject
,
ObjectType
public DomainObject(OID oid) throws DataObjectNotFoundException
DataObject
is retrieved
from the persistent storage mechanism with an OID specified by
oid.
oid
- The OID
for the retrieved
DataObject
.
DataObjectNotFoundException
- Thrown if we cannot
retrieve a data object for the specified OIDSession.retrieve(OID)
,
DataObject
,
OID
public DomainObject(DataObject dataObject)
dataObject
- The data object to encapsulate in the new domain
object.Session.retrieve(String)
Method Detail |
protected String getBaseDataObjectType()
protected void initialize()
DomainObject
constructors
to initalize or validate the new domain object or its
encapsulated data object. This was introduced in order to
support efficient validation of the encapsualted data object's
type. If the validation is typically performed in class
constructors, then redundant validation is performed in
superclass constructors. This validation now occurs here.
public ObjectType getObjectType()
public boolean isNew()
DataObject.isNew()
public OID getOID()
DataObject.getOID()
public boolean isValid()
DataObject.isValid()
public boolean isModified()
DataObject.isModified()
public boolean isDeleted()
public boolean isPropertyModified(String name)
name
- Name of the property on which to check modification status.
DataObject.isPropertyModified(String)
public final void save() throws PersistenceException
PersistenceException
DataObject.save()
,
beforeSave()
,
afterSave()
public void delete() throws PersistenceException
PersistenceException
DataObject.delete()
protected void set(String attr, Object value)
DataObject.set(String, Object)
protected void setAssociation(String attr, DomainObject dobj)
Specificall, this method should only be used to set
associations whose multiplicity is 0..1 or 1..1.
If the upper bound of the multiplicity is greater than 1
then the add(String, DataObject)
method should be used.
DataObject.set(String, Object)
protected static void setAssociation(DataObject dobj, String attr, DomainObject target)
public void removeFromAssociation(DataAssociation da)
DataAssociation.remove(DataObject)
public DataObject addToAssociation(DataAssociation da)
DataAssociation.add(DataObject)
protected DataObject add(String propertyName, DataObject dataObject)
setAssociation(String, DomainObject)
should be used instead.
protected DataObject add(String propertyName, DomainObject dobj)
protected void remove(String propertyName, DataObject dataObject)
protected void remove(String propertyName, DomainObject dobj)
protected void remove(String propertyName, OID oid)
protected void clear(String propertyName)
protected Object get(String attr)
DataObject.get(String)
public Session getSession()
public boolean equals(Object object)
public int hashCode()
protected void specializeDataObject(ObjectType subtype)
subtype
- The subtype to which to specialize.DataObject.specialize(ObjectType)
protected void specializeDataObject(String subtypeName)
subtypeName
- The fully qualified name (e.g.
"com.arsdigita.kernel.User") of the subtype to which to specializeDataObject.specialize(String)
public String toString()
OID
plus the flags N,M,D,U depending on
whether the object is new, modified, deleted, or unknown. Unknown is for
objects that have been invalidated.
public void disconnect()
isDisconnected()
public boolean isDisconnected()
protected void beforeSave()
protected void afterSave()
protected void beforeDelete()
protected void afterDelete()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |