|
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
com.jcorporate.expresso.core.dbobj.SecuredDBObject
com.jcorporate.expresso.core.dbobj.DBSequence
DBSequence is a special DBObject that wraps a database sequence. Currently, this class only works with PostgreSQL sequences, but it should be easy to add support for Oracle or others (see createTable() and retrieve() methods specifically). If you attempt to use this with a database other than PostgreSQL, it will throw an exception.
To make this compatible with the the schema autocreation of DBObjects magic, security scheme, etc., this class subclasses DBObject. But there are many methods that have been overriden, because they do not make sense for a sequence (ex: search, clear, etc). If these methods are called, an exception is thrown. To get the next value in the sequence, call getNext(). make sure that you override the setupFields() method and supply the proper setup parameters. ex: super.setupFields() //Always! setTargetTable("SomeSequence"); setDescription("Some example Database Sequence"); this.setIncrement(new Integer(1)); // set the increment for the sequence this.setMinValue(new Integer(1)); // set the min value this.setMaxValue(new Integer(1000)); //set the max value (optional) this.setStart(new Integer(1)); //set the start value (optional)
| Nested Class Summary |
| Nested classes inherited from class com.jcorporate.expresso.core.dbobj.DBObject |
DBObject.FieldError, DBObject.FieldUpdate |
| Field Summary |
| Fields inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject |
ADD, ALL_FUNCTIONS, CACHE_NAME, CACHE_TTY, DELETE, SEARCH, SYSTEM_ACCOUNT, SYSTEM_ACCOUNT_NAME, UPDATE |
| Fields inherited from class com.jcorporate.expresso.core.dbobj.DBObject |
ATTRIBUTE_ERROR, ATTRIBUTE_ERROR_MESSAGE, ATTRIBUTE_PAGE_LIMIT, BIG_DECIMAL_ZERO, EMAIL_MASK, EVENT_ADD, EVENT_DELETE, EVENT_UPDATE, FLOAT_MASK, INT_MASK, IS_CHECK_RELATIONAL_INTEGRITY, UPDATE_CHANGED_ONLY, 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 | |
DBSequence()
DBSequence constructor comment. |
|
DBSequence(DBConnection theConnection)
Creation date: (4/7/00 2:45:10 PM) |
|
DBSequence(int uid)
|
|
| Method Summary | |
void |
add()
If the user is allowed to add, invoke the superclass add |
void |
clear()
Set all fields to empty value & clear the last result set & clear sort keys and customWhereClause |
void |
createTable()
Create the sequence in the database. |
void |
delete()
Delete a record from the target table |
boolean |
find()
Just like retrieve, but works with any fields, not just the key field. |
long |
getNext()
|
abstract DBObject |
getThisDBObj()
NOTE: Subclass must override. |
void |
retrieve()
Get a particular record from the database into this object's fields Assumes that the key fields are set to the key of the object to be retrieved |
void |
search()
Find a set of keys of all of the objects that match the current search critieria in the fields Assumes that the fields are populated with search criteria instead of data NOTE: Criteria in 'text' type colums is ignored (SQL Server limitation) |
Vector |
searchAndRetrieve()
|
Vector |
searchAndRetrieve(String sortKeyString)
|
void |
setIncrement(Integer I)
Size of the increment step (defaults to 1 usually in most DB's). |
void |
setMaxValue(Integer I)
Maximum value for the sequence. |
void |
setMinValue(Integer I)
Minumum value for the sequence when created |
void |
setStart(Integer I)
Where the sequence starts |
protected void |
setupFields()
make sure that you override the setupFields() method and supply the proper setup parameters. |
void |
update()
Not allowed... |
void |
verify()
Does nothing...I am not sure what do to verify a sequence. |
| Methods inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject |
canRequesterAdd, canRequesterDelete, canRequesterRead, canRequesterUpdate, checkAllowed, copyAttributes, count, createSecurityCache, deleteAll, getRequestingUid, getString, getString, getString, getString, getString, getString, getSystemUid, instantiate, isAllowed, searchAndRetrieveList, searchAndRetrieveList, setRequestingUid |
| 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 |
| Constructor Detail |
public DBSequence()
throws DBException
DBException - The exception description.
public DBSequence(DBConnection theConnection)
throws DBException
theConnection - com.jcorporate.expresso.core.db.DBConnection
public DBSequence(int uid)
throws DBException
| Method Detail |
public void add()
throws DBException
SecuredDBObject
add in interface DataObjectadd in class SecuredDBObjectDBException
public void clear()
throws DBException
DBObject
clear in interface DataObjectclear in class DBObjectDBException - The exception description.
public void createTable()
throws DBException
DBException
public void delete()
throws DBException
SecuredDBObject
delete in interface DataObjectdelete in class SecuredDBObjectDBException - The exception description.
public boolean find()
throws DBException
SecuredDBObject
find in interface DataObjectfind in class SecuredDBObjectDBException - The exception description.
public long getNext()
throws DBException
DBException
public abstract DBObject getThisDBObj()
throws DBException
getThisDBObj in class DBObjectDBException - upon error.DBObject.getThisDBObj()
public void retrieve()
throws DBException
SecuredDBObject
retrieve in class SecuredDBObjectDBException - The exception description.
public void search()
throws DBException
SecuredDBObject
search in class SecuredDBObjectDBException - The exception description.
public Vector searchAndRetrieve()
throws DBException
DBException - The exception description.
public Vector searchAndRetrieve(String sortKeyString)
throws DBException
sortKeyString - java.lang.String
DBException - The exception description.public void setIncrement(Integer I)
I - java.lang.Integerpublic void setMaxValue(Integer I)
I - java.lang.Integerpublic void setMinValue(Integer I)
I - java.lang.Integerpublic void setStart(Integer I)
I - java.lang.Integer
protected void setupFields()
throws DBException
setupFields in class DBObjectDBException - 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
public void update()
throws DBException
update in interface DataObjectupdate in class SecuredDBObjectDBException - The exception description.
public void verify()
throws DBException
verify in class DBObjectDBException - If the validation fails
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||