Business Components

oracle.jbo.server
Interface Entity

All Known Implementing Classes:
EntityImpl

public interface Entity
extends Row, ValidationListener, ValidationManager, oracle.jbo.server.TransactionManager, TransactionListener, TransactionPostListener

Defines the middle-tier representation of database rows.

An Entity Object provides an object-oriented representation of the data it caches from a database object, such as a table or view. Database rows are presented as individual Entity Objects, in which attributes typically correspond to columns in the corresponding table.

The status of an Entity Object, relative to the corresponding database data, is indicated by its current post-state and entity-state.

States are set to one of STATUS_NEW, STATUS_MODIFIED, STATUS_DELETED and STATUS_DEAD by create, update, delete, and rollback operations, respectively. These operations can set both the post-state and the entity-state.

Post-states indicate the state of the Entity Object's data relative to the transaction's corresponding database data. The post-state is reset to STATUS_UNMODIFIED when a post operation is invoked.

Entity-states indicate the state of the Entity Object's data relative to the actual database data, and the state of the transaction itself. The entity-state is reset to STATUS_UNMODIFIED by a commit or a rollback operation.

Since:
JDeveloper 3.0

Field Summary
static byte STATUS_DEAD
          Indicates that the Entity Object is a new row that has been discarded.
static byte STATUS_DELETED
          Indicates that the Entity Object's row has been deleted.
static byte STATUS_MODIFIED
          Indicates that the Entity Object's row is changed.
static byte STATUS_NEW
          Indicates that the Entity Object's row is newly created.
static byte STATUS_UNMODIFIED
          Indicates that the Entity Object's row is unchanged or has been updated.
 
Method Summary
 byte getEntityState()
          Gets this Entity Object's current entity-state.
 byte getPostState()
          Gets this Entity Object's current post-state.
 Key getPrimaryKey()
          Gets the primay key for this Entity Object's row.
 boolean isLocked()
          Gets the status of the Entity Object's lock.
 boolean isValid()
          Gets the state of this Entity Object's validity flag.
 void revert()
          Reverts this Entity Object's row to the database's values.
 
Methods inherited from interface oracle.jbo.Row
getKey, isAttributeUpdateable, lock, remove, validate
 
Methods inherited from interface oracle.jbo.server.ValidationManager
addToValidationListeners
 
Methods inherited from interface oracle.jbo.server.TransactionManager
addTransactionPostListener, addTransactionPostListenerNoCheck, removeTransactionPostListener
 
Methods inherited from interface oracle.jbo.server.TransactionListener
afterCommit, afterRemove, afterRollback, beforeCommit, beforeRollback, isTransientTransactionListener
 
Methods inherited from interface oracle.jbo.server.TransactionPostListener
getTransPostHandle, isTransientTransactionPostListener, postChanges, setTransPostHandle
 
Methods inherited from interface oracle.jbo.AttributeList
getAttribute, getAttribute, getAttributeCount, getAttributeIndexOf, setAttribute, setAttribute
 

Field Detail

STATUS_NEW

public static final byte STATUS_NEW
Indicates that the Entity Object's row is newly created.

STATUS_UNMODIFIED

public static final byte STATUS_UNMODIFIED
Indicates that the Entity Object's row is unchanged or has been updated.

STATUS_MODIFIED

public static final byte STATUS_MODIFIED
Indicates that the Entity Object's row is changed.

STATUS_DELETED

public static final byte STATUS_DELETED
Indicates that the Entity Object's row has been deleted.

STATUS_DEAD

public static final byte STATUS_DEAD
Indicates that the Entity Object is a new row that has been discarded.
Method Detail

isValid

public boolean isValid()
Gets the state of this Entity Object's validity flag.

This predecate does not perform a validity test.

Specified by:
isValid in interface ValidationListener
Returns:
true if this Entity Object has been validated.

getPrimaryKey

public Key getPrimaryKey()
Gets the primay key for this Entity Object's row.
Returns:
a primary key.

isLocked

public boolean isLocked()
Gets the status of the Entity Object's lock.

An Entity Object is locked if its corresponding database row is locked.

Returns:
true if this Entity Object is locked.

getEntityState

public byte getEntityState()
Gets this Entity Object's current entity-state.
Returns:

STATUS_UNMODIFIED if this Entity Object originated in the database and is unmodified, or if modifications have been committed to the database.

STATUS_MODIFIED if this Entity Object originated in the database, and has been modified in the current transaction.

STATUS_NEW if this Entity Object is new in the current transaction.

STATUS_DELETED if this Entity Object has been deleted in the current transaction.

STATUS_DEAD if this Entity Object is new in the current transaction and has been deleted.


getPostState

public byte getPostState()
Gets this Entity Object's current post-state.
Returns:

STATUS_UNMODIFIED if this Entity Object has been queried from the database and is unchanged, or if it has been posted to the database.

STATUS_MODIFIED if this Entity Object has been queried from the database and has changed.

STATUS_NEW if this Entity Object is new and not yet posted to the database.

STATUS_DELETED if this Entity Object has been marked for deletion.

STATUS_DEAD if this Entity Object is new, but has been deleted.


revert

public void revert()
Reverts this Entity Object's row to the database's values.

Attribute values are reverted to their database values, or if the row did not originate in the database, reset to default values.


Business Components