com.arsdigita.persistence
Interface DataObject


public interface DataObject

Defines the public methods of Data Objects.

Version:
$Revision: #12 $ $Date: 2004/04/07 $
Author:
rhs@mit.edu

Field Summary
static String versionId
           
 
Method Summary
 void addObserver(DataObserver observer)
          Adds an observer.
 void delete()
          Deletes this persistent object.
 void disconnect()
          Disconnects this DataObject from the current transaction.
 Object get(String propertyName)
          Returns the value of the specified property.
 ObjectType getObjectType()
          Returns the type of this persistent object.
 OID getOID()
          Returns the unique id of this persistent object.
 Session getSession()
          Returns the Session object from which this object was created or retrieved.
 boolean isCommitted()
          Returns true if the object exists in a committed state in the database.
 boolean isDeleted()
          Returns true if this persistent object has been deleted from the database.
 boolean isDisconnected()
          Returns true if this persistent 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()
          Returns true if this persistent object is newly created.
 boolean isPropertyModified(String name)
          Returns true of the property specified by name has been modified since this object was retrieved.
 boolean isValid()
          Returns true if this persistent object is in a valid state.
 void save()
          Persists any changes made to this persistent object.
 void set(String propertyName, Object value)
          Sets the specified property to value.
 void specialize(ObjectType subtype)
          Specializes this persistent object by turning it into a subtype of this object's current type.
 void specialize(String subtypeName)
          Specializes this persistent object by turning it into a subtype of this object's current type.
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Method Detail

getObjectType

public ObjectType getObjectType()
Returns the type of this persistent object.

Returns:
The type of this persistent object.

getOID

public OID getOID()
Returns the unique id of this persistent object.

Returns:
The id of this object.

get

public Object get(String propertyName)
Returns the value of the specified property.

Parameters:
propertyName - The property name.
Returns:
The property value.

set

public void set(String propertyName,
                Object value)
Sets the specified property to value.

Parameters:
propertyName - The property name.
value - The desired value.

getSession

public Session getSession()
Returns the Session object from which this object was created or retrieved.

Returns:
This object's Session.

isNew

public boolean isNew()
Returns true if this persistent object is newly created.

Returns:
True if the object is newly created.

isDeleted

public boolean isDeleted()
Returns true if this persistent object has been deleted from the database. This does a database hit to check.

Returns:
True if the object has been deleted

isCommitted

public boolean isCommitted()
Returns true if the object exists in a committed state in the database. This does not mean that all changes to this object have been either written to disk or committed.

Returns:
True if the object exists in a committed state in the database.

isDisconnected

public boolean isDisconnected()
Returns true if this persistent object has been disconnected from the transaction context. If true, the object can still be read, but any attempt to update any of the object's attributes will cause an exception to be thrown.

Returns:
True if the object has been disconnected

disconnect

public void disconnect()
Disconnects this DataObject from the current transaction. This allows the data object to be used in multiple transactions.

See Also:
isDisconnected()

isModified

public boolean isModified()
Returns true if this persistent object has been modified since it was retrieved.

Returns:
True if the object has been modified, false otherwise.

isPropertyModified

public boolean isPropertyModified(String name)
Returns true of the property specified by name has been modified since this object was retrieved.

Returns:
True if the property has been modified, false otherwise.

isValid

public boolean isValid()
Returns true if this persistent object is in a valid state. An invalid DataObject usually results from using a data object that was retrieved during a transaction that has been rolled back.

Returns:
True if the object has been modified, false otherwise.

delete

public void delete()
Deletes this persistent object.


specialize

public void specialize(ObjectType subtype)
Specializes this persistent object by turning it into a subtype of this object's current type.

Parameters:
subtype - The subtype to which to specialize.

specialize

public void specialize(String subtypeName)
Specializes this persistent object by turning it into a subtype of this object's current type. In addition to the local precondition, also has pre and post conditions of specialize(ObjectType).

Parameters:
subtypeName - The name of the subtype to which to specialize.

save

public void save()
Persists any changes made to this persistent object.


addObserver

public void addObserver(DataObserver observer)
Adds an observer.

Parameters:
observer - The observer to add to this DataObject.


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC