|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This interface represents the basic needs of a dataobject, namely to add, update and delete itself, set it's own fields, and deal with things accordingly
It is currently considered BETA code at this time. It's intention is to provide a refactoring launching point. Until then it is recommended that by and large you use the DBObject class directly unless there is a specific feature that the DataObject interface provides that you need. However, be forewarned that the interface will change. For example, Exceptions will eventually be refactored from DBExceptions to DataExceptions.
| Field Summary | |
static String |
STATUS_CURRENT
Status constant indicating that this dbobject currently reflects what's in the database back end. |
static String |
STATUS_DELETED
Status indicating that this DBObject has been deleted. |
static String |
STATUS_NEW
Constant describing that this dbobject is new. |
static String |
STATUS_UPDATED
Status constant indicating that this dbobject has been modified and does not match the back-end database. |
| Method Summary | |
void |
add()
Adds the record to the defined data source. |
void |
checkField(String fieldName,
String fieldValue)
Check that a given value is valid for a given field. |
void |
clear()
Clears all currently loaded fields |
int |
count()
Just like find, but only retrieves the count, not the records themselves. |
void |
delete()
Deletes this defined record. |
boolean |
equals(Object otherObject)
Checks to see if two data objects are equal. |
boolean |
find()
Finds a single record based upon the criteria specified by the DataTransferObject |
Object |
get(String fieldName)
Directly gets the DataField Data without having to deal with the DataField itself |
Map |
getAllAttributes()
Returns a Read Only Map containing all the current attributes set for this particular data object instance. |
Object |
getAttribute(String attributeName)
Return an "attribute". |
DataField |
getDataField(String fieldName)
Returns the object embedded within the field keyed by the fieldName parameter. |
DataExecutorInterface |
getExecutor()
Use this function to acquire the Executor interface that is associated with this data object |
String |
getField(String fieldName)
Retrieve the field value as a String |
DataFieldMetaData |
getFieldMetaData(String fieldName)
Retrieves the metadata for a particular field name |
org.apache.oro.text.regex.Pattern |
getGlobalMask()
Retrieve the DBObject's current global mask |
Locale |
getLocale()
Retrieve the DBObject's current locale |
String |
getMappedDataContext()
Returns the name of the physical database that we're talking with. |
int |
getMaxRecords()
A DB Object can be told to only retrieve a certain number of records. |
DataObjectMetaData |
getMetaData()
Retrieve the database object's metadata. |
int |
getOffsetRecord()
Gets the number of records that be skipped. |
DataQueryInterface |
getQueryInterface()
Use this function to acquire the DataQueryInterface that is associated with this data object [Currently unsupported] |
String |
getStatus()
Retrieve the status code of the dataobject. |
List |
getValidValuesList(String fieldName)
Retrieve a list of valid value object for this particular dbobject |
boolean |
isGlobalMasked()
Return boolean if the data object has a mask set |
ArrayList |
searchAndRetrieveList()
Performs a datasource search so that the criteria set in the DataObject is used. |
ArrayList |
searchAndRetrieveList(String sortOrder)
Performs a datasource search so that the criteria set in the DataObject is used. |
void |
set(String fieldName,
Object o)
Directly sets the field value without getting the datafield object |
void |
setAttribute(String attributeName,
Object attributeValue)
Set an attribute. |
void |
setFieldsWithDefaults()
Sets the fields of this object with the default values defined in the metadata. |
void |
setGlobalMask(org.apache.oro.text.regex.Pattern newGlobalMask)
Sets the DataObject's global mask |
void |
setLocale(Locale newLocale)
Sets the DataObject's locale |
void |
setMaxRecords(int newMax)
Specify a maximum number of records to be retrieved in any subsequent searchAndRetrieve() call. |
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
searchAndRetrieve() call. |
void |
setStatus(String statusValue)
Sets the status of the object. |
void |
update()
Updates the record to the defined datasource |
| Methods inherited from interface com.jcorporate.expresso.core.cache.Cacheable |
getKey |
| Methods inherited from interface com.jcorporate.expresso.core.dataobjects.ContextNested |
getDataContext, setDataContext |
| Field Detail |
public static final String STATUS_NEW
public static final String STATUS_CURRENT
public static final String STATUS_UPDATED
public static final String STATUS_DELETED
| Method Detail |
public DataField getDataField(String fieldName)
throws DBException
fieldName - The name of the field to get
DBException - upon errorpublic DataObjectMetaData getMetaData()
For implementers of this interface: It is best to store the metadata somewhere rather than recreating it each and every time. For low-memory requirements, a WeakHashMap is recommended
public DataFieldMetaData getFieldMetaData(String fieldName)
fieldName - The name of the field to retrieve the metadata for.
IllegalArgumentException - if the fieldName does not exist.
public Object get(String fieldName)
throws DataException
fieldName - the name of the field to get
DataException
public void set(String fieldName,
Object o)
throws DataException
fieldName - the name of the field to seto - the object value to set it to.
DataException
public void setFieldsWithDefaults()
throws DataException
DataException - upon setField error.public boolean equals(Object otherObject)
otherObject - the other object to compare to.
public void add()
throws DBException
DBException
public void update()
throws DBException
DBException
public void delete()
throws DBException
DBException
public void clear()
throws DBException
DBExceptionpublic String getMappedDataContext()
public void setAttribute(String attributeName,
Object attributeValue)
attributeName - The name of the attribute being definedattributeValue - The object to store under this attribute namepublic Object getAttribute(String attributeName)
attributeName - The attribute name to check
public Map getAllAttributes()
java.util.Map
public String getField(String fieldName)
throws DBException
fieldName - the name of the field to retrieve
DBException - upon error
IllegalArgumentException - if fieldname is invalidpublic DataExecutorInterface getExecutor()
public DataQueryInterface getQueryInterface()
public void checkField(String fieldName,
String fieldValue)
throws DBException
fieldName - Name of the field to verifyfieldValue - Value of the field to be evaluated
DBException - If the value is not validpublic String getStatus()
public void setStatus(String statusValue)
statusValue - the new status code.
public List getValidValuesList(String fieldName)
throws DBException
fieldName - name of the field to retrieve the list for.
DBException - upon errorpublic void setLocale(Locale newLocale)
newLocale - the New locale objectpublic Locale getLocale()
public void setMaxRecords(int newMax)
throws DBException
newMax - The maximum number of records to retrieve.
DBException - If the max number is less than 0public int getMaxRecords()
public void setOffsetRecord(int newOffset)
throws DBException
ResultSet
is retrieved in any subsequent
searchAndRetrieve() 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.
newOffset - The maximum number of records to retrieve.
DBException - If the max number is less than 0
author Peter Pilgrim public int getOffsetRecord()
ResultSet.
author Peter Pilgrim, Thu Jun 21 10:30:59 BST 2001
setOffsetRecord(int)
public ArrayList searchAndRetrieveList(String sortOrder)
throws DBException
sortOrder - A pipe delimited string specifying the field(s) to be sorted upon.
May be a single field without any pipes.
java.util.List of objects. May be an empty list if no
objects were found.
DBException - upon error performing the search
public ArrayList searchAndRetrieveList()
throws DBException
java.util.List of objects. May be an empty list if no
objects were found.
DBException - upon error performing the search
public boolean find()
throws DBException
DataTransferObject
DBException - upon error performing the search
public int count()
throws DBException
DBException - If the search could not be completedpublic void setGlobalMask(org.apache.oro.text.regex.Pattern newGlobalMask)
newGlobalMask - the New global mask objectpublic org.apache.oro.text.regex.Pattern getGlobalMask()
public boolean isGlobalMasked()
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||