|
Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The interface for Row Iterator. A Row Iterator is an iterator over a collection of View rows or Entity rows.
If the user invokes an Entity Association accessor of an Entity going to the many side of the Association, the accessor returns a Row Iterator over Entities.
In the View Row Iterator case, it enables the user to retrieve rows out of the Row Set and work with them.
RowIterator
is the base interface for
.
RowSetIterator
Within a running BC4J application, one can think of the following containership of application objects:
As mentioned earlier RowSetIterator
extends RowIterator
.
The
and
ViewObject
interfaces
extend RowSet
RowIterator
as well. Put differently,
a View Object, Row Set or Row Set Iterator is a Row Iterator.
A RowSet
's implementation of RowIterator
delegates to the internal "default" Row Set Iterator. Thus, a
RowSet
"impersonates" a RowIterator
by
using the default Row Set Iterator. This simplifies programming
much simpler. For example, to get the next row from a Row Set,
the user writes:
RowSet myRowSet; ... Row row = myRowSet.next();
If RowSet
did not implement RowIterator
through the default RowIterator
, he would have had to
write something like:
RowSet myRowSet; ... Row row = myRowSet.findRowSetIterator().next();
Similarly, a ViewObject
's implementation of RowSet
delegates to the internal "default" Row Set, through which the
View Object implements RowIterator
. To retrieve the
next row, one writes:
ViewObject myVO; ... Row row = myVO.next();
instead of:
ViewObject myVO; ... Row row = myVO.findRowSet(). findRowSetIterator( ).next();
BC4J allows the user to create other Row Iterators than the default
one. See
for
details. These additional Row Iterators are referred to as "secondary
iterators."
RowSet.createRowSetIterator(String)
Ranges
For performance and scalability considerations, if a Row Set
contains many rows, it is better to work with a smaller number
of rows at one time. Take a grid (table) UI control for an
example. Even if the Row Set contains 1,000 rows, the grid
may show only 10 rows at a time. RowIterator
supports this "sliding window" of visible rows through its
"range" facility. Row Iterator range allows the user to set
this smaller number of rows (called the "range size") to work
with at a time. When necessary, Row Iterator scrolls to bring
other rows into its range. The default range size is 1.
Row Index
A row can be identified by its index (0-based) in the Row Set. This index is relative to the entire Row Set and is not affected when the range is scrolled. However, it can be affected when a row is deleted before the row. For example, suppose we have a row of index 20. This means the row is the 21-st row in the Row Set. If the user deletes a row at index 10, the row (of index 20) is no longer the 21-st row. Rather it is now the 20-th row. Another aspect that illustrates instability of rowIndex is the same row may appear at a different index, if this ApplicationModule session is passivated and activated. Activation brings in a new collection from the database and that the same row may have moved. For these reasons, this index is not stable and can change. Thus, the user should use care when managing rows through the index.
When a row is within the Row Iterator's range, it can be identified by its index within the range. To differentiate the index (in the Row Set) discussed in the previous paragraph from this index, we refer to the former as the "absolute index" (or the "row index") and the latter as the "range index." The range index is relevant only for those rows that are currently in the range. Note also that as the range scrolls, the range index can change.
In the above example (where the row's absolute index is 20), suppose the range size is 4 and the range is currently positioned at row index 17. Then, the range contains rows of index 17, 18, 19, 20. This makes the row in the example the 4-th row in the range. The row's range index is 3 (range index is 0-based as well). Suppose the user scrolls down this range by 1 row. The range now contains rows of index 18, 19, 20, 21. The row's range index is now 2 as row of index 20 is the 3-rd row in the range.
Currency and Slots
In addition to the range, a Row Iterator supports the concept of
the current row (or the concept of "currency"). It is important
to realize that the current row may be
When a Row Iterator is first opened or created, the currency is
placed on an imaginary "slot" before the first row. This enables
the user to invoke
This imaginary slot also helps in multi-level master-detail View Objects.
When the master is first opened or created, the currency is
placed on the slot before the first row. This prevents the
detail set to be formulated. If the currency were automatically
placed on the first row, the detail would have been executed.
If this detail was master to another Row Set, that detail would
have been executed, etc.
Similar to the slot before the first row, an imaginary slot exists
after the last row of the Row Set. This means the user is allowed
to call
If the user deletes the current row of a Row Iterator, the
currency "moves" to an imaginary slot where the deleted row used
to be. This slot is referred to as the deleted slot. Thus, if
the user calls
For example, the following code block deletes all rows in the
Row Set:
When the Row Iterator's currency is on one of these imaginary
slots, the current row returned by
Iteration Modes
If the user calls
Under the partial last page mode, no attempt is made to populate
the last page. Instead, the range scrolls as if the user kept
scrolling by the range size until the end is reached. The range
will show
With the full last page mode, one cannot expect the pages to remain
stable. When the user reaches the end of Row Set, the page may
adjust itself to scroll less than range_size.
Another difference in behavior between these two modes is when a
row is deleted in the last page. Under the full last page mode,
if the user deletes a row in the range when the range had reached
the end, the range pulls a row from the top (if one exists) to
keep the range full.
For the partial last page mode, no rows are pulled from the top.
If the last row of the page is deleted, the range scrolls up
range_size (paging up).
Calling
Calling
Before moving to the next row,
If the currency is on the last row of the range and
When this method is called, the current row of the iterator
may be outside the range. (Note that the current row does not
have to be within the range.) If so,
If the iterator is just opened or reset (see
If the iterator is at the last row of the Row Set,
When the next row is required, a check is made to see if the row
has already been brought into the collection. If not, the row is fetched from
database. Note that the View Object's fetch mode affects how rows
are fetched from database into the collection. See
If successful, this method designates the next row as the current
row (the currency finally moves).
This method generates events to notify the changes to the iterator.
If scrolling occurs because of conditions described above, a
If the currency is changed, it generates a
Before moving to the previous row,
If the currency is on the first row of the range and
When this method is called, the current row of the iterator
may be outside the range. (Note that the current row does not
have to be within the range.) If so,
If the iterator is just opened or reset (see
If the iterator is at the first row of the Row Set,
If successful, this method designates the previous row as the current
row (the currency finally moves).
This method generates events to notify the changes to the iterator.
If scrolling occurs because of conditions described above, a
If the currency is changed, it generates a
This method checks to see if the currency is not on the first row.
If not, it resets the currency to the imaginary slot before the
first row and then calls
If the currency is on the slot before the first row, it
simply calls
If the currency is already on the first row, nothing happens.
If
This method generates events to notify the changes to the iterator,
e.g.,
Before moving to the last row,
This method retrieves all rows from the Row Set and scrolls (if necessary)
to the last row. If some of these rows have not yet been fetched
from database, it fetches them. The View Object's fetch mode affects how rows
are fetched from database into the collection. See
If successful, this method designates the last row as the current
row.
If
The caller of this method should be aware that it may take a long time
to complete as all rows from the Row Set are fetched.
The number of rows in the range at the completion of this method
is affected by the "iteration mode". See Iteration Modes
above for details.
This method generates events to notify the changes to the iterator.
If scrolling occurs because of conditions described above, a
If the currency is changed, it generates a
After this method, the current slot status will be
It sends a
If the Row Set is forward-only, it returns
Note that this method retrieves all rows from the database then returns
the number of rows in the Row Set collection.
If the key being passed in has the row handle, it uses the row handle
to locate the row. This is a quick operation. (A key returned from
a call to
If the key does not have a row handle, or if the handle look up did
not find the row in the View row cache, it performs a linear search
through the Row Set collection looking for a match. Hence, this method
could take quite a long time to complete.
This method is similar to
However, findByKey() may find the matching Row(s) out of sequence.
When a row is not found in the View row cache, findByKey() issues
a database query. Matching rows are retrieved and appended to the
Row Set collection. For example, suppose the Row Set collection
has 200 rows that qualify in the database. Suppose the user retrieved
only 10 rows (190 not yet retrieved). Suppose, at this time, the user
issues findByKey() that locates the 200-th row (the last row in database
result set). That row is appended to the Row Set collection at the 11-th
spot. Thus, when you use findByKey(), you may see rows out of sequence.
In contrast, getRow() always retrieves rows in sequence.
If the Row Set collection is of any non-trivial size (say over 50), we
would recommend findByKey().
findByKey() allows for partial key (only for View Objects that have
multiple Entity bases). When a partial key is specified, multiple rows
may return. getKey() returns one and only one row (exact match).
When this method is called, underlying entities are created.
After the new entities are created, a new view row is created.
After that
It does not cause the row to be deleted from the database table.
It just removes the row from the row collection. However, once the
row is removed, it cannot be used any more. If you want to
remove the current row from collection and insert it elsewhere,
call
It does not cause the row to be deleted from the database table.
It just removes the row from the row collection.
This method differs from
To do so, call
This method takes effect when the next set of
data is fetched. For an example usage of setRangeSize, see
setRangeStart.
The absolute index is 0-based, and is the row's index relative
to the entire result set.
Note that the index is 0-based. When you call setRangeStart(1),
the range start will be positioned at the second table row.
Another behavior of setRangeStart (and also setRangeSize) is that
it tries to position the range, so as to fill up the range
as much as possible. For example, assume you have View Object vo
focused on a table with four
rows (A, B, C, D), and you execute the following code:
In this case, rows contains the last 3 rows (B, C, D).
When you call setRangeStart(4), it will try to position you
at row 4. Since the index is 0-based, it finds that there
is no row. Since the default range size is 1, it will
position you to the last row (row index 3).
Then, when you call getRangeSize(3), it tries to fill up
the range from the bottom. This is why you get (B,
C, D).
If this View Object has multiple Entity Object bases, the key
need not be specified for all. However, if a key is specified
for n-th Entity Object, and if this Entity Object's
primary key consists of multiple parts, all parts of the key
must be specified.
If not all Entity keys are included, multiple rows may
match the partial key. The
For example, suppose the View Object has
Emp and DeptLocation as its Entity Object bases. Suppose further that
Emp has a one part primary key (employee number) and DeptLocation has a two
part primary key (dept name and location).
The user can make the following call to look for all employees
working in ACCOUNTING's NEW YORK office:
In this example, if you were to include the key for DeptLocation,
you must specify both key parts.
Note that the position of the key must patch the order of the
Entity Object bases and their keys. In the above example,
keyValues[0] is always the employee number. You cannot specify
the employee number in keyValues[1] or keyValues[2].
This method works even on a View Object which has no Entity Object
base. For this to work, however, the ViewObject's key
attribute list must have been set up through a call to
Then, the following code block will retrieve all rows whose
attribute 0 is "PERM" and attribute 2 is 30.
Internally,
If the requested number of rows have been found, the array
returns. Otherwise, a check is made to see if the View Object's
fetch size is unlimited (which is -1, see
Otherwise (the requested number of rows not yet found and
the Row Set has not yet fetched all rows or the fetch size
is not -1), the search continues. We now use the
For a View Object which has no Entity Object base, we
simply skip the step of looking in the Entity Object cache.
Other than that, the logic is applied.
As new rows are retrieved from database they are added to the
Row Set collection. Thus, the user can work with these rows immediately,
e.g., call
This method does not fire any navigation event, nor does it
move the range or the current row. Also, as rows are added to
the Row Set collection, no insertion event fires (as this is
analogous to fetching rows).
See
Copyright © 1997, 2004, Oracle. All rights reserved. null in
certain situations. More on this below... Also, the current row
may or may not fall in the Row Iterator's range. Some methods,
e.g.,
first(), next(), previous(), last()
will scroll
the range, so that the current row falls within the range. Others,
e.g., scroll(), scrollRangeTo()
will not affect the
currency at all.
on a fresh new Row Iterator
and retrieve the first row. For example, the following block of
code will print attribute "Ename" for all employees (it does not
miss the first row):
next()
ApplicationModule myAM;
...
ViewObject myVO = myAM.findViewObject("MyEmpVO");
Row row;
while ((row = myVO.next()) != null)
{
System.out.println("Ename: " + row.getAttribute("Ename"));
}
next()
even when the currency is on the
last row of the Row Set. The currency moves to this
slot beyond the last row. Here, the user can call
to append the row at the end
of the Row Set.
insertRow(Row)
next()
after deleting the current row,
he gets the row next to the deleted row. Similarly,
previous()
returns the row before the deleted row.
ApplicationModule myAM;
...
ViewObject myVO = myAM.findViewObject("MyEmpVO");
Row row;
while ((row = myVO.next()) != null)
{
myVO.removeCurrentRow();
// "row.remove()" would have shown the same result
}
is
getCurrentRow()
null
. A method
returns
a code indicating whether the currency is on one of these imaginary
slots and if so which kind.
getCurrentRowSlot()
RowIterator
supports an "iteration mode" which
controls how the range behaves when it reaches the end of
the Row Set.
, the full last page
mode will scroll just enough to keep the last page as full as possible.
For example, suppose the Row Set has 25 rows and the range size is set
at 4. Under the full last page mode, last()
last()
will scroll
the range to row of index 20, which means the range will have row
21, 22, 23, 24. The range is fully populated with 4 rows.
(number_of_total_rows % range_size)
rows if that number
is not zero. If that number is zero, it shows range_size
rows. In the above example, last()
will show 1 row
of row index 24, since 25 % 4 = 1. As the user pages up and down
the Row Set, the first row in the range will always be a row whose
index is divisible by the range_size. Thus, this mode works
well for Web clients which tend to work with a stable set of pages
of rows.
RowSetIterator
,
RowSet
,
ViewObject
,
NavigatableRowIterator
,
ApplicationModule
Field Summary
static int
ITER_MODE_LAST_PAGE_FULL
ITER_MODE_...
constants describe the iteration
mode for this RowIterator
.
static int
ITER_MODE_LAST_PAGE_PARTIAL
ITER_MODE_...
constants describe the iteration
mode for this RowIterator
.
static int
SLOT_BEFORE_FIRST
SLOT_...
constants describe the current slot
status for this RowIterator
.
static int
SLOT_BEYOND_LAST
SLOT_...
constants describe the current slot
status for this RowIterator
.
static int
SLOT_DELETED
SLOT_...
constants describe the current slot
status for this RowIterator
.
static int
SLOT_VALID
SLOT_...
constants describe the current slot
status for this RowIterator
.
Method Summary
Row
createAndInitRow(AttributeList nvp)
Creates and initializes a new Row object, but does not insert it into
the Row Set.
Key
createKey(AttributeList nvp)
Given a list of name-value pairs, creates a Key object that
matches the key structure for the ViewObject for this RowItertor.
Row
createRow()
Creates a new Row object, but does not insert it into the Row Set.
java.util.Enumeration
enumerateRowsInRange()
Gets an Enumeration
of all rows in the Row Set.
Row[]
findByEntity(int eRowHandle,
int maxNumOfRows)
Finds and returns View rows that use the Entity row, identified by
the Entity row handle, eRowHandle
.
Row[]
findByKey(Key key,
int maxNumOfRows)
Finds and returns View rows that match the specified key.
Row
first()
Gets the first row in the iterator.
Row[]
getAllRowsInRange()
Extracts the rows in the range.
Row
getCurrentRow()
Accesses the current row.
int
getCurrentRowIndex()
Gets the absolute index (not range index) of the current row.
int
getCurrentRowSlot()
Gets the slot status of the current row.
int
getFetchedRowCount()
Counts the number of rows fetched from database into the Row Set collection
up to this point.
int
getIterMode()
Gets the current iteration mode.
int
getRangeIndexOf(Row row)
Get the index of the given row relative to the beginning of the range.
int
getRangeSize()
Gets the size of the Row Set Iterator range.
int
getRangeStart()
Gets the absolute row index of the first row in the Row Set Iterator range.
Row
getRow(Key key)
Locates and returns a row by its unique key.
Row
getRowAtRangeIndex(int index)
Accesses a row through its range index.
int
getRowCount()
Counts the total number of rows in the Row Set.
int
getRowCountInRange()
Gets the size of the Row Set Iterator range.
boolean
hasNext()
Tests for the existence of a row after the current row.
boolean
hasPrevious()
Tests for the existence of a row before the current row.
void
insertRow(Row row)
Inserts a row to the Row Set, before the current row.
void
insertRowAtRangeIndex(int index,
Row row)
Inserts a row to the Row Set at the given range index.
boolean
isRangeAtBottom()
Tests if the Row Set Iterator range is at the end of the result set.
boolean
isRangeAtTop()
Tests if the Row Set Iterator range is at the beginning of the result set.
boolean
isRowValidation()
Gets the validation flag on this iterator.
Row
last()
Gets the last row in the iterator.
Row
next()
Gets the next row in the iterator.
Row
previous()
Gets the previous row in the iterator.
void
removeCurrentRow()
Removes the current Row object from the Row Set.
Row
removeCurrentRowAndRetain()
Removes the current Row object from the collection and retain it for
insertion into another location.
void
removeCurrentRowFromCollection()
Removes the current Row object from the collection.
void
reset()
Moves the currency to the slot before the first row.
int
scrollRange(int amount)
Moves the Row Set Iterator range up or down a given number of rows.
int
scrollRangeTo(Row row,
int index)
Scrolls the range to place a given row at a given range index.
boolean
setCurrentRow(Row row)
Designates a given row as the current row.
boolean
setCurrentRowAtRangeIndex(int index)
Designates a given index as the current row.
void
setIterMode(int mode)
Sets the iteration mode for this Row Iterator.
int
setRangeSize(int size)
Modifies the size of the Row Set Iterator range.
int
setRangeStart(int start)
Moves the Row Set Iterator range.
void
setRowValidation(boolean flag)
Sets the validation flag on this iterator.
Field Detail
SLOT_VALID
public static final int SLOT_VALID
SLOT_...
constants describe the current slot
status for this RowIterator
. For a detailed discussion,
see the above subsection Currency and Slots.
returns one of these constants.
getCurrentRowSlot()
SLOT_VALID
means that the RowIterator
is
currently on a valid row. In this case,
should return a getCurrentRow()
.
Row
SLOT_DELETED
public static final int SLOT_DELETED
SLOT_...
constants describe the current slot
status for this RowIterator
. For a detailed discussion,
see the above subsection Currency and Slots.
returns one of these constants.
getCurrentRowSlot()
SLOT_DELETED
indicates that the user has just
delete the current row. The RowIterator
does not
have a current row and
should
return getCurrentRow()
null
.
returns the row next to the row that
was deleted (if there was the next row).
Calling next()
returns the row before the row that
was deleted (if there was the previous row).
previous()
SLOT_BEFORE_FIRST
public static final int SLOT_BEFORE_FIRST
SLOT_...
constants describe the current slot
status for this RowIterator
. For a detailed discussion,
see the above subsection Currency and Slots.
returns one of these constants.
getCurrentRowSlot()
SLOT_BEFORE_FIRST
indicates that the user has just
opened or reset (see
) this iterator. The
reset()
RowIterator
does not have a current row and
should return getCurrentRow()
null
.
returns the first row in the iterator
if a row exists in the iterator. If the iterator has no row
in it, next()
next()
will return null
and
the current slot status will change to SLOT_BEYOND_LAST.
SLOT_BEYOND_LAST
public static final int SLOT_BEYOND_LAST
SLOT_...
constants describe the current slot
status for this RowIterator
. For a detailed discussion,
see the above subsection Currency and Slots.
returns one of these constants.
getCurrentRowSlot()
SLOT_BEYOND_LAST
indicates that the user has just
gone beyond the last row of the iterator. If the user calls
, followed immediately by last()
, the
currency will be positioned to the imaginary slot after the last
row and the current slot status set to next()
SLOT_BEYOND_LAST
.
If the iterator has no row in it (empty Row Set), and the current
slot status is SLOT_BEYOND_LAST
, calling
will put the currency to the imaginary
slot before the first row, and the current slot status
set to previous()
SLOT_BEFORE_FIRST
.
ITER_MODE_LAST_PAGE_PARTIAL
public static final int ITER_MODE_LAST_PAGE_PARTIAL
ITER_MODE_...
constants describe the iteration
mode for this RowIterator
. For a detailed discussion,
see the above subsection Iteration Modes.
returns one of these constants.
getIterMode()
should pass in one of these constants.
setIterMode(int)
ITER_MODE_LAST_PAGE_PARTIAL
indicates that the iterator
is in the partial last page mode, i.e., the iterator will not try
to keep the range full when it reaches the end of the iterator.
ITER_MODE_LAST_PAGE_FULL
public static final int ITER_MODE_LAST_PAGE_FULL
ITER_MODE_...
constants describe the iteration
mode for this RowIterator
. For a detailed discussion,
see the above subsection Iteration Modes.
returns one of these constants.
getIterMode()
should pass in one of these constants.
setIterMode(int)
ITER_MODE_LAST_PAGE_FULL
indicates that the iterator
is in the full last page mode, i.e., the iterator will try
to keep the range as full as possible when it reaches the end of
the iterator.
Method Detail
next
public Row next()
next()
is called on an iterator whose Row Set has
not yet been
'ed, the
Row Set's query is executed. Thus, the user does not need to call
#oracle.jbo.RowSet.executeQuery()
executeQuery()
himself before calling next()
.
We refer to this as implicit query execution or
implicit Row Set execution.
next()
validates the current row
(if the iterator has a current row) through a call to
.
#oracle.jbo.Row.validate()
next()
is
called, the range is scolled down by one row to bring the next row into
the visible range. In particular, if the range size is 1, next()
scrolls the range down by 1 row.
next()
will
scroll the range, so that the row that will be the current row
at the conclusion of this method will be positioned in the middle
of the range.
),
reset()
next()
will return the first row if one exists.
In this situation, next()
is functionally equivalent
to
.
first()
next()
push the currency into the imaginary slot after the last row.
This will set the current slot status to SLOT_BEYOND_LAST
.
for details.
#oracle.jbo.server.ViewObjectImpl.getFetchMode()
will be sent to
#oracle.jbo.ScrollEvent
.
To pick up such an event, the listener object must implement the
#oracle.jbo.RowSetListener.rangeScrolled(oracle.jbo.ScrollEvent)
interface. Further, this listener
must be registered through a call to
#oracle.jbo.RowSetListener
(the listener object passed in as the parameter to
#oracle.jbo.NavigatableRowIterator.addListener(Object)
addListener
).
and sends it to
#oracle.jbo.NavigationEvent
.
#oracle.jbo.RowSetListener.navigated(oracle.jbo.NavigationEvent)
object, or #oracle.jbo.Row
null
if there is no next row.
ValidationException
- if row validation fails.
previous
public Row previous()
previous()
is called on an iterator whose Row Set has
not yet been
'ed, the
Row Set's query is executed. Thus, the user does not need to call
#oracle.jbo.RowSet.executeQuery()
executeQuery()
himself before calling previous()
.
We refer to this as implicit query execution or
implicit Row Set execution.
previous()
validates the current row
(if the iterator has a current row) through a call to
.
#oracle.jbo.Row.validate()
previous()
is
called, the range is scolled up by one row to bring the previous row into
the visible range. In particular, if the range size is 1, previous()
scrolls the range up by 1 row.
previous()
will
scroll the range, so that the row that will be the current row
at the conclusion of this method will be positioned in the middle
of the range.
),
reset()
previous()
will null
as the currency is
already on the imaginary slot before the first row.
previous()
push the currency into the imaginary slot before the first row.
This will set the current slot status to SLOT_BEFORE_FIRST
.
will be sent to
#oracle.jbo.ScrollEvent
.
To pick up such an event, the listener object must implement the
#oracle.jbo.RowSetListener.rangeScrolled(oracle.jbo.ScrollEvent)
interface. Further, this listener
must be registered through a call to
#oracle.jbo.RowSetListener
(the listener object passed in as the parameter to
#oracle.jbo.NavigatableRowIterator.addListener(Object)
addListener
).
and sends it to
#oracle.jbo.NavigationEvent
.
#oracle.jbo.RowSetListener.navigated(oracle.jbo.NavigationEvent)
object, or #oracle.jbo.Row
null
if there is no previous row.
InvalidOperException
- if the Row Set is marked as forward-only,
as a foward-only Row Set cannot traverse rows backwards.
See
for
more info.
#oracle.jbo.RowSet.setForwardOnly(boolean)
ValidationException
- if row validation fails.
first
public Row first()
first()
is called on an iterator whose Row Set has
not yet been
'ed, the
Row Set's query is executed. Thus, the user does not need to call
#oracle.jbo.RowSet.executeQuery()
executeQuery()
himself before calling first()
.
We refer to this as implicit query execution or
implicit Row Set execution.
. Note that the act of
resetting the currency may cause the range to scroll upward.
next()
next()
. In this case, first()
is equivalent to next()
.
first()
is called on an empty Row Set (a Row Set that
has no row), the currency is set to the slot after the last row, and
null
is returned.
and/or #oracle.jbo.ScrollEvent
.
See #oracle.jbo.NavigationEvent
for details.
next()
object, or #oracle.jbo.Row
null
if there is no first row. In that case (null
return),
the current slot status will be
.
SLOT_BEYOND_LAST
InvalidOperException
- if the Row Set is marked as forward-only
and the currency is neither on the slot before the first
row nor on the first row. This is because a foward-only
Row Set will not permit the range to scroll upward.
See
for
more info.
#oracle.jbo.RowSet.setForwardOnly(boolean)
ValidationException
- if row validation fails.
last
public Row last()
last()
is called on an iterator whose Row Set has
not yet been
'ed, the
Row Set's query is executed. Thus, the user does not need to call
#oracle.jbo.RowSet.executeQuery()
executeQuery()
himself before calling last()
.
We refer to this as implicit query execution or
implicit Row Set execution.
last()
validates the current row
(if the iterator has a current row) through a call to
.
#oracle.jbo.Row.validate()
for details.
#oracle.jbo.server.ViewObjectImpl.getFetchMode()
last()
is called on an empty Row Set, the currency moves
to the slot beyond the last row. The current slot status is set to
.
SLOT_BEYOND_LAST
will be sent to
#oracle.jbo.ScrollEvent
.
To pick up such an event, the listener object must implement the
#oracle.jbo.RowSetListener.rangeScrolled(oracle.jbo.ScrollEvent)
interface. Further, this listener
must be registered through a call to
#oracle.jbo.RowSetListener
(the listener object passed in as the parameter to
#oracle.jbo.NavigatableRowIterator.addListener(Object)
addListener
).
and sends it to
#oracle.jbo.NavigationEvent
.
#oracle.jbo.RowSetListener.navigated(oracle.jbo.NavigationEvent)
object, or #oracle.jbo.Row
null
if there is no last row.
ValidationException
- if row validation fails.
reset
public void reset()
.
A subsequent invocation of SLOT_BEFORE_FIRST
will cause the first
row to become the current row.
next()
to
#oracle.jbo.ScrollEvent
if the currency was not on the first row or on the slot before the first row.
To pick up such an event, the listener object must implement the
#oracle.jbo.RowSetListener.rangeScrolled(oracle.jbo.ScrollEvent)
interface. Further, this listener
must be registered through a call to
#oracle.jbo.RowSetListener
(the listener object passed in as the parameter to
#oracle.jbo.NavigatableRowIterator.addListener(Object)
addListener
).
hasNext
public boolean hasNext()
true
if there is a next row.
Specifically, if the Row Set is empty or if the currency
is on the last row or the slot after the last row
(current slot status ==
),
it returns SLOT_BEYOND_LAST
false
. Otherwise, true
.
hasPrevious
public boolean hasPrevious()
false
.
true
if there is a previous row.
Specifically, if the Row Set is empty or forward-only or
if the currency is on the first row or the slot before the first row
(current slot status ==
),
it returns SLOT_BEFORE_FIRST
false
. Otherwise, true
.
getFetchedRowCount
public int getFetchedRowCount()
getRowCount
public int getRowCount()
getRow
public Row getRow(Key key)
contains the
row handle.)
Row.getKey()
in that both methods return Row(s) that match the given key. However,
the user should understand the differences. First, findByKey() performs
random search. getKey() only performs random search if the key
has the row handle portion and if the row with that handle is currently
in the Row Set collection. Otherwise, getKey() does a linear search.
Hence, findByKey() is generally faster.
findByKey(Key, int)
key
- the key.
getRowAtRangeIndex
public Row getRowAtRangeIndex(int index)
index
- an index in the range: 0
.
to
getRangeSize() - 1null
if the index is out of range.
getCurrentRow
public Row getCurrentRow()
getCurrentRowIndex
public int getCurrentRowIndex()
getCurrentRowSlot
public int getCurrentRowSlot()
SLOT_
.
setCurrentRow
public boolean setCurrentRow(Row row)
row
- the new current row.
true
if the operation succeeded.
createAndInitRow
public Row createAndInitRow(AttributeList nvp)
createRow()
mainly
in that this method allows the user to pass in a list of name-value
pairs with which row attributes are initialized.
nvp
is a named value pair. When building an nvp from
scratch, use NameValuePairs
to build a new nvp.
Here is an example:
NameValuePairs nvp = new NameValuePairs();
nvp.setAttribute("EmpTyp", "C");
Row row = voEmp.createAndInitRow(nvp);
This method is particularly useful when creating a subclass
View Row or Entity Row. You can include polymorphic discriminator
attribute values in nvp
and correct subclass row
object will be created.
ViewRowImpl.create(oracle.jbo.AttributeList)
is called with this nvp
. ViewRowImpl.create(AttributeList)
walks thru the list of entities and calls
EntityImpl.create(AttributeList)
with the same
nvp
for each entity in the view row.
nvp
- a list of name-value pairs.
createRow
public Row createRow()
insertRow
public void insertRow(Row row)
row
- the Row object to be added.
removeCurrentRow
public void removeCurrentRow()
removeCurrentRowFromCollection
public void removeCurrentRowFromCollection()
, change currency
to the desired location, and then call #removeAndRetain()
with that row.
insertRow(oracle.jbo.Row)
removeCurrentRowAndRetain
public Row removeCurrentRowAndRetain()
in that after the current row is removed from the collection, it can be
inserted back into the collection at another location.
removeCurrentRowFromCollection()
,
and get the returning row. Then, change currency to the desired location,
and call removeCurrentRowAndRetain()
with
that row.
insertRow(oracle.jbo.Row)
setRangeSize
public int setRangeSize(int size)
size
- the new number of rows in the iterator range. Size of
0 is treated same as 1. Size < -1 is treated same as -1.
setRangeStart(int)
getRangeSize
public int getRangeSize()
getRangeStart
public int getRangeStart()
setRangeStart
public int setRangeStart(int start)
vo.setRangeStart(4);
vo.setRangeSize(3);
Row[] rows = vo.getAllRowsInRange();
start
- the absolute index of the new first row in the Row Set Iterator range.
scrollRange
public int scrollRange(int amount)
amount
- the number of rows to scroll.
A negative value scrolls upward.
scrollRangeTo
public int scrollRangeTo(Row row,
int index)
row
- the row.index
- the range index at which the row is to be found.
setCurrentRowAtRangeIndex
public boolean setCurrentRowAtRangeIndex(int index)
index
- the index of the new current row.
true
if the operation succeeded.
insertRowAtRangeIndex
public void insertRowAtRangeIndex(int index,
Row row)
index
is
relative to the range, i.e., index
of 0 would mean to insert
before the first row of the range. Allowed values for index
is 0 to range size. If index
equals range size, the row
is inserted right after the last row in the range. This method call does not
alter the current position of the iterator, nor does it affect the range
position.
index
- the point where row
is to be added.row
- the Row object to be added.
getRangeIndexOf
public int getRangeIndexOf(Row row)
row
- a Row object.
or -1
if the row is not in range.
row
,
getRowCountInRange
public int getRowCountInRange()
isRangeAtBottom
public boolean isRangeAtBottom()
true
if the last row of the range is
the last row of the result set.
isRangeAtTop
public boolean isRangeAtTop()
true
if the first row of the range is
the first row of the result set.
enumerateRowsInRange
public java.util.Enumeration enumerateRowsInRange()
Enumeration
of all rows in the Row Set.
Enumeration
interface.
getAllRowsInRange
public Row[] getAllRowsInRange()
setViewSize()
.
findByKey
public Row[] findByKey(Key key,
int maxNumOfRows)
maxNumOfRows
parameter
is used to specify the maximum number of rows to return.
// The key will consist of 3 parts. The first part is
// for the employee number (which is null, meaning not
// specified). The second part is the department name.
// The third is the location.
Object [] keyValues = new Object[3];
keyValues[0] = null; // All employees
keyValues[1] = "ACCOUNTING";
keyValues[4] = "NEW YORK"; // third Entity Object, key part 1
Row[] rows = myAM.findViewObject(new Key(keyValues), -1);
#oracle.jbo.server.ViewObjectImpl.setKeyAttributeDefs(int[])
.
For example, suppose we have a View Object with 5 attributes where
attribute 0 and 2 are to be its key attributes.
// First set up the key attributes
myVO.setKeyAttributeDefs(new int[] { 0, 2 });
// The key will consist of 2 parts. The first part is
// for attribtue 0 and the second is for attribute 2.
Object [] keyValues = new Object[2];
keyValues[0] = "PERM";
keyValues[1] = new Integer(30);
Row[] rows = myAM.findViewObject(new Key(keyValues), -1);
findByKey()
works as follows for
a View Object with Entity Object bases: It takes the first
non-null
entity key from key
.
It uses it to find the Entity row in the cache. If it
finds it, then it looks at all View rows in the Row Set collection
that uses that Entity row and apply the remaining keys to qualify them.
It may or may not find as many rows as requested.
) and
the Row Set has fetched all the rows out of database into its
collection. If this is the case, we return the array
even if the requested number of rows have not been found.
This is because these conditions imply that all rows have
been brought into Row Set collection and no further search is
necessary.
#ViewObject.setMaxFetchSize()
key
build a where-clause for an internal View Object. That
where-clause is applied and qualifying rows are retrieved from
it to find the requested number of rows.
with one
of them. Care is applied to make sure the same row is not added to
the Row Set collection multiple times.
setCurrentRow(Row)
for comparison between this
method and getRow(Key)
getRow(Key)
.
key
- the key to match.maxNumOfRows
- the maximum size of the array to return,
or -1 to return all rows.
createKey
public Key createKey(AttributeList nvp)
findByEntity
public Row[] findByEntity(int eRowHandle,
int maxNumOfRows)
eRowHandle
.
eRowHandle
- the Entity row handle.maxNumOfRows
- the maximum size of the row array to return,
or -1 to return all rows.
setRowValidation
public void setRowValidation(boolean flag)
flag
- Whether to turn row validation off or not.
InvalidOperException
- is thrown if this iterator is
the default iterator of a ViewObject or a RowSet.
isRowValidation
public boolean isRowValidation()
InvalidOperException
- is thrown if this iterator is
the default iterator of a ViewObject or a RowSet.
getIterMode
public int getIterMode()
setIterMode
public void setIterMode(int mode)
mode
- should be ITER_MODE_LAST_PAGE_PARTIAL if the iteration mode is
to be "partial-last-page", ITER_MODE_LAST_PAGE_FULL if it
is to be "full-last-page".
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD