| java.lang.Object org.jaffa.persistence.Persistent
All known Subclasses: org.jaffa.persistence.domainobjects.Item, org.jaffa.persistence.domainobjects.Condition, org.jaffa.persistence.domainobjects.CategoryOfInstrument, org.jaffa.applications.test.modules.material.domain.Item, org.jaffa.persistence.domainobjects.PartRemarksPicture, org.jaffa.persistence.engines.jdbcengine.proxy.PersistentDelegate, org.jaffa.rules.examples.domain.ValidFieldValue, org.jaffa.persistence.domainobjects.VoucherStoredProcedure, org.jaffa.persistence.domainobjects.Asset, org.jaffa.persistence.domainobjects.Part, org.jaffa.persistence.domainobjects.PartRemarks, org.jaffa.persistence.domainobjects.PartPicture,
Persistent | abstract public class Persistent implements IPersistent(Code) | | Base class for all persistent objects.
|
Method Summary | |
protected IPersistent | actualInstance() This method simply returns the 'this' object. | protected void | addInitialValue(String fieldName, Object initialValue) Adds an initial value for a field whenever it is modified. | public Object | clone() Returns a clone of the object.
throws: CloneNotSupportedException - if cloning is not supported. | public int | getLocking() Returns the locking strategy for this persistent object. | public UOW | getUOW() Returns the UOW to which this object is associated. | public boolean | isDatabaseOccurence() Returns a true value if the object was loaded from the database. | public boolean | isLocked() Returns a true value if the underlying database row is locked. | public boolean | isModified() Returns a true value if the object had any of its fields updated. | public boolean | isModified(String fieldName) Returns a true value if the field has been updated.
Parameters: fieldName - the field to check. | public boolean | isQueued() Returns a true value if this object has been added/updated/deleted and not yet been committed. | public void | performForeignKeyValidations() This method ensures that the modified foreign-keys are valid. | public void | performPreDeleteReferentialIntegrity() This method will perform referential integrity checks before this object is deleted. | public void | postAdd() This method is triggered by the UOW, after adding this object to the Add-Store. | public void | postDelete() This method is triggered by the UOW, after adding this object to the Delete-Store. | public void | postLoad() This method is triggered by the UOW after a query loads this object. | public void | postUpdate() This method is triggered by the UOW, after adding this object to the Update-Store. | public 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. | public void | preDelete() This method is triggered by the UOW, before adding this object to the Delete-Store. | public void | preUpdate() This method is triggered by the UOW, before adding this object to the Update-Store. | public Object | returnInitialValue(String fieldName) Returns the initial value for a field; i.e. | public void | setDatabaseOccurence(boolean databaseOccurence) Set the database status of this object. | public void | setLocked(boolean locked) Set the locked status of this object. | public void | setLocking(int locking) Set the locking strategy for this persistent object. | public void | setModified(boolean modified) Set the modified status of this object. | 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. | public void | setUOW(UOW uow) Associates this object to a UOW. | public String | toString() This returns the state of the object for diagnostic purposes. | protected void | update() This method should be invoked by every updateXxx() method of the persistent class, before setting the value.
It ensures that a readonly object cannot be updated. |
actualInstance | protected IPersistent actualInstance()(Code) | | This method simply returns the 'this' object.
A proxy implementation will override this method and return the proxy instance.
the persistent instance. |
addInitialValue | protected void addInitialValue(String fieldName, Object initialValue)(Code) | | Adds an initial value for a field whenever it is modified.
This method is typically invoked by the updateXyz() method of the extending class.
Note: The value will not be added, if the field has already been modified.
Parameters: fieldName - the field. Parameters: initialValue - the initial value. |
getLocking | public int getLocking()(Code) | | Returns the locking strategy for this persistent object.
the locking strategy for this persistent object. |
getUOW | public UOW getUOW()(Code) | | Returns the UOW to which this object is associated.
The UOW |
isDatabaseOccurence | public boolean isDatabaseOccurence()(Code) | | Returns a true value if the object was loaded from the database.
a true value if the object was loaded from the database. |
isLocked | public boolean isLocked()(Code) | | Returns a true value if the underlying database row is locked.
a true value if the underlying database row is locked. |
isModified | public boolean isModified()(Code) | | Returns a true value if the object had any of its fields updated.
a true value if the object had any of its fields updated. |
isModified | public boolean isModified(String fieldName)(Code) | | Returns a true value if the field has been updated.
Parameters: fieldName - the field to check. a true value if the field has been updated. |
isQueued | public boolean isQueued()(Code) | | Returns a true value if this object has been added/updated/deleted and not yet been committed.
a true value if this object has been added/updated/deleted and not yet been committed. |
performPreDeleteReferentialIntegrity | public void performPreDeleteReferentialIntegrity() throws PreDeleteFailedException(Code) | | This method will perform referential integrity checks before this object is deleted.
This will cascade delete all composite objects.
This will raise an exception if any associated/aggregated objects exist.
A concrete persistent object should provide the implementation, if its necessary.
throws: PreDeleteFailedException - if any error occurs during the process. |
postAdd | public void postAdd() throws PostAddFailedException(Code) | | 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. |
postDelete | public void postDelete() throws PostDeleteFailedException(Code) | | 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(Code) | | 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. |
postUpdate | public void postUpdate() throws PostUpdateFailedException(Code) | | 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. |
preAdd | public void preAdd() throws PreAddFailedException(Code) | | 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.
This will perform the following tasks:
Will invoke the PersistentHelper.exists() to check against duplicate keys.
Will invoke the performForeignKeyValidations() method to ensure no invalid foreign-keys are set.
Will invoke PersistentHelper.checkMandatoryFields() to perform mandatory field checks.
Will invoke the Rules Engine to perform mandatory field checks.
throws: PreAddFailedException - if any error occurs during the process. |
preDelete | public void preDelete() throws PreDeleteFailedException(Code) | | This method is triggered by the UOW, before adding this object to the Delete-Store.
This will perform the following tasks:
Will invoke the performPreDeleteReferentialIntegrity() method.
throws: PreDeleteFailedException - if any error occurs during the process. |
preUpdate | public void preUpdate() throws PreUpdateFailedException(Code) | | This method is triggered by the UOW, before adding this object to the Update-Store.
This will perform the following tasks:
Will invoke the performForeignKeyValidations() method to ensure no invalid foreign-keys are set.
Will invoke PersistentHelper.checkMandatoryFields() to perform mandatory field checks.
Will invoke the Rules Engine to perform mandatory field checks.
throws: PreUpdateFailedException - if any error occurs during the process. |
returnInitialValue | public Object returnInitialValue(String fieldName)(Code) | | 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 will also be returned, if the field had a null value to begin with.
Parameters: fieldName - the field. the initial value for a field; i.e. before it was modified. |
setDatabaseOccurence | public void setDatabaseOccurence(boolean databaseOccurence)(Code) | | Set the database status of this object.
Note: This method is for internal use by the Persistence Engine only.
Parameters: databaseOccurence - the database status. |
setLocked | public void setLocked(boolean locked)(Code) | | Set the locked status of this object.
Note: This method is for internal use by the Persistence Engine only.
Parameters: locked - the locked status. |
setLocking | public void setLocking(int locking)(Code) | | 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. |
setModified | public void setModified(boolean modified)(Code) | | Set the modified status of this object.
Note: This method is for internal use by the Persistence Engine only.
Parameters: modified - the modified status. |
setQueued | public void setQueued(boolean queued)(Code) | | 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. |
setUOW | public void setUOW(UOW uow)(Code) | | Associates this object to a UOW.
Note: This method is for internal use by the Persistence Engine only.
Parameters: uow - The UOW. |
toString | public String toString()(Code) | | This returns the state of the object for diagnostic purposes.
a String representation of the object. |
|
|