|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.dataobjects.SynchronizedDataObject
This class provides a threadsafe access to a dataobject. To be able to more safely share your dataobjects acrossed multiple threads, simple call.
Typical Usage:
DataObject myobj = SynchronizedDataObject.newInstance(new MimeTypes(SecuredDBObject.SYSTEM_ACCOUNT));
//We now have a wrapped MimeTypes data object
myobj.setField("MimeNumber",new Integer(1));
//Retrieves a set of cloned records.
ArrayList records = myobj.searchAndRetrieveList();
| Field Summary |
| Fields inherited from interface com.jcorporate.expresso.core.dataobjects.DataObject |
STATUS_CURRENT, STATUS_DELETED, STATUS_NEW, STATUS_UPDATED |
| 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)
Retrieve the native object type for the given field name. |
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". |
String |
getDataContext()
Returns the name of the currently set DataContext |
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 |
Iterator |
getFieldListIterator()
Returna a list of all field names available to this class in order. |
DataFieldMetaData |
getFieldMetaData(String fieldName)
Retrieves the metadata for a particular field name |
org.apache.oro.text.regex.Pattern |
getGlobalMask()
Get the compiled regular expression for this base data object. |
String |
getKey()
Every class that can stay in the system cache must define a way to get a unique key |
Iterator |
getKeyFieldListIterator()
Retrieve iterator of all keys |
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 |
String |
getStatus()
Retrieve the status code of the dataobject. |
List |
getValidValuesList(String fieldName)
Retrieve a list of valid value object for this particular dbobject |
int |
hashCode()
Returns a hash code value for the object. |
boolean |
isGlobalMasked()
Return boolean if the data object has a mask set |
static DataObject |
newInstance(DataObject wrappedObject)
Call this to wrap your data object in a threadsafe wrapper. |
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 |
setDataContext(String newContext)
Sets the data context that this object is residing in. |
void |
setFieldsWithDefaults()
Sets the fields of this object with the default values defined in the metadata. The behavior of this function is such that it only populates fields if there is no current value set. This is the same behavior that existed previously in DefaultAutoElement. |
void |
setGlobalMask(org.apache.oro.text.regex.Pattern newMask)
Set a regular expression "mask" for this base data object that specifies it's valid values. |
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 class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static DataObject newInstance(DataObject wrappedObject)
wrappedObject - the object to wrap.
public DataField getDataField(String fieldName)
throws DBException
getDataField in interface DataObjectfieldName - The name of the field to get
DBException - upon errorpublic Iterator getFieldListIterator()
public Iterator getKeyFieldListIterator()
throws DBException
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
getMetaData in interface DataObjectpublic DataFieldMetaData getFieldMetaData(String fieldName)
getFieldMetaData in interface DataObjectfieldName - The name of the field to retrieve the metadata for.
IllegalArgumentException - if the fieldName does not exist.
public void set(String fieldName,
Object o)
throws DataException
set in interface DataObjectfieldName - the name of the field to seto - the object value to set it to.
DataExceptionpublic boolean equals(Object otherObject)
equals in interface DataObjectotherObject - the other object to compare to.
public void add()
throws DBException
add in interface DataObjectDBException
public void update()
throws DBException
update in interface DataObjectDBException
public void delete()
throws DBException
delete in interface DataObjectDBException
public void clear()
throws DBException
clear in interface DataObjectDBExceptionpublic void setDataContext(String newContext)
setDBName()
setDataContext in interface ContextNestednewContext - the new name of the data context.
IllegalArgumentException - if the DataContext does not existpublic String getDataContext()
getDataContext in interface ContextNested
public void setFieldsWithDefaults()
throws DataException
setFieldsWithDefaults in interface DataObjectDataException - upon setField error.public String getMappedDataContext()
getMappedDataContext in interface DataObject
public void setAttribute(String attributeName,
Object attributeValue)
setAttribute in interface DataObjectattributeName - The name of the attribute being definedattributeValue - The object to store under this attribute namepublic Object getAttribute(String attributeName)
getAttribute in interface DataObjectattributeName - The attribute name to check
public Map getAllAttributes()
getAllAttributes in interface DataObjectjava.util.Mappublic DataExecutorInterface getExecutor()
getExecutor in interface DataObjectpublic DataQueryInterface getQueryInterface()
getQueryInterface in interface DataObject
public void checkField(String fieldName,
String fieldValue)
throws DBException
checkField in interface DataObjectfieldName - Name of the field to verifyfieldValue - Value of the field to be evaluated
DBException - If the value is not validpublic String getStatus()
getStatus in interface DataObject
public List getValidValuesList(String fieldName)
throws DBException
getValidValuesList in interface DataObjectfieldName - name of the field to retrieve the list for.
DBException - upon errorpublic void setLocale(Locale newLocale)
setLocale in interface DataObjectnewLocale - the New locale objectpublic Locale getLocale()
getLocale in interface DataObject
public void setMaxRecords(int newMax)
throws DBException
setMaxRecords in interface DataObjectnewMax - The maximum number of records to retrieve.
DBException - If the max number is less than 0public int getMaxRecords()
getMaxRecords in interface DataObject
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.
setOffsetRecord in interface DataObjectnewOffset - 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
getOffsetRecord in interface DataObjectsetOffsetRecord(int)
public ArrayList searchAndRetrieveList(String sortOrder)
throws DBException
Note: This particular implementation, to be threadsafe, returns a new array instance, so it is particularly slow and memory intensive. However, for the scope of the class, it is at least threadsafe.
searchAndRetrieveList in interface DataObjectsortOrder - 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
Note: This particular implementation, to be threadsafe, returns a new array instance, so it is particularly slow and memory intensive. However, for the scope of the class, it is at least threadsafe.
searchAndRetrieveList in interface DataObjectjava.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
find in interface DataObjectDBException - upon error performing the search
public int count()
throws DBException
count in interface DataObjectDBException - If the search could not be completedpublic String getKey()
getKey in interface Cacheablepublic void setStatus(String statusValue)
setStatus in interface DataObjectstatusValue -
public Object get(String fieldName)
throws DataException
get in interface DataObjectfieldName - the name of the field to retrieve
DataException - upon error
IllegalArgumentException - if fieldname is invalid
public String getField(String fieldName)
throws DBException
getField in interface DataObjectfieldName - the name of the field to retrieve
DBException - upon error
IllegalArgumentException - if fieldname is invalidpublic void setGlobalMask(org.apache.oro.text.regex.Pattern newMask)
setGlobalMask in interface DataObjectnewMask - The compiled regular expression maskpublic org.apache.oro.text.regex.Pattern getGlobalMask()
getGlobalMask in interface DataObjectpublic boolean isGlobalMasked()
isGlobalMasked in interface DataObjectpublic int hashCode()
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||