|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tentackle.db.SimpleDbCursor<T>
org.tentackle.appworx.AppDbCursor<T>
T - the data object classpublic class AppDbCursor<T extends AppDbObject>
Extends SimpleDbCursor for AppDbObjects.
Furthermore, adds warning thresholds, fetchsize,
sleep intervals (be nice to other users)
and a progress dialog if many rows are retrieved.
| Field Summary | |
|---|---|
protected boolean |
abortRequested
user requested to abort the loading of data |
protected ContextDb |
contextDb
database context |
protected int |
estimatedRowCount
expected number of rows retrieved, 0 = unknown (default) |
protected int |
maxRowCount
!= 0 if ask user can't receive more objects |
protected int |
updateFetchCount
for fetch() only: number of rows fetched since progress shown |
protected int |
updateRowCount
if != 0: show user progress in this intervals |
protected int |
warnRowCount
!= 0 if ask user if more objects retrieved |
protected long |
warnSleep
time [ms] to sleep between warnRowCount packets, 0 = no sleep (default) |
| Fields inherited from class org.tentackle.db.SimpleDbCursor |
|---|
db, dbClass, object, rc, rcName, row, rows, rs, withLinkedObjects |
| Constructor Summary | |
|---|---|
AppDbCursor(ContextDb contextDb,
Class<T> dbClass,
ResultSetWrapper rs)
Creates a cursor for a local connection. |
|
AppDbCursor(ContextDb contextDb,
Class<T> dbClass,
ResultSetWrapper rs,
boolean withLinkedObjects)
Creates a cursor for a local connection. |
|
AppDbCursor(ContextDb contextDb,
RemoteDbCursor rc)
Creates a cursor for a remote connection. |
|
AppDbCursor(QbfParameter par,
RemoteDbCursor rc)
Creates a cursor for a remote connection. |
|
| Method Summary | |
|---|---|
void |
applyQbfParameter(QbfParameter par)
Applies the qbf parameter to a local cursor. |
void |
applyQbfParameterLocalOnly(QbfParameter par)
Applies local settings of the qbf parameter to a remote cursor. |
List<T> |
fetch()
Fetches the next objects up to the fetchsize. |
int |
getEstimatedRowCount()
Gets the expected query count. |
int |
getMaxRowCount()
Gets the maximum number of rows to retrieve. |
int |
getWarnRowCount()
Gets the current warning row count. |
long |
getWarnSleep()
Gets the sleep interval. |
boolean |
isAbortRequested()
Gets the abort flag. |
boolean |
next()
Moves the cursor to the next row. |
void |
setAbortRequested(boolean abortRequested)
Sets the abort requestion flag. |
void |
setDbContext(T object)
Sets the db-context for objects retrieved from the remote cursor. |
void |
setEstimatedRowCount(int estimatedRowCount)
Sets the expected query count. |
void |
setMaxRowCount(int maxRowCount)
Sets the maximum number of rows to retrieve. |
void |
setWarnRowCount(int warnRowCount)
Sets the threshold for the number of rows to warn the user in an infodialog and ask him whether more rows should really be retrieved. |
void |
setWarnSleep(long warnSleep)
Sets the sleep interval between two warnRowCount packets retrieved. |
| Methods inherited from class org.tentackle.db.SimpleDbCursor |
|---|
afterLast, beforeFirst, close, deleteObject, deleteObjectAt, finalize, first, getDbClass, getFetchDirection, getFetchSize, getObject, getObjectAt, getRow, getRowCount, isAfterLast, isBeforeFirst, isOpen, isRemote, last, newObject, previous, setFetchDirection, setFetchSize, setRow, toList, toListAndClose, toString, updateDbContext, updateObject, updateObjectAt, updateObjectOnly |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected ContextDb contextDb
protected int warnRowCount
protected int maxRowCount
protected int updateRowCount
protected int updateFetchCount
protected long warnSleep
protected boolean abortRequested
protected int estimatedRowCount
| Constructor Detail |
|---|
public AppDbCursor(ContextDb contextDb,
Class<T> dbClass,
ResultSetWrapper rs,
boolean withLinkedObjects)
contextDb - the db connectiondbClass - the DbObject classrs - the resultsetwithLinkedObjects - true if load linked objects, false otherwise
public AppDbCursor(ContextDb contextDb,
Class<T> dbClass,
ResultSetWrapper rs)
contextDb - the db connectiondbClass - the DbObject classrs - the resultset
public AppDbCursor(ContextDb contextDb,
RemoteDbCursor rc)
contextDb - the db connectionrc - the remote cursor
public AppDbCursor(QbfParameter par,
RemoteDbCursor rc)
par - the qbf parameterrc - the remote cursor| Method Detail |
|---|
public void applyQbfParameterLocalOnly(QbfParameter par)
par - the qbf parameterpublic void applyQbfParameter(QbfParameter par)
par - the qbf parameterpublic void setDbContext(T object)
Overridden to set the contextdb instead of db only.
setDbContext in class SimpleDbCursor<T extends AppDbObject>object - the AppDbObject to set the contextDb for, never nullpublic boolean next()
Overridden to check for warnRowCount and maxRowCount.
next in interface DbCursor<T extends AppDbObject>next in class SimpleDbCursor<T extends AppDbObject>public List<T> fetch()
If the fetchsize is 0 (auto), the method will fall back to toList. After having read the last row the cursor is closed! This saves two roundtrips for remote dbs.
Overridden to check for warnRowCount and maxRowCount.
fetch in interface DbCursor<T extends AppDbObject>fetch in class SimpleDbCursor<T extends AppDbObject>public int getWarnRowCount()
public void setWarnRowCount(int warnRowCount)
warnRowCount - the warnRowCount, 0 to disable the featurepublic int getMaxRowCount()
public void setMaxRowCount(int maxRowCount)
maxRowCount - the maxRowCount, 0 = unlimitedpublic boolean isAbortRequested()
public void setAbortRequested(boolean abortRequested)
AppDbCursorProgressDialog.
abortRequested - true if the query should be aborted asap.public long getWarnSleep()
public void setWarnSleep(long warnSleep)
warnSleep - the interval, 0 to disablepublic void setEstimatedRowCount(int estimatedRowCount)
estimatedRowCount - the expected count, 0 = unknown (default)public int getEstimatedRowCount()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||