org.jaffa.persistence
Interface IPersistent

All Superinterfaces:
Cloneable, Serializable
All Known Subinterfaces:
IStoredProcedure
All Known Implementing Classes:
Persistent

public interface IPersistent
extends Cloneable, Serializable

Interface for all persistent objects.


Method Summary
 int getLocking()
          Returns the locking strategy for this persistent object.
 UOW getUOW()
          Returns the UOW to which this object is associated.
 boolean isDatabaseOccurence()
          Returns a true value if the object was loaded from the database.
 boolean isLocked()
          Returns a true value if the underlying database row is locked.
 boolean isModified()
          Returns a true value if the object had any of its fields updated.
 boolean isModified(String fieldName)
          Returns a true value if the field has been updated.
 boolean isQueued()
          Returns a true value if this object has been added/updated/deleted and not yet been committed.
 void postAdd()
          This method is triggered by the UOW, after adding this object to the Add-Store.
 void postDelete()
          This method is triggered by the UOW, after adding this object to the Delete-Store.
 void postLoad()
          This method is triggered by the UOW after a query loads this object.
 void postUpdate()
          This method is triggered by the UOW, after adding this object to the Update-Store.
 void preAdd()
          This method is triggered by the UOW, before adding this object to the Add-Store, but after a UOW has been associated to the object.
 void preDelete()
          This method is triggered by the UOW, before adding this object to the Delete-Store.
 void preUpdate()
          This method is triggered by the UOW, before adding this object to the Update-Store.
 Object returnInitialValue(String fieldName)
          Returns the initial value for a field; i.e. before it was modified.
 void setDatabaseOccurence(boolean databaseOccurence)
          Set the database status of this object.
 void setLocked(boolean locked)
          Set the locked status of this object.
 void setLocking(int locking)
          Set the locking strategy for this persistent object.
 void setModified(boolean modified)
          Set the modified status of this object.
 void setQueued(boolean queued)
          Set the queued status of this object.
 void setUOW(UOW uow)
          Associates this object to a UOW.
 

Method Detail

getUOW

public UOW getUOW()
Returns the UOW to which this object is associated.

Returns:
The UOW

setUOW

public void setUOW(UOW uow)
Associates this object to a UOW. Note: This method is for internal use by the Persistence Engine only.

Parameters:
uow - The UOW.

isModified

public boolean isModified()
Returns a true value if the object had any of its fields updated.

Returns:
a true value if the object had any of its fields updated.

setModified

public void setModified(boolean modified)
Set the modified status of this object. Note: This method is for internal use by the Persistence Engine only.

Parameters:
modified - the modified status.

isDatabaseOccurence

public boolean isDatabaseOccurence()
Returns a true value if the object was loaded from the database.

Returns:
a true value if the object was loaded from the database.

setDatabaseOccurence

public void setDatabaseOccurence(boolean databaseOccurence)
Set the database status of this object. Note: This method is for internal use by the Persistence Engine only.

Parameters:
databaseOccurence - the database status.

getLocking

public int getLocking()
Returns the locking strategy for this persistent object.

Returns:
the locking strategy for this persistent object.

setLocking

public void setLocking(int locking)
Set the locking strategy for this persistent object. Note: This method is for internal use by the Persistence Engine only.

Parameters:
locking - the locking strategy.

isLocked

public boolean isLocked()
Returns a true value if the underlying database row is locked.

Returns:
a true value if the underlying database row is locked.

setLocked

public void setLocked(boolean locked)
Set the locked status of this object. Note: This method is for internal use by the Persistence Engine only.

Parameters:
locked - the locked status.

isQueued

public boolean isQueued()
Returns a true value if this object has been added/updated/deleted and not yet been committed.

Returns:
a true value if this object has been added/updated/deleted and not yet been committed.

setQueued

public void setQueued(boolean queued)
Set the queued status of this object. The Persistence Engine will set the queued status to true on an Add/Update/Delete. Thereafter, any updates on this object will throw a RuntimeException. This flag will be reset after the object actaully gets added/updated/deleted to the database. Note: This method is for internal use by the Persistence Engine only.

Parameters:
queued - the queued status.

isModified

public boolean isModified(String fieldName)
Returns a true value if the field has been updated.

Parameters:
fieldName - the field to check.
Returns:
a true value if the field has been updated.

returnInitialValue

public Object returnInitialValue(String fieldName)
Returns the initial value for a field; i.e. before it was modified. A null will be returned if the field was never modified. Use the isModified() method to determine if the field was modified. A null can also be returned if the field had a null value to begin with.

Parameters:
fieldName - the field.
Returns:
the initial value for a field; i.e. before it was modified.

preAdd

public void preAdd()
            throws PreAddFailedException
This method is triggered by the UOW, before adding this object to the Add-Store, but after a UOW has been associated to the object. A concrete persistent object should provide the implementation, if its necessary.

Throws:
PreAddFailedException - if any error occurs during the process.

postAdd

public void postAdd()
             throws PostAddFailedException
This method is triggered by the UOW, after adding this object to the Add-Store. A concrete persistent object should provide the implementation, if its necessary.

Throws:
PostAddFailedException - if any error occurs during the process.

preUpdate

public void preUpdate()
               throws PreUpdateFailedException
This method is triggered by the UOW, before adding this object to the Update-Store. A concrete persistent object should provide the implementation, if its necessary.

Throws:
PreUpdateFailedException - if any error occurs during the process.

postUpdate

public void postUpdate()
                throws PostUpdateFailedException
This method is triggered by the UOW, after adding this object to the Update-Store. A concrete persistent object should provide the implementation, if its necessary.

Throws:
PostUpdateFailedException - if any error occurs during the process.

preDelete

public void preDelete()
               throws PreDeleteFailedException
This method is triggered by the UOW, before adding this object to the Delete-Store. A concrete persistent object should provide the implementation, if its necessary.

Throws:
PreDeleteFailedException - if any error occurs during the process.

postDelete

public void postDelete()
                throws PostDeleteFailedException
This method is triggered by the UOW, after adding this object to the Delete-Store. A concrete persistent object should provide the implementation, if its necessary.

Throws:
PostDeleteFailedException - if any error occurs during the process.

postLoad

public void postLoad()
              throws PostLoadFailedException
This method is triggered by the UOW after a query loads this object. A concrete persistent object should provide the implementation, if its necessary.

Throws:
PostLoadFailedException - if any error occurs during the process.


Copyright © 2002-2004 JAFFA Project.