|
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.BaseDataObject
com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
com.jcorporate.expresso.core.dbobj.DBObject
DBObjects are the core of Expresso's object-relational mapping. They are object-oriented wrappers for some sort of data. They are generally expected to be used in a single thread, like in processing a web query.
When making your own application, you derive your classes from DBObject or SecuredDBObject.
SecuredDBObject,
DBException,
DBConnection,
Serialized Form| Nested Class Summary | |
class |
DBObject.FieldError
Private class that defines errors for fields. |
class |
DBObject.FieldUpdate
Private class used to track field updates |
| Field Summary | |
static String |
ATTRIBUTE_ERROR
Attribute String for if there's an error with the field. |
static String |
ATTRIBUTE_ERROR_MESSAGE
Attribute String for what message to display if there's an error with thie field. |
static String |
ATTRIBUTE_PAGE_LIMIT
Attribute for what is the limit to retrieve from searchAndRetrieve operations |
protected static BigDecimal |
BIG_DECIMAL_ZERO
A static zero BIG DECIMAL object author Peter Pilgrim |
static String |
EMAIL_MASK
Email Regular Expression Constant. |
static String |
EVENT_ADD
Event 'Add' code |
static String |
EVENT_DELETE
Event 'Delete' Code |
static String |
EVENT_UPDATE
Event 'Update' Code |
static String |
FLOAT_MASK
Floating point regular expression syntax for easy reference. |
static String |
INT_MASK
Integer Regular Expression for easy reference |
static String |
IS_CHECK_RELATIONAL_INTEGRITY
|
static String |
UPDATE_CHANGED_ONLY
setup code for update() policy: for efficiency, developers who are confident that their code does not have any 'blind updates' can set the Setup value UPDATE_CHANGED_ONLY to true (a blind update is where the object is not retieved before values in it are reset) |
static String |
WHERE_KEYWORD
|
| Fields inherited from class com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject |
anyFieldsDistinct, anyFieldsToRetrieve, appendCustomWhere, caseSensitiveQuery, customWhereClause, dbKey, distinctFields, localConnection, LONGBINARY_READ_DEFAULT_SIZE, maxRecords, myClassName, myUpdates, offsetRecord, recordSet, retrieveFields, sMetadataMap, sortKeys |
| Fields inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject |
currentStatus, globalMask |
| Fields inherited from interface com.jcorporate.expresso.core.dataobjects.DataObject |
STATUS_CURRENT, STATUS_DELETED, STATUS_NEW, STATUS_UPDATED |
| Constructor Summary | |
DBObject()
Default Constructor. |
|
DBObject(DBConnection newConnection)
Constructor that sets a connection as the object is created - typically this is used when a particular DBConnection is required for the purposes of maintaining a database transaction. |
|
DBObject(DBConnection newConnection,
String setupTablesContext)
Constructor that sets a connection as the object is created - typically this is used when a particular DBConnection is required for the purposes of maintaining a database transaction. |
|
DBObject(RequestContext request)
For using DBObjects within Controllers. |
|
DBObject(String newdbKey)
Initialize this DBObject and set the db/context to the specified key |
|
| Method Summary | |
void |
add()
Add a new record to the target table. |
protected void |
addDetail(String objName,
String keyFieldsLocal,
String keyFieldsForeign)
Specify a new "detail" db object, and the fields in this object they specify the fields in the related object |
protected void |
addField(String fieldName,
String fieldType,
int fieldSize,
boolean allowNull,
String fieldDescription)
Add a field with more details: This version of addfield supplies the allowNull flags and a description of the field to be used when reporting errors to the user. |
protected void |
addField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String fieldDescription)
Add a field with more details: This version allows the user to specify a precision, for fields that use both a size and precision. |
protected void |
addFieldError(String fieldName,
String errorMessage)
Use this in your derived checkField() class to add error messages to be associated with various fields. |
void |
addFoundKeys(String fieldName)
This is used internally by JDBC Exceutor's and JDBC Query when dealing with queries to the underlying datasource. |
void |
addIfNeeded()
Determine if a record with this key exists already - if not, add a new record. |
protected void |
addIndex(String indexName,
String fieldNames,
boolean isUnique)
Add an index to the table. |
protected void |
addKey(String keyFieldName)
Add a new field to the list of fields that are part of this object's key. |
void |
addOrUpdate()
Determine if a record with these fields exists already - if so, update. |
void |
addSortKey(String fieldString,
boolean ascending)
Add a field to be sorted in a search |
protected void |
addTransition(Transition t)
????? |
protected void |
addVirtualField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String fieldDescription)
Add a field with more details: This version allows the user to specify a precision, for fields that use both a size and precision. |
protected void |
addVirtualField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String descripKey,
String fieldDescription)
Add a field with more details: This version allows the user to specify a precision, for fields that use both a size and precision. |
protected void |
addVirtualField(String fieldName,
String fieldType,
int fieldSize,
String fieldDescription)
Add a new virtual field to the definition of this object. |
protected void |
addVirtualField(String fieldName,
String fieldType,
int fieldSize,
String descripKey,
String fieldDescription)
Add a new virtual field to the definition of this object. |
double |
average(String fieldName)
Find the average of the values in the specified field of records selected by the DBObject selection criteria. |
void |
basicAdd()
A "simplified"e; version of add that can be used to do a basic INSERT statement into this table. |
void |
cacheIsChangedComparison()
reset 'original' value and isChanged flags on all fields, establishing a baseline for comparison. |
boolean |
checkAllowed(String function)
No security is applied at the DBObject level, only at the level of SecuredDBObjects. |
protected void |
checkAllReferredToBy()
Extended by subclasses to make calls to ReferredToBy as needed. |
protected void |
checkAllRefs()
Extended by subclasses to make calls to checkRef as needed. |
void |
checkAllRefsPublic()
Public interface to checkAllRefs() |
protected void |
checkDeleteDetailPerm(DBObject obj)
extracted for subclasses checking |
void |
checkField(String fieldName,
String fieldValue)
Check that a given value is valid for a given field. |
protected void |
checkRef(String foreignKeyNames,
DBObject refObject,
String errorMessage)
Convenience method for checking a reference where blank is *not* allowed in the foreign key; This test can be turned off if you add an Expresso setup (configuration) entry, 'isCheckRelationalIntegrity' set to false |
protected void |
checkRef(String foreignKeyNames,
DBObject refObject,
String errorMessage,
boolean allowBlank)
Verify referential integrity from the given list of fields to the key fields in the given DB Object. |
void |
clear()
Set all fields to empty value & clear the last result set & clear sort keys and customWhereClause |
void |
clearDistinctFields()
This convenience method clears all the distinct flags of DBFields belonging to this
DBObject
author Peter Pilgrim |
protected void |
clearError(String fieldName)
Used to clear field error flags. |
void |
clearFieldsToRetrieve()
This convenience method clears all the fileds to be retrieved DBFields belonging to this
DBObject
author Yves Henri Amaizo |
void |
clearSortKeys()
Clear the sort keys |
protected boolean |
containsWildCards(String fieldValue)
See if this field value contains wild cards (e.g. pattern matching criteria for the database). |
protected void |
copyAttributes(DBObject returnObj)
called by newInstance(), this method should make sure that the newly created object is properly initialized |
int |
count()
Just like find, but only retrieves the count, not the records themselves. |
void |
delete()
Delete this 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. |
void |
deleteAll(boolean oneByOne)
Delete all of the records specified by the current search criteria. |
protected void |
deleteDetails(DBConnection detailConnection)
If this DB object has associated detail objects, locate the appropriate related detail records and delete them as well. |
protected String |
denotesRange(String fieldValue)
Does a given field value denote a range? |
boolean |
equals(Object parm1)
Equals implementation. |
boolean |
find()
A lot like retrieve, but works with any fields, not just the key field. |
String |
forKey()
Return a string we can use in error messages to indicate the record that had the problem by including the key and the current database/context |
String |
formatDateTime(String fieldName)
Given the value of a date/time or date/time field, return the value formatted as appropriate for the current DBMS. |
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 attribName)
Return an "attribute". |
Iterator |
getAttributesIterator(String fieldName)
Get an iterator for all of the attributes specified for a field |
protected String |
getBooleanFieldValue(boolean fieldValue)
Internal refactoring for getting what a boolean field should be set to. |
int |
getCacheSize()
Gets the set size of the cache for this DBOBject |
static HashMap |
getCacheStatsMap()
|
protected CacheUtils |
getCacheUtil()
'Pseudo' factory method to retrieve the caching utility class instance. |
boolean |
getCheckZeroUpdate()
Gets the check zero update flags for this DBObject. |
String |
getCustomWhereClause()
Allows us to query the custom where clause (if any). ' WHERE ' has been prepended to the clause. |
String |
getDataContext()
Returns the name of the currently set DataContext |
DataField |
getDataField(String fieldName)
Same as getField, but works with the DataObject interface for now. |
DataTransferObject |
getDataTransferObject()
Gets the data transfer object usually for serialization purposes |
String |
getDBName()
Deprecated. since Expresso 5.1 Use getDataContext() instead |
Enumeration |
getDetails()
Get a list of all db objects that are specified as being "details" to this db object. |
int |
getDistinctFieldCount()
This convenience method counts DBFields belonging to this
DBObject that are set to distinct. |
String[] |
getDistinctFields()
This convenience method iterates through all the fields belonging to this DBObject
returns an array of field names ( String )
that are set to distinct. |
String |
getField(String fieldName)
Get the string value of a field in this object as a string |
BigDecimal |
getFieldBigDecimal(String fieldName)
Get the BigDecimal value of a field in this object.
|
boolean |
getFieldBoolean(String fieldName)
Boolean typesafe getField |
byte |
getFieldByte(String fieldName)
Get the primitive byte value of a field in this object.
|
byte[] |
getFieldByteArray(String fieldName)
Get the primitive byteArray value of a field in this object.
|
protected String |
getFieldData(String fieldName)
Internal mechanism for getting the raw field data |
Date |
getFieldDate(String fieldName)
Return the value of a field as a Date object |
String |
getFieldDecimalFormatted(String fieldName,
String formatPattern)
Return the value of a field as a Date object |
double |
getFieldDouble(String fieldName)
Get the primitive double value of a field in this object. we use the locale specified
in the properties file directly to determine how to parse the field |
String |
getFieldErrorMessage(String fieldName)
Retrieve the error message associated with this field. |
float |
getFieldFloat(String fieldName)
Get the primitive float value of a field in this object. we use the locale specified
in the properties file directly to determine how to parse the field |
int |
getFieldInt(String fieldName)
Get the primitive integer value of a field in this object.
|
long |
getFieldLong(String fieldName)
Get the prmitive long value of a field in this object.
|
DataFieldMetaData |
getFieldMetaData(String fieldName)
Returns the metadata for the specified field. |
short |
getFieldShort(String fieldName)
Get the primitive integer value of a field in this object.
|
int |
getFieldsToRetrieveCount()
This convenience method counts DBFields belonging to this
DBObject that are set to retrieve. |
Class |
getFilterClass()
the INSTANCE value of filter class that will be used for all string filtering for THIS INSTANCE. |
long |
getFoundCount()
Return the number of records found in the last search operation. |
Object[] |
getFoundKeysArray()
Return the Array of keys (in the form field/field/field) that was found in the last search() call |
Object[] |
getIndexArray()
Deprecated. since 5.6, Use ((DBObjectDef)getMetaData()).getIndexArray() instead |
protected Vector |
getISOValuesDefault(String valueField,
String descripField)
Basic version of getValidValues with supports internationalisation (i18n) that stores/retrieves the valid values in a locale dependent Caches Valid values are store inside cache with a key name that equals myClassName+"." |
protected Vector |
getISOValuesDefault(String valueField,
String descripField,
String whereClause)
Basic filtered version of getValidValues with supports internationalisation (i18n) that stores/retrieves the valid values in a locale dependent Caches Valid values are store inside cache with a key name that equals myClassName+"." |
protected Vector |
getISOValuesDefault(String valueField,
String descripField,
String whereClause,
String sortKeyString)
Basic version of getValidValues with supports internationalisation (i18n) that stores/retrieves the valid values in a locale dependent Caches. |
String |
getKey()
Get a string consisting of the values of each key field for this object appended together with a | between them. |
Iterator |
getKeyFieldListIterator()
Get a list of all of the fields in this object This iterator is not thread safe. |
String |
getLength(String fieldName)
Return the length of a field |
int |
getLengthInt(String fieldName)
Get the length of this field as an integer |
DBConnection |
getLocalConnection()
Returns the local connection currently associated with this DBObject... |
Locale |
getLocale()
Get the current locale for this dbobject |
org.apache.log4j.Logger |
getLogger()
convenience for getting logger for current (sub) class |
String |
getLookupObject(String fieldName)
Get a field's lookup object - this is the name of another database object that can be used to look up valid values for this object. |
String |
getMax(String fieldName)
Get the Maximum value in the table of a particular field Contributed by Madan Mohanrao Kulkarni [kulsmadya@rediffmail.com] |
String |
getMax(String fieldName,
boolean whereClause)
Get the Maximum value in the table of a particular field Contributed by Madan Mohanrao Kulkarni [kulsmadya@rediffmail.com] |
int |
getMaxRecords()
A DB Object can be told to only retrieve a certain number of records. |
String |
getMyKeys()
Get a string consisting of the values of each key field for this object appended together with a | between them. |
protected Object[] |
getMyUpdatesArray()
Return the array of updates (see the inner class) that specify what changes were just made to this object. |
int |
getOffsetRecord()
Gets the number of records that be skipped. |
protected org.apache.oro.text.regex.PatternMatcher |
getPatternMatcher()
Retrieve a thread local instance of the Perl5 pattern matcher. |
int |
getPrecision(String fieldName)
Get the precision of thie field, if one was specified |
String |
getSerializedForm(DBField theField)
This function is called whenever the DBField is about to be written to the database. |
String |
getStringFilter(String fieldName)
get the current filter for a particular field. |
static DBObject |
getThisDBbj(DataTransferObject dto)
Constructor method that takes a DataTransferObject and builds a full fledged DBObject out of it. |
protected DBObject |
getThisDBObj()
This will return a new object of the type of the subclass. |
String |
getValidValueDescrip(String fieldName)
This is a convenience method which will return a ValidValue description for a multi-valued field. |
Vector |
getValidValues(String fieldName)
New method to replace getValues with a structure of valid values and descriptions. |
List |
getValidValuesList(String fieldName)
Retrieve a list of valid value object for this particular dbobject |
Vector |
getValues()
Method to return a Vector of ValidValue Template method--not implemented in this superclass. |
protected Vector |
getValuesDefault(String valueField,
String descripField)
Basic version of getValidValues that stores/retrieves the valid values in a Cache. |
protected Vector |
getValuesDefault(String valueField,
String descripField,
String whereClause)
Basic filtered version of getValidValues that stores/retrieves the valid values in a Cache. |
protected Vector |
getValuesDefault(String valueField,
String descripField,
String whereClause,
String sortKeyString)
Basic version of getValidValues that stores/retrieves the valid values in a Cache. |
boolean |
hasError(String fieldName)
Use this to check if a field is in error. |
boolean |
hasErrors()
Use this to check if any fields are in error. |
boolean |
haveAllKeys()
See if we have a value for each of the key fields |
protected void |
initialize()
Sets up metadata for the dbobject via call to setupFields(). |
boolean |
isCached()
Is this object using internal caching? |
boolean |
isChanged()
summarize DataField.isChanged() for all fields. |
boolean |
isDistinct()
This method iterates through all the DBFields belonging
DBObject returns true if any of them are
set a distinct.
|
boolean |
isEmpty()
Return true if every field in this object is empty or null. |
boolean |
isFieldDistinct(String fieldName)
Convenience method to check if a field is distinct or not within this database object. |
boolean |
isFieldNull(String fieldName)
Tells whether a particular field is null or not. |
boolean |
isFieldsToRetrieve()
This method iterates through all the DBFields belonging
DBObject returns true if any of them are
between the retrieve fields.
|
boolean |
isFieldToRetrieve(String fieldName)
Convenience method to check if a field is field to be retrieve or not within this database object. |
boolean |
isMultiValued(String fieldName)
Deprecated. since 5.6, use getJDBCMetaData().isMultiValued(String) |
boolean |
isReadOnly(String fieldName)
Deprecated. since 5.6, use getJDBCMetaData().isReadOnly(String) |
boolean |
isSecret(String fieldName)
Deprecated. since 5.6, use getJDBCMetaData().isSecret(String) |
boolean |
isVirtual(String fieldName)
Deprecated. since 5.6, use getJDBCMetaData().isVirtual(String) |
int |
loadFromConnection(DBConnection connection)
Hand a dbobject a connection that contains fields corresponding to what the dbobject expects, and it'll set itself. |
protected void |
logChange(DBField oneField,
String fieldValue)
Helper Function: If Change Logging is enabled, then this logs what has changed |
double |
max(String fieldName)
Find the maximum of the values in the specified field of records se;lected by the DBObject selection criteria. |
double |
min(String fieldName)
Find the minimum of the values in the specified field of records selected by the DBObject selection criteria. |
DBObject |
newInstance()
get a new instance of this object, with some basic attributes copied, like the local connection of the transaction Generally speaking, DO NOT OVERRIDE THIS METHOD. |
protected String |
noNewLine(String fieldValue)
Strip out the newlines out of a string |
protected String |
noQuotes(String oldString)
Utility method to return a string with all single quotes replaced with a pair of single quotes, and all double quotes also replaced with a pair of single quotes |
protected void |
notifyListeners(String eventCode)
Used by internal caching to ensure that caches are cleared when an update is made. |
void |
populateDefaultValues()
populateDefaultValues is called by the schema object to allow a table to populate itself with any desired values. |
protected void |
referredToBy(DBObject refObject,
String foreignKeyNames,
String errorMessage)
The reverse of the checkRef method - if this object is referred to by some other object, and we are changing our own key (only allowed by deleting) then check the other table to make sure our key is not being used by it! |
void |
removeAttribute(String attributeName)
Removes an attribute from this particular database object. |
void |
removeFromCache(DBObject theDBObj)
Remove a specific object from that object's cache. |
void |
retrieve()
Get a particular record from the database into this object's fields Key fields for this object must be set; throws otherwise |
boolean |
retrieveFromCache()
Retrieve this object from cache, if possible. |
void |
saveBinaryField(String fieldName,
byte[] incomingData)
Deprecated. since Expresso 5.6. Use LobField directly or com.jcorporate.expresso.services.dbobj.MediaDBObject for BLOB storage since they all require much less memory as well as provides more dynamic database support. |
void |
search()
Find a set of keys of all of the objects that match the current search critieria in the fields. |
void |
search(String sortKeyString)
Second form of search: takes a list of sort keys & calls regular search. |
ArrayList |
searchAndRetrieveList()
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) SIDE-EFFECT: custom 'where' clause is set to null. |
ArrayList |
searchAndRetrieveList(String sortKeyString)
Search and retrieve in a particular order |
void |
set(String fieldName,
Object o)
sets the field value by using 'instanceof' operator; convenient for template methods, but less efficient than calling setField() |
void |
setAttribute(String attribName,
Object attribValue)
Set an attribute. |
void |
setCacheSize()
Read the configuration table to determine the max size of the cache for this db object. |
void |
setCharset(String newCharSet)
Set a characterset for a particular field. |
void |
setCheckZeroUpdate(boolean newFlag)
Turn on or off the facility to verify that when an update is made that at least one record got updated. |
void |
setConnection(DBConnection newConnection)
Set a specific DB connection for use with this db object. |
void |
setConnection(DBConnection newConnection,
String setupTablesContext)
Set a specific DB connection for use with this db object. |
void |
setCustomWhereClause(String newCustomWhere)
Specify a custom "where" clause for the SQL used to retrieve records for this object. |
void |
setCustomWhereClause(String newCustomWhere,
boolean append)
Allows us to specify a custom WHERE clause and have it appended to the one built from the field values in the object |
void |
setDataContext(String newContext)
Sets the data context that this object is residing in. |
void |
setDataField(String fieldName,
DataField o)
Same as setField, but works with the DataObject Interface |
void |
setDataTransferObject(DataTransferObject dto)
fill fields with values found in dto; REPLACES any data field already present. |
protected void |
setDefaultValue(String fieldName,
String fieldValue)
Define a "default" value for a field - to be used for the field when the user does not specify a value. |
void |
setDescription(String newDescription)
Set the description of this object |
void |
setField(String fieldName,
BigDecimal fieldValue)
BigDecimal object Typesafe version of setField.
|
void |
setField(String fieldName,
boolean fieldValue)
Boolean typesafe version of setField |
void |
setField(String fieldName,
byte fieldValue)
Byte primitive integer Typesafe version of setField. |
void |
setField(String fieldName,
byte[] fieldValue)
Byte primitive integer Typesafe version of setField. |
void |
setField(String fieldName,
Date fieldValue)
Date object Typesafe version of setField.
|
void |
setField(String fieldName,
double fieldValue)
Double primitive Typesafe version of setField.
|
void |
setField(String fieldName,
int fieldValue)
Integer primitive Typesafe version of setField. |
void |
setField(String fieldName,
long fieldValue)
Long primitive Typesafe version of setField.
|
void |
setField(String fieldName,
short fieldValue)
Short primitive integer Typesafe version of setField. |
void |
setField(String fieldName,
String fieldValue)
Set the given field to a given value. |
protected void |
setFieldData(String fieldName,
byte[] fieldValue)
Helper function that doesn't fire all the processing... just set's the field data in raw form and forgets it. |
protected void |
setFieldData(String fieldName,
String fieldValue)
Helper function that doesn't fire all the processing... just set's the field data in raw form and forgets it. |
void |
setFieldDistinct(String fieldName,
boolean flag)
Convenience method to set a field to be distinct or not within this database object. |
void |
setFieldsToRetrieve(String fieldNames)
Convenience method to set the fields to be retrieved within this database object. |
Class |
setFilterClass(Class filter)
Deprecated. use setFilterClass(Filter) |
Filter |
setFilterClass(Filter filter)
set the filter class that will be used for all string filtering for this object instance ONLY. |
void |
setKeys(String keyValues)
Set the values for each of the key fields of this object from a /-delimited string |
void |
setLocale(Locale newLocale)
Sets the locale to be used with this DBObject |
void |
setLookupField(String fieldName,
String lookupFieldName)
Sets the lookup field name. |
void |
setLookupObject(String fieldName,
String objectName)
Set a field's lookup object - this is the name of another database object that can be used to look up valid values for this object. |
protected void |
setMask(String fieldName,
String newMask)
Set a "mask", or regular expresso to be matched, for the named field. |
void |
setMaxRecords(int newMax)
Specify a maximum number of records to be retrieved in any subsequent searchAndRetrieve() call. |
protected void |
setMultiValued(String fieldName)
Set this field to be multi-valued - e.g. there is a specific list of values that are valid for this field. |
protected void |
setName(String theName)
Set the name of this object - this name is used to identify the db object with a more human-readable description |
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 |
setReadOnly(String fieldName)
Set a field as read-only - these fields are not offered for update when a form is produced by the generic database maintenance servlet (DBMaint). |
void |
setSchema(Schema schema)
Specify which schema this DB object belongs to. |
void |
setSecret(String fieldName)
Set a field as 'secret' - these fields are not shown when a list is produced by the generic database maintenance servlet. |
protected void |
setSortKey(String sortKeyString)
Parses the sort key string into useful values. |
String |
setStringFilter(String fieldName,
String filterMethod)
Set a filter for a particular field, permanently for all instances of this class. |
void |
setStringFiltersOnAll(String filter)
set string filters to the given filter on ALL fields that are quoted text fields |
void |
setTargetDbSchema(String theDbSchema)
Set the target table for this DBObject. |
void |
setTargetTable(String theTable)
Set the target table for this DBObject. |
protected void |
setupFields()
Method to set up the fields for this database object. |
protected double |
sqlAggrFunction(String func,
String fieldName)
This allows the invocation of the SQL AVG, MIN, MAX and SUM aggregate functions on one of the DB's columns (the DBObject fieldname is supplied). |
double |
sum(String fieldName)
Find the sum of the values in the specified field of records selected by the DBObject selection criteria. |
String |
toDebugString()
Generate a debuggable string for suitable printing out in an interactive Java IDE. |
void |
update()
Update the database with the new info. |
void |
update(boolean updateChangedFieldsOnly)
Update the database with the new info. |
void |
updateAll()
Update all of the records specified by the current search criteria. |
void |
updateAll(boolean oneByOne)
Update the database with the new info. |
void |
verify()
Verify that this object is working correctly by selecting all records, running a validation on each of them. |
| Methods inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject |
getGlobalMask, getStatus, isGlobalMasked, setFieldsWithDefaults, setGlobalMask, setStatus |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String UPDATE_CHANGED_ONLY
public static final String ATTRIBUTE_ERROR
public static final String ATTRIBUTE_ERROR_MESSAGE
public static final String ATTRIBUTE_PAGE_LIMIT
public static final String EVENT_ADD
public static final String EVENT_DELETE
public static final String EVENT_UPDATE
protected static final transient BigDecimal BIG_DECIMAL_ZERO
getFieldBigDecimal(java.lang.String)public static final String WHERE_KEYWORD
public static final String INT_MASK
public static final String FLOAT_MASK
public static final String EMAIL_MASK
public static final String IS_CHECK_RELATIONAL_INTEGRITY
| Constructor Detail |
public DBObject()
throws DBException
DBException - upon error.
public DBObject(DBConnection newConnection)
throws DBException
newConnection - The DBConnection to utilize
DBException - upon error.
public DBObject(DBConnection newConnection,
String setupTablesContext)
throws DBException
This constructor is neceesary to work with otherDBMap and transaction capabilities
newConnection - The DBConnection to utilizesetupTablesContext - The data context that contains the setup (and
security) tables for this object
DBException - upon error.
public DBObject(RequestContext request)
throws DBException
SecuredDBObject
type instead.
request - - The controller request handed to you by the framework.
DBException - if there's an error constructing the SecuredDBObject
public DBObject(String newdbKey)
throws DBException
newdbKey - The database Context name
DBException - upon error.| Method Detail |
protected org.apache.oro.text.regex.PatternMatcher getPatternMatcher()
public Locale getLocale()
getLocale in interface DataObjectpublic void setLocale(Locale newLocale)
setLocale in interface DataObjectnewLocale - The new Locale to use with this object
public void add()
throws DBException
add in interface DataObjectDBException - If the record cannot be added - this includes if the
record has a duplicate key
public int loadFromConnection(DBConnection connection)
throws DBException
connection - The connection that currently has a dbobject ready to
be read in it's result set.
DBException - upon error.
public void cacheIsChangedComparison()
throws DBException
DBException - upon error.public void addFoundKeys(String fieldName)
fieldName - the name of the fieldname found.
protected void addDetail(String objName,
String keyFieldsLocal,
String keyFieldsForeign)
throws DBException
objName - The class name of the related object. There is assumed to be
a one to one or one to many relationship from this object to the specified objectkeyFieldsLocal - A pipe-delimited list of field names in this objectkeyFieldsForeign - A pipe-delimieted list of field names in the other object
DBException - upon error.
protected void addField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Type of the field - this is the internal Expresso type,
mapping in DBField to a specific database data type.fieldSize - Size of the fieldfieldPrecision - The precision of the fieldallowNull - Does this field allow nulls?fieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException - upon error.
protected void addField(String fieldName,
String fieldType,
int fieldSize,
boolean allowNull,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Type of the field - this is the "internal" Expresso type,
and is mapped to a specific type for the database depending on the
mappings in the properties file (if any). The DBField object contains
the default mappings.fieldSize - Size of this field, if specified for this type of field. For
fields that do not use a size (such as "date"), specify 0 for the size.allowNull - Does this field allow nulls?fieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException - upon error.
public void addIfNeeded()
throws DBException
DBException - upon error.
protected void addFieldError(String fieldName,
String errorMessage)
fieldName - The field name to add the error toerrorMessage - The custom error message to associate when there's
a problem with this fieldpublic String getFieldErrorMessage(String fieldName)
fieldName - the fieldName to get the associated error message
public boolean hasError(String fieldName)
fieldName - Check if there's an error set for this field.
public boolean hasErrors()
protected void clearError(String fieldName)
fieldName - the name of the field to clear the error flag
protected void addIndex(String indexName,
String fieldNames,
boolean isUnique)
throws IllegalArgumentException,
DBException
indexName - the name to give the index in the table; MUST CONTAIN NO SPACES--use underscores insteadfieldNames - A comma delimited list of all fields in the index.isUnique - - True if this field is a unique index.
IllegalArgumentException - of fieldName is null or doesn't exist
or if indexName is null
DBException - upon error.
protected void addKey(String keyFieldName)
throws DBException
keyFieldName - The name of the field to add as part of the key
DBException - if the field name is not valid or the field
allows nulls
public void addOrUpdate()
throws DBException
DBException - upon error.
protected void addTransition(Transition t)
throws DBException
t - unknown
DBException - upon metadata retrieval error
protected void addVirtualField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Type of the field - this is the internal Expresso type,
mapping in DBField to a specific database data type.fieldSize - Size of the fieldfieldPrecision - The precision of the fieldallowNull - Does this field allow nulls?fieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException - upon error.
protected void addVirtualField(String fieldName,
String fieldType,
int fieldSize,
int fieldPrecision,
boolean allowNull,
String descripKey,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Type of the field - this is the internal Expresso type,
mapping in DBField to a specific database data type.fieldSize - Size of the fieldfieldPrecision - The precision of the fieldallowNull - Does this field allow nulls?descripKey - The key in the local language file for the
description of this fieldfieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException - upon error.
protected void addVirtualField(String fieldName,
String fieldType,
int fieldSize,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Database type of the fieldfieldSize - Size of the field in charactersfieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException - upon error.protected void setSortKey(String sortKeyString)
sortKeyString - the pipe delimited string of field names with the optional 'ASC or DESC' keyword afterwords; null indicates no sorting
public void addSortKey(String fieldString,
boolean ascending)
fieldString - the name of the field to sort onascending - true if using ascending sort order, false if descending
sort order.
IllegalArgumentException - if the fieldString does not existpublic void clearSortKeys()
addSortKey(java.lang.String, boolean)
protected void addVirtualField(String fieldName,
String fieldType,
int fieldSize,
String descripKey,
String fieldDescription)
throws DBException
fieldName - Name of the fieldfieldType - Database type of the fieldfieldSize - Size of the field in charactersdescripKey - Key into the local langauge file for the
description of this fieldfieldDescription - A longer description of this field
(user-understandable hopefully!)
DBException - upon error.
public double average(String fieldName)
throws DBException
fieldName - String DBObject fieldName to average
DBException - If the search could not be completed
public void basicAdd()
throws DBException
NOTE BLOB Objects are not added with this function!
NOTE this function does NOT handle auto-increment fields!
DBException - If the record cannot be added - this includes if the
record has a duplicate key
Modify by Yves Henri AMAIZO
public boolean checkAllowed(String function)
throws DBException
function - The appropriate function code. This is mainly used
in objects derived from SecuredDBObject
DBException - upon error.
protected void checkAllReferredToBy()
throws DBException
DBException - If the referential integrity is not correct
protected void checkAllRefs()
throws DBException
DBException - If the update/add operation would result in an invalid
foreign key reference.
public void checkAllRefsPublic()
throws DBException
DBException - upon error.
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 valid
protected void checkRef(String foreignKeyNames,
DBObject refObject,
String errorMessage)
throws DBException
foreignKeyNames - names of the foreign key fieldsrefObject - The foreign DBObject to check againsterrorMessage - The custom error message to display if check fails
DBException - if check fails
protected void checkRef(String foreignKeyNames,
DBObject refObject,
String errorMessage,
boolean allowBlank)
throws DBException
foreignKeyNames - A semicolon-sperated list of foreign
key fields from this objectrefObject - Another DBObject that we are to refer toerrorMessage - Error string to throw if the check failsallowBlank - true if blank fields are allowed
DBException - If the referential integrity is not correct
public void clear()
throws DBException
clear in interface DataObjectDBException - If the fields cannot be cleared
public void clearDistinctFields()
throws DBException
DBFields belonging to this
DBObject
author Peter Pilgrim
DBException - upon error.getDistinctFieldCount(),
isDistinct()
public void clearFieldsToRetrieve()
throws DBException
DBFields belonging to this
DBObject
author Yves Henri Amaizo
DBException - upon error.isFieldsToRetrieve()
protected boolean containsWildCards(String fieldValue)
throws DBException
fieldValue - The field value to check for wild cards
DBException - upon error.
public int count()
throws DBException
count in interface DataObjectDBException - If the search could not be completed
public void delete()
throws DBException
delete in interface DataObjectDBException - If the delete fails or if the referential integrity
would be violated by the deleteto delete objects identified by non-key fields
public void delete(boolean deleteDetails)
throws DBException
deleteDetails - Delete associated detail records if true
DBException - Modify by Yves Henri AMAIZO to delete objects identified by non-key fields
public void deleteAll()
throws DBException
DBException - upon error
public void deleteAll(boolean oneByOne)
throws DBException
oneByOne - set 'true' usually, to make sure that all 'detail' records are also deleted. Set to false if you are sure that the table has no detail records (i.e., it supplies no foreign keys--has no dependent records)
DBException - upon error
protected void deleteDetails(DBConnection detailConnection)
throws DBException
detailConnection - the DBConnection to use while retrieving details
DBException - upon error.
protected void checkDeleteDetailPerm(DBObject obj)
throws DBException
obj - the dbobject to check it's permission
DBException - upon errorprotected String denotesRange(String fieldValue)
fieldValue - The field value to check against.
public boolean find()
throws DBException
find in interface DataObjectDBException - If the search could not be completed
Modify by Yves Henri AMAIZO public String forKey()
public String formatDateTime(String fieldName)
throws DBException
fieldName - java.lang.String The value for the date/time field.
DBException - upon error.public Object getAttribute(String attribName)
getAttribute in interface DataObjectattribName - The attribute name to check
public Iterator getAttributesIterator(String fieldName)
throws DBException
fieldName - The field name to get the attirbutes for
DBException - upon error.public int getCacheSize()
public static HashMap getCacheStatsMap()
public DataFieldMetaData getFieldMetaData(String fieldName)
getFieldMetaData in interface DataObjectfieldName - The name of the field to get
public String getDBName()
public Enumeration getDetails()
throws DBException
DBException - upon error.
public int getDistinctFieldCount()
throws DBException
DBFields belonging to this
DBObject that are set to distinct.
DBException - upon error.
public String[] getDistinctFields()
throws DBException
This convenience method iterates through all the
fields belonging to this DBObject
returns an array of field names ( String )
that are set to distinct.
If there are are no distinct fields then the method
returns a null reference.
DBException - upon error.getDistinctFieldCount(),
isDistinct()
public String getField(String fieldName)
throws DBException
getField in interface DataObjectfieldName - Name of the field to fetch
DBException - If there is no such field or it's value cannot be accessedprotected String getFieldData(String fieldName)
fieldName - the name of the field to retrieve the data for
public boolean getFieldBoolean(String fieldName)
throws DBException
fieldName - to retrieve
DBException - upon error.
public Date getFieldDate(String fieldName)
throws DBException
fieldName - The field to be retrieved
DBException - If the field does not exist or it's value
is not a date or cannot be converted to a date
public String getFieldDecimalFormatted(String fieldName,
String formatPattern)
throws DBException
fieldName - The field to be retrievedformatPattern - A formatting pattern according to java.text.DecimalFormat.
Leave null for the default format for this locale.
Symbol Meaning
0 a digit
# a digit, zero shows as absent
. placeholder for decimal separator
, placeholder for grouping separator.
E separates mantissa and exponent for exponential formats.
; separates formats.
- default negative prefix.
% multiply by 100 and show as percentage
? multiply by 1000 and show as per mille
� currency sign; replaced by currency symbol; if
doubled, replaced by international currency symbol.
If present in a pattern, the monetary decimal separator
is used instead of the decimal separator.
X any other characters can be used in the prefix or suffix
' used to quote special characters in a prefix or suffix.
DBException - If the field does not exist or it's value
is not a date or cannot be converted to a dateDecimalFormat
public float getFieldFloat(String fieldName)
throws DBException
float value of a field in this object. we use the locale specified
in the properties file directly to determine how to parse the field
fieldName - Name of the field to be retrieved
DBException - If there is no such field or it's value
cannot be converted to a floatsetField(String,double)
public double getFieldDouble(String fieldName)
throws DBException
double value of a field in this object. we use the locale specified
in the properties file directly to determine how to parse the field
fieldName - Name of the field to be retrieved
DBException - If there is no such field or it's value
cannot be converted to a floatsetField(String,double)
public BigDecimal getFieldBigDecimal(String fieldName)
throws DBException
BigDecimal value of a field in this object.
We use the locale specified
in the properties file directly to determine how to parse the field
NB: Corresponds to java.sql.Type.DECIMAL or java.sql.Type.NUMERIC
fieldName - Name of the field to be retrieved
DBException - If there is no such field or it's value
cannot be converted to a BigDecimal
author Peter Pilgrim setField(String,BigDecimal)
public byte getFieldByte(String fieldName)
throws DBException
byte value of a field in this object.
A convenience method for getField
fieldName - Name of a field in this object
DBException - if there is no such field or it's value cannot be
converted to a byte integer.setField(String,byte)
public byte[] getFieldByteArray(String fieldName)
throws DBException
byteArray value of a field in this object.
A convenience method for getField
fieldName - Name of a field in this object
DBException - if there is no such field or it's value cannot be
get to a byte array.setField(String,byte[])
public short getFieldShort(String fieldName)
throws DBException
integer value of a field in this object.
A convenience method for getField
fieldName - Name of a field in this object
DBException - if there is no such field or it's value cannot be
converted to a short integer.setField(String,short)
public int getFieldInt(String fieldName)
throws DBException
integer value of a field in this object.
A convenience method for getField
fieldName - Name of a field in this object
DBException - if there is no such field or it's value cannot be
converted to an integer.setField(String,int),
in order to know if 0 is 'real' or because of an underlying null
public long getFieldLong(String fieldName)
throws DBException
long value of a field in this object.
A convenience method for getField
fieldName - Name of a field in this object
DBException - if there is no such field or it's value cannot be
converted to a long integer.setField(String,long)
public void saveBinaryField(String fieldName,
byte[] incomingData)
throws DBException
fieldName - The name of the field to save.incomingData - the stream to write to the database table.
DBException - upon error
public int getFieldsToRetrieveCount()
throws DBException
DBFields belonging to this
DBObject that are set to retrieve.
DBException - upon error.public long getFoundCount()
public Object[] getFoundKeysArray()
public Object[] getIndexArray()
throws DBException
DBException - upon error.public String getKey()
getKey in interface Cacheable
public Iterator getKeyFieldListIterator()
throws DBException
DBException - If the list cannot be retrieved
public String getLength(String fieldName)
throws DBException
fieldName - The name of the field
DBException - If there is no such field in this object
public int getLengthInt(String fieldName)
throws DBException
fieldName - to check
DBException - upon error.
public String getLookupObject(String fieldName)
throws DBException
fieldName - The fieldname to look up
DBException - If the specified field does not exist.public DBConnection getLocalConnection()
getLocalConnection in class JDBCDataObject
public String getMax(String fieldName,
boolean whereClause)
throws DBException
fieldName - the Fieldname to get the max value for.whereClause - Use a custom whereclause?
DBException - upon error.
public String getMax(String fieldName)
throws DBException
fieldName - The fieldName to check against
DBException - upon error.public int getMaxRecords()
getMaxRecords in interface DataObject
public String getMyKeys()
throws DBException
DBException - If the key list cannot be built.protected Object[] getMyUpdatesArray()
public int getOffsetRecord()
ResultSet.
author Peter Pilgrim, Thu Jun 21 10:30:59 BST 2001
getOffsetRecord in interface DataObjectsetOffsetRecord(int)
public int getPrecision(String fieldName)
throws DBException
fieldName - The fieldname to get the precision for
DBException - upon error.
public String getSerializedForm(DBField theField)
throws DBException
theField - A DBField object
DBException - upon error.
protected DBObject getThisDBObj()
throws DBException
return new MyObject()
if you want greatest efficiency. For example: A DBObject called "Customer" should return a new "Customer" object. the implementation in DBObject uses getClass().newInstance(), which seems to be about 50% slower than "new MyObject()" calls on JDK 1.4 Note that this method should never be called directly. It should only be called by newInstance()
DBException - upon error.getThisDBObj()
public DBObject newInstance()
throws DBException
DBException - upon error.getThisDBObj()
protected void copyAttributes(DBObject returnObj)
throws DBException
returnObj - the object to set the attributes to.
DBException - upon error
public static DBObject getThisDBbj(DataTransferObject dto)
throws DBException
dto - The DataTransferObject
DBException - upon error
public DataTransferObject getDataTransferObject()
throws DBException
DBException - upon error.
public void setDataTransferObject(DataTransferObject dto)
throws DBException
dto - The filled out data transfer object
DBException - upon error.
public String getValidValueDescrip(String fieldName)
throws DBException
fieldName - java.lang.String
DBException - If there is no such field, or the values cannot be retrieved.
public List getValidValuesList(String fieldName)
throws DBException
getValidValuesList in interface DataObjectfieldName - the name of the field to get the valid values list for
DBException - upon error
public Vector getValidValues(String fieldName)
throws DBException
fieldName - The name of the fields for which a value set is requested
DBException - upon error.
public Vector getValues()
throws DBException
getValues in interface LookupInterfaceDBException - upon error.getValidValues(java.lang.String)
protected Vector getValuesDefault(String valueField,
String descripField)
throws DBException
myClassName+".validValues"
The method creates ValidValue object instances and
stores them in the cache.
valueField - java.lang.StringdescripField - java.lang.String
DBException - if a database error occurs
#see #getValuesDefault(String valueField, String descripField, String whereClause)
#see #getISOValuesDefault(String valueField, String descripField)
protected Vector getValuesDefault(String valueField,
String descripField,
String whereClause)
throws DBException
myClassName+".validValues"
The method creates ValidValue object instances and
stores them in the cache.
valueField - java.lang.StringdescripField - java.lang.StringwhereClause - the where clause that will be pass
to setCustomWhereClause.
DBException - if a database error occurs
#see #setCustomWhereClause(String newCustomWhere)
#see #getISOValuesDefault(String valueField, String descripField)
protected Vector getValuesDefault(String valueField,
String descripField,
String whereClause,
String sortKeyString)
throws DBException
myClassName+".validValues"
The method creates ValidValue object instances and
stores them in the cache.
valueField - java.lang.StringdescripField - java.lang.StringwhereClause - the where clause that will be pass
to setCustomWhereClause.sortKeyString - the pipe delimited string of field names with the
optional 'ASC or DESC' keyword afterwords; pass in null to indicate no sorting
DBException - if a database error occurs
#see #setCustomWhereClause(String newCustomWhere)
#see #setSortKey(String sortKeyString)
#see #getISOValuesDefault(String valueField, String descripField)
protected Vector getISOValuesDefault(String valueField,
String descripField)
throws DBException
myClassName+"."+oneLocale.getString()+".validValues".
For example the key cache could be:
"com.acme.test.Fruits.en_gb.validValues" "com.acme.test.Fruits.de_de.validValues" "com.acme.test.Fruits.es_es.validValues"The method creates
ISOValidValue object instances and
stores them in the cache.
valueField - java.lang.StringdescripField - java.lang.String
DBException - if a database error occurs
#see #getValuesDefault(String valueField, String descripField)
protected Vector getISOValuesDefault(String valueField,
String descripField,
String whereClause)
throws DBException
myClassName+"."+oneLocale.getString()+".validValues".
For example the key cache could be:
"com.acme.test.Fruits.en_gb.validValues" "com.acme.test.Fruits.de_de.validValues" "com.acme.test.Fruits.es_es.validValues"The method creates
ISOValidValue object instances and
stores them in the cache.
valueField - java.lang.StringdescripField - java.lang.StringwhereClause - the where clause that will be pass
to setCustomWhereClause.
DBException - if a database error occurs
#see #getValuesDefault(String valueField, String descripField, String whereClause)
protected Vector getISOValuesDefault(String valueField,
String descripField,
String whereClause,
String sortKeyString)
throws DBException
myClassName+"."+oneLocale.getString()+".validValues".
For example the key cache could be:
"com.acme.test.Fruits.en_gb.validValues" "com.acme.test.Fruits.de_de.validValues" "com.acme.test.Fruits.es_es.validValues"The method creates
ISOValidValue object instances and
stores them in the cache.
valueField - java.lang.StringdescripField - java.lang.StringwhereClause - the where clause that will be pass
to setCustomWhereClause.sortKeyString - the pipe delimited string of field names with the
optional 'ASC or DESC' keyword afterwords
DBException - if a database error occurs
#see #getValuesDefault(String valueField, String descripField, String whereClause, String sortKeyString)
public boolean haveAllKeys()
throws DBException
DBException - upon error.
protected void initialize()
throws DBException
DBException - The exception description.public boolean isCached()
public boolean isDistinct()
throws DBException
DBFields belonging
DBObject returns true if any of them are
set a distinct.
author Peter Pilgrim
DBException - upon error.isFieldDistinct(String),
getDistinctFields(),
getDistinctFieldCount()
public boolean isFieldNull(String fieldName)
throws DBException
fieldName - The name of the field to check for isFieldNull()
DBException - if the field doesn't exist for the particular
DBObject.
public boolean isEmpty()
throws DBException
DBException - If the list of fields cannot be traversed
public boolean isFieldDistinct(String fieldName)
throws DBException
fieldName - the name of the field
DBException - If the operation could not be completed
author Peter Pilgrim getDistinctFields(),
getDistinctFieldCount(),
setFieldDistinct(java.lang.String, boolean)
public boolean isFieldsToRetrieve()
throws DBException
DBFields belonging
DBObject returns true if any of them are
between the retrieve fields.
author Yves Henri Amaizo
DBException - upon error.isFieldToRetrieve(String)
public boolean isFieldToRetrieve(String fieldName)
throws DBException
fieldName - the name of the field
DBException - If the operation could not be completed
author Yves Henri Amaizo setFieldsToRetrieve( String )
public boolean isMultiValued(String fieldName)
throws DBException
fieldName - Name of the field
DBException - If there is no such field
public boolean isReadOnly(String fieldName)
throws DBException
fieldName - The field name to check
DBException - Ff there is no such field
public boolean isSecret(String fieldName)
throws DBException
fieldName - The name of the field to check
DBException - If there is no such field.setSecret(String)
public boolean isVirtual(String fieldName)
throws DBException
fieldName - The name of the field to check
DBException - If there is no such fieldaddVirtualField(String, String, int, String)
public double max(String fieldName)
throws DBException
fieldName - String DBObject fieldName to average
DBException - If the search could not be completed
public double min(String fieldName)
throws DBException
fieldName - String DBObject fieldName to average
DBException - If the search could not be completedprotected String noNewLine(String fieldValue)
fieldValue - the Value to strip of newlines
protected String noQuotes(String oldString)
oldString - The original string
protected CacheUtils getCacheUtil()
protected void notifyListeners(String eventCode)
throws DBException
eventCode - The "code" for the event that has just occurred
DBException - If an error occurrs trying to send all of the event notices
public void populateDefaultValues()
throws DBException
The base class implementation does nothing. Override this method in derived classes to achieve your custom behavior.
The calling routine, DBTool.populateTables(), will set dbName on each object, so you can get it from getDataContext(), and you can assume that the user for the population action is Admin.
DBException - Upon add error, never if it isn't overridden.
protected void referredToBy(DBObject refObject,
String foreignKeyNames,
String errorMessage)
throws DBException
This method should by called by subclass delete() methods (which then call super.delete() to handle the actual deletion)
refObject - An instance of the DBObject that refers to usforeignKeyNames - A semicolon-delimited list of foreign
key names from the other objecterrorMessage - The error message to throw if the key is in use
DBException - If it is not possible to register the
given referential constraint
public void removeFromCache(DBObject theDBObj)
throws DBException
theDBObj - com.jcorporate.expresso.core.dbobj.DBObject The object to
be removed
DBException - upon error.public void removeAttribute(String attributeName)
attributeName - The name of the attribute to remove.
public void retrieve()
throws DBException
DBRecordNotFoundException - If the record could not be retrieved.
DBException - [Really DBRecordNotFoundException]find()
public boolean retrieveFromCache()
throws DBException
DBException - upon error.
public void search()
throws DBException
DBException - if unable to retreive records due to a database problem
Modify by Yves Henri AMAIZO
public void search(String sortKeyString)
throws DBException
sortKeyString - A string containing field names,
seperated by pipes, that indicate in what order the objects
are retrieved
DBException - upon error.
public ArrayList searchAndRetrieveList()
throws DBException
searchAndRetrieveList in interface DataObjectDBException - If the search could not be completed
public ArrayList searchAndRetrieveList(String sortKeyString)
throws DBException
searchAndRetrieveList in interface DataObjectsortKeyString - A pipe-delimited list of key fields to sort
the returned set by
DBException - If the search could not be completed
public void setAttribute(String attribName,
Object attribValue)
setAttribute in interface DataObjectattribName - The name of the attribute being definedattribValue - The object to store under this attribute namepublic void setCacheSize()
public void setCharset(String newCharSet)
throws DBException
newCharSet - The name of the characterset that you will filter against.
For Western-Latin character sets use "ISO-8859-1" as the parameter.
Currently, no other charactersets are implemented. DBException - upon error.FilterManager,
Filter,
ISO_8859_1
public boolean getCheckZeroUpdate()
throws DBException
DBException - upon error.getCheckZeroUpdate(),
JDBCConfig.checkZeroUpdate(),
DBConnectionPool.getCheckZeroUpdate()
public void setCheckZeroUpdate(boolean newFlag)
throws DBException
newFlag - True to turn on checking, false to turn it off
DBException - upon error.
public void setConnection(DBConnection newConnection)
throws DBException
setConnection in class JDBCDataObjectnewConnection - The new DBConnection object to be used by this DB Object
DBException - upon error.
public void setConnection(DBConnection newConnection,
String setupTablesContext)
throws DBException
The difference between this and setConnection(DBConnection) is that this is used for using otherDB capabilities within a transaction. So you use a dbconnection from your other pool, but the setup tables are in a different context
setConnection in class JDBCDataObjectnewConnection - The new DBConnection object to be used by this DB ObjectsetupTablesContext - the data context that is used for the expresso setup tables.
DBException - upon error.setConnection(DBConnection)public void setCustomWhereClause(String newCustomWhere)
newCustomWhere - java.lang.String string with clause. Do NOT add 'WHERE' keyword--this is prepended by system, so that multiple calls to append can be made
public void setCustomWhereClause(String newCustomWhere,
boolean append)
newCustomWhere - java.lang.String string with clause. Do NOT add 'WHERE' keyword--this is prepended by system, so that multiple calls to append can be madeappend - if true, custom WHERE clause is appendedpublic String getCustomWhereClause()
protected void setDefaultValue(String fieldName,
String fieldValue)
throws DBException
fieldName - the field to setfieldValue - the default value to set
DBException - upon error.
public void setDescription(String newDescription)
throws DBException
newDescription - A description of this database object
DBException - upon error.
public void setField(String fieldName,
byte fieldValue)
throws DBException
fieldName - The name to setfieldValue - the byte integer field value to set
DBException - upon error.
public void setField(String fieldName,
byte[] fieldValue)
throws DBException
fieldName - The name to setfieldValue - the byte integer field value to set
DBException - upon error.
public void setField(String fieldName,
short fieldValue)
throws DBException
fieldName - The name to setfieldValue - the short integer field value to set
DBException - upon error.
public void setField(String fieldName,
int fieldValue)
throws DBException
fieldName - The name to setfieldValue - the integer field value to set
DBException - upon invalid parameters.
public void setField(String fieldName,
long fieldValue)
throws DBException
setField.
Convenience method to set the field value.
fieldName - The name to setfieldValue - the long integer field value to set
DBException - upon invalid parameters.
public void setField(String fieldName,
double fieldValue)
throws DBException
setField.
Convenience method to set the field values.
fieldName - The name to setfieldValue - the double field value to set
DBException - upon invalid values.
public void setField(String fieldName,
BigDecimal fieldValue)
throws DBException
setField.
Convenience method to set the field values.
fieldName - The name to setfieldValue - the big decimal value to set
DBException - upon error.
public void setField(String fieldName,
boolean fieldValue)
throws DBException
fieldName - The field name to setfieldValue - the new boolean Field Value to set
DBException - upon error.
protected String getBooleanFieldValue(boolean fieldValue)
throws DBException
fieldValue - The target value
DBException - upon error.
public void setField(String fieldName,
String fieldValue)
throws DBException
fieldName - The name of the fieldfieldValue - The value to set the field
DBException - If the given field does not exist in this object or
the value supplied is not allowed for this field
public void setField(String fieldName,
Date fieldValue)
throws DBException
setField.
Convenience method to set the field values.
fieldName - The name to setfieldValue - the Java date value to set
DBException - upon error.
protected void logChange(DBField oneField,
String fieldValue)
oneField - The field to set the data to.fieldValue - The value to set the field to.
protected void setFieldData(String fieldName,
String fieldValue)
fieldName - The name of the field to setfieldValue - the value to set it to.
protected void setFieldData(String fieldName,
byte[] fieldValue)
fieldName - The name of the field to setfieldValue - the value to set it to.
public void setFieldDistinct(String fieldName,
boolean flag)
throws DBException
fieldName - the name of the fieldflag - boolean value true if the field is set distinct.
DBException - If the operation could not be completed
author Peter Pilgrim isFieldDistinct(java.lang.String),
isDistinct()
public void setFieldsToRetrieve(String fieldNames)
throws DBException
fieldNames - contain the name of the fields separate by "|"
DBException - If the operation could not be completed
author Yves Henri Amaizo isFieldsToRetrieve()
public void setKeys(String keyValues)
throws DBException
keyValues - The string containing one value for each key
field in the object
DBException - If the key fields cannot be set
public void setLookupObject(String fieldName,
String objectName)
throws DBException
fieldName - The field name that this lookup is associated withobjectName - The db object used to look up valid values for this field.
DBException - upon error.
public void setLookupField(String fieldName,
String lookupFieldName)
fieldName - the name to set the lookup field value for.lookupFieldName - the field name in the lookup object to map.
protected void setMask(String fieldName,
String newMask)
throws DBException
fieldName - The field name to setnewMask - the regular expression to apply to this field
DBException - upon error.
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 0
protected void setMultiValued(String fieldName)
throws DBException
fieldName - The name of the field to specify as multi-valued
DBException - If the field name given is not valid, or is a virtual field
protected void setName(String theName)
throws DBException
theName - New name for this object
DBException - upon error.
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 void setReadOnly(String fieldName)
throws DBException
Typical uses are for serial-numbered fields and timestamps
fieldName - The name of the field to be reserved as normally read-only.
DBException - If there is no such field.
public void setSchema(Schema schema)
throws DBException
schema - The schema to set
DBException - upon error.
public void setSecret(String fieldName)
throws DBException
fieldName - The name of the field to set as 'secret'
DBException - I fthe field does not exist
public String setStringFilter(String fieldName,
String filterMethod)
throws DBException
fieldName - The name of the field to set a particular filter for.filterMethod - The name of the filter method to use when calling a filter.
Can be one of three values:FilterManager.filterString(java.lang.String, java.lang.Class, java.lang.String) for
more information on this parameter.
DBException - if: fieldName doesn't exist, or filterType String
isn't a valid value.FilterManager,
for a means to set a filter on just an instance
public String getStringFilter(String fieldName)
throws DBException
fieldName - The name of the field to set a particular filter for.
DBException - if: fieldName doesn't exist, or filterType String
isn't a valid value.for a means to get a filter on just an instance,
FilterManager
public void setTargetTable(String theTable)
throws DBException
theTable - Table for this object
DBException - upon error.
public void setTargetDbSchema(String theDbSchema)
throws DBException
theDbSchema - Table for this object
DBException - upon error.
protected void setupFields()
throws DBException
DBException - If there is an error setting up the fields
as requested. For example, if a field allowing null is requested
as part of the key
protected double sqlAggrFunction(String func,
String fieldName)
throws DBException
func - String The SQL aggregate function - must be one of AVG, MIN, MAX, SUMfieldName - String The DBObject fieldName to use for the aggregate function
DBException - If the function could not be completed
Modify by Yves Henri AMAIZO
public double sum(String fieldName)
throws DBException
fieldName - String DBObject fieldName to average
DBException - If the search could not be completed
public void update()
throws DBException
update in interface DataObjectDBException - if the update to the database fails due to
a database errorupdate(boolean)
public void update(boolean updateChangedFieldsOnly)
throws DBException
updateChangedFieldsOnly - if true only modified fields (isChanged = true)
will be included in the update
DBException - if the update to the database fails due to
a database errorpublic String toDebugString()
com.bar.foo.AcmePayroll@1234BABE{
id* => 7, fullname => Peter Pilgrim,
city => country => England }
This is a method is not the standard
toString() because some times a data object used
professionally can have dozens of data fields. We also dont
want to overwhelm you with useless information!
public void updateAll()
throws DBException
DBException - upon error
public void updateAll(boolean oneByOne)
throws DBException
oneByOne - if true the records will be modifed one by one and
will be included in the cache
DBException - if the update to the database fails due to
a database error
public void verify()
throws DBException
DBException - If the validation failspublic boolean equals(Object parm1)
equals in interface DataObjectparm1 - The object to compare to
public DataField getDataField(String fieldName)
throws DBException
getDataField in interface DataObjectfieldName - name of the field to get the object for.
DBException - upon error.
public Object get(String fieldName)
throws DataException
get in interface DataObjectfieldName - the name of the field to get
DataException - upon error.
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.
DataException - upon error.setField(java.lang.String, byte)
public void setDataField(String fieldName,
DataField o)
throws DataException
fieldName - the name of the field to set.o - the object to set the field to... currently should be
java.lang.Strings only.
DataException - upon error.public 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 ContextNestedpublic Map getAllAttributes()
getAllAttributes in interface DataObjectjava.util.Map
public void setStringFiltersOnAll(String filter)
throws DBException
filter - filter to set
DBException - upon errorpublic Class getFilterClass()
DBField.getFilterClass(),
HtmlFilterpublic Class setFilterClass(Class filter)
filter - class which is subclass of Filter
Filter,
DBField.setFilterClass(java.lang.Class)public Filter setFilterClass(Filter filter)
filter - which is subclass of Filter; we will persist only the class name, NOT the instance passed in
for a means to set "permanenent" filters in metadata for all objects of this class,
DBField.setFilterClass(java.lang.Class)public org.apache.log4j.Logger getLogger()
public boolean isChanged()
throws DBException
DBException - upon error.DataField.isChanged()
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||