|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
A persistent object. Your application classes should *not* normally directly implement this interface, but should instead request instances from the current PersistentFactory. Only implementation classes for the persistence service implement this interface directly. If you prefer to do "bean-like" objects as your persistent classes, see AbstractPersistent instead.
| Field Summary | |
static int |
ADDOperation codes |
static int |
CURRENTStatus codes |
static int |
DELETE |
static int |
DELETED |
static int |
MODIFIED |
static int |
NEW |
static int |
QUERY |
static int |
UPDATE |
| Method Summary | |
void |
add()Determine if a record with this key exists already - if not, add a new record. |
boolean |
allowed(int operation)Determine if the given operation is allowed for the current user, given one of the operation codes ADD, UPDATE, DELETE or QUERY |
void |
clear()Set all fields to empty value & clear the last result set |
int |
count()Just like find, but only retrieves the count, not the records themselves. |
void |
delete()Delete a record from the target table. |
void |
delete(boolean deleteDetails)Delete this record, optionally deleting any associated detail records. |
void |
deleteAll()Delete all of the records specified by the current search criteria. |
boolean |
find()A lot like retrieve, but works with any fields, not just the key field. |
java.lang.Object |
getAttribute(java.lang.String attribName)Get a general-purpose attribute where the scope is the whole persistent |
java.lang.Object |
getAttribute(java.lang.String fieldName, java.lang.String attribName)Get a general-purpose attribute for a specific field. |
java.util.Map |
getAttributes() |
java.lang.Object |
getBean()Convenience method that returns a JavaBean containing the data from the current persistent. |
java.util.List |
getDetails(java.lang.String detailName)The PersistentMetaData object associated with this Persistent can supply a list of the "detail" names associated with this Persistent. |
java.util.Map |
getErrors()Any database operation might in fact result in more than one error - validations, for example, or referential integrity problems. |
java.lang.Object |
getField(java.lang.String fieldName)Get the value of a field in this object |
boolean |
getFieldBoolean(java.lang.String fieldName)Boolean typesafe getField |
java.sql.Date |
getFieldDate(java.lang.String fieldName)Return the value of a field as a Date object |
int |
getFieldInt(java.lang.String fieldName)Get the integer value of a field in this object |
java.lang.String |
getFieldString(java.lang.String fieldName)Return the value of a field as a Strintg object |
Helper |
getHelper() |
PersistentMetaData |
getMetaData()Return the PersistentMetaData object which describes this Persistent. |
java.lang.String |
getName()Each persistent object has a name, assigned in the configuration file. |
int |
getStatus()Return one of the valid status codes indicating the current state of the Persistent object. |
java.util.Map |
getValidValues(java.lang.String fieldName)Return a Map of valid values and an associated description of each value for this field. |
void |
lock()Get exclusive read-write access to the underlying store for a persistent table |
double |
max(java.lang.String fieldName)Return the maximum value of the specified field |
double |
min(java.lang.String fieldName)Return the minimum value of the specified field |
java.util.List |
query()Find a set of records of all of the objects that match the current search critieria in the fields and retrieve the list of all records that match this criteria NOTE: Criteria in 'text' type colums is ignored (SQL Server limitation) |
java.util.List |
query(java.lang.String sortKeyString)Search and retrieve in a particular order |
void |
retrieve()Get a single record from the database into this Persistent's fields Assumes that the key fields are set to the key of the object to be retrieved |
void |
setAttribute(java.lang.String attribName, java.lang.Object attribValue)Set a general-purpose short-lived attribute for this persistent. |
void |
setBean(java.lang.Object newBean)Set the persistent fields from the fields of a bean. |
void |
setBypassAuthorizationManager(AuthorizationManager bypassAm) |
void |
setField(java.lang.String fieldName, java.lang.Object fieldValue)Set the given field to the specified value. |
void |
setMaxRecords(int newMax)Specify the maximum number of records retrieved by the next query |
void |
setMetaData(PersistentMetaData newMeta)A Persistent is always configured from it's factory, never from the application directly |
void |
setOffsetRecord(int newOffset)Specifies the number of records that should be skipped over before any data from the ResultSet is retrieved in any subsequent query() call. |
void |
setTransaction(Transaction t) |
double |
sum(java.lang.String fieldName)Find the sum of the values in the specified field of records selected by the Persistent selection criteria. |
void |
unlock()Release the exclusive read-write access to the underlying store for the persistence table |
void |
update()Update the database with the new info. |
java.util.Map |
validateAll()Apply all field validations to all fields, returning a map where the key is the field name and the value is the error message for that field. |
java.lang.String |
validateField(java.lang.String fieldName, java.lang.Object fieldValue)Apply field validations to a single field, returning a validation message if there is a problem, or null if there's no problem |
| Field Detail |
public static final int CURRENT
public static final int MODIFIED
public static final int DELETED
public static final int NEW
public static final int ADD
public static final int UPDATE
public static final int DELETE
public static final int QUERY
| Method Detail |
public int getStatus()
public boolean allowed(int operation)
throws PersistenceException
PersistenceException
public void add()
throws PersistenceException
PersistenceException
public void clear()
throws PersistenceException
PersistenceException - If the fields cannot be cleared
public void delete()
throws PersistenceException
PersistenceException - If the delete fails or if the referential integrity would be violated by the delete
public void delete(boolean deleteDetails)
throws PersistenceException
deleteDetails - Delete associated detail records if truePersistenceException - If the delete fails or if the referential integrity would be violated by the delete
public void deleteAll()
throws PersistenceException
PersistenceException - If the delete fails or if the referential integrity would be violated by the delete
public boolean find()
throws PersistenceException
PersistenceException - If the search could not be completed
public void retrieve()
throws PersistenceException
PersistenceException - If the record could not be retrieved, or if the key fields were not set. If you are not sure if the record exists, use find() instead.find()
public java.util.List query()
throws PersistenceException
PersistenceException - If the search could not be completed
public java.util.List query(java.lang.String sortKeyString)
throws PersistenceException
sortKeyString - A comma-delimited list of key fields to sort the returned set byPersistenceException - If the search could not be completed
public void setField(java.lang.String fieldName,
java.lang.Object fieldValue)
throws PersistenceException
PersistenceException
public java.lang.Object getField(java.lang.String fieldName)
throws PersistenceException
PersistenceException - If there is no such field or it's value cannot be accessed
public int getFieldInt(java.lang.String fieldName)
throws PersistenceException
fieldName - Name of a field in this objectPersistenceException - if there is no such field or it's value cannot be converted to an integer.
public java.sql.Date getFieldDate(java.lang.String fieldName)
throws PersistenceException
fieldName - The field to be retrievedPersistenceException - If the field does not exist or it's value is not a date or cannot be converted to a date
public boolean getFieldBoolean(java.lang.String fieldName)
throws PersistenceException
fieldName - The field to be retrievedPersistenceException - If the field does not exist or it's value is not a date or cannot be converted to a date
public java.lang.String getFieldString(java.lang.String fieldName)
throws PersistenceException
fieldName - The field to be retrievedPersistenceException - If the field does not exist or it's value is not a date or cannot be converted to a date
public void update()
throws PersistenceException
PersistenceException - if the update to the database fails due to a database error
public void setTransaction(Transaction t)
throws PersistenceException
PersistenceException
public Helper getHelper()
throws PersistenceException
PersistenceException
public java.lang.String validateField(java.lang.String fieldName,
java.lang.Object fieldValue)
public java.util.Map validateAll()
public void setMetaData(PersistentMetaData newMeta)
throws PersistenceException
PersistenceException
public PersistentMetaData getMetaData()
throws PersistenceException
PersistenceExceptionpublic java.lang.String getName()
public java.util.Map getErrors()
public java.util.Map getValidValues(java.lang.String fieldName)
throws PersistenceException
PersistenceException - If there is no such field
public int count()
throws PersistenceException
PersistenceException - If the search could not be completedfind()
public void setAttribute(java.lang.String attribName,
java.lang.Object attribValue)
public java.lang.Object getAttribute(java.lang.String attribName)
public java.util.Map getAttributes()
public java.lang.Object getAttribute(java.lang.String fieldName,
java.lang.String attribName)
throws PersistenceException
PersistenceException - If there is no such fieldpublic void setMaxRecords(int newMax)
public void setOffsetRecord(int newOffset)
ResultSet is retrieved in any subsequent query() call. Records will be skipped over (in the specified sort order) until the record counts is equal to or greater than the offset record. Specifying zero indicates that no records should be skipped over and the ResultSet immediately from the start.
PersistenceException - If the max number is less than 0
public void lock()
throws PersistenceException
PersistenceException
public void unlock()
throws PersistenceException
PersistenceException
public double max(java.lang.String fieldName)
throws PersistenceException
PersistenceException
public double min(java.lang.String fieldName)
throws PersistenceException
PersistenceException
public double sum(java.lang.String fieldName)
throws PersistenceException
PersistenceException - If the search could not be completed
public java.util.List getDetails(java.lang.String detailName)
throws PersistenceException
detailName - The name of the detail relationship, as provided by the meta-dataPersistenceException - If a problem occurs retrieving the details or if there is no such relationship
public java.lang.Object getBean()
throws PersistenceException
PersistenceException - If there is a problem instantiating or populating the bean.
public void setBean(java.lang.Object newBean)
throws PersistenceException
newBean - A JavaBean with the data to populate the current persistent from.PersistenceException
public void setBypassAuthorizationManager(AuthorizationManager bypassAm)
throws PersistenceException
PersistenceException
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||