|
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 |
java.lang.Object java.util.AbstractCollection java.util.AbstractList java.util.Vector oracle.jbo.ViewCriteria
A list of row criteria for a View Object's WHERE clause.
The lengths of the oracle.jbo.ViewCriteriaRow's
in the list must
all match the number of attributes in the View Object.
The following example of a user-defined function, demoCriteria
uses several methods in the ViewCriteria and
ViewCriteriaRow
classes to create and populate
criteria rows and to demonstrate "query-by-example." The
printViewObject is a helper function that executes the
View Object query and prints the results to the screen.
public static void demoCriteria(ApplicationModule appMod) { // Create and populate criteria rows to support query-by-example. ViewObject empView = appMod.createViewObject("Emp", "mypackage1.EmpView"); ViewCriteria vc = empView.createViewCriteria(); ViewCriteriaRow vcRow = vc.createViewCriteriaRow(); // ViewCriteriaRow attribute name is case-sensitive. // ViewCriteriaRow attribute value requires operator and value. // Note also single-quotes around string value. vcRow.setAttribute("Job", "= 'MANAGER'"); vc.addElement(vcRow); vcRow = vc.createViewCriteriaRow(); vcRow.setAttribute("Sal", "> 2500"); vc.addElement(vcRow); empView.applyViewCriteria(vc); // Multiple rows are OR-ed in WHERE clause. System.out.println("Demo View Criteria"); // Should print employees that are MANAGER or have Sal > 2500 QueryDemo.printViewObject(empView); } public static void printViewObject(ViewObject vo) { // Execute the query, print results to the screen. vo.executeQuery(); // Print the View Object's query System.out.println("Query: " + vo.getQuery()); while (vo.hasNext()) { Row row = vo.next();\ String rowDataStr = ""; // How many attributes (columns) is the View Object using? int numAttrs = vo.getAttributeCount(); // Column numbers start with 0, not 1. for (int columnNo = 0; columnNo < numAttrs; columnNo++) { // See also Row.getAttribute(String name). Object attrData = row.getAttribute(columnNo); rowDataStr += (attrData + "\t"); } System.out.println(rowDataStr); } }
In the above code example, note that the View Object's
must be called to apply this ViewCriteria to the View Object.
ViewObject.applyViewCriteria(oracle.jbo.ViewCriteria)
Field Summary | |
protected com.sun.java.util.collections.ArrayList |
listeners
|
Fields inherited from class java.util.Vector |
capacityIncrement, elementCount, elementData |
Fields inherited from class java.util.AbstractList |
modCount |
Fields inherited from interface oracle.jbo.RowIterator |
ITER_MODE_LAST_PAGE_FULL, ITER_MODE_LAST_PAGE_PARTIAL, SLOT_BEFORE_FIRST, SLOT_BEYOND_LAST, SLOT_DELETED, SLOT_VALID |
Constructor Summary | |
ViewCriteria(StructureDef structureDef)
|
|
ViewCriteria(ViewObject viewObject)
Creates an empty view criteria object. |
Method Summary | |
void |
addListener(java.lang.Object target)
Adds a RowSetListener . |
Row |
createAndInitRow(AttributeList nvp)
Creates 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. |
Row |
createRow()
Creates a new Row object, but does not insert it into the row set. |
ViewCriteriaRow |
createViewCriteriaRow()
Creates a new ViewCriteriaRow for this ViewCriteria. |
java.util.Enumeration |
enumerateRowsInRange()
Gets an Enumeration interface for 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()
Designates the first row of the row set as the current row. |
Row[] |
getAllRowsInRange()
Extracts the rows in the range. |
int |
getAttributeIndexOf(java.lang.String name)
Finds the attribute associated with an attribute name. |
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 currently fetched in the row set. |
int |
getIterMode()
Gets the iteration mode. |
protected com.sun.java.util.collections.ArrayList |
getListenersList()
|
int |
getRangeIndexOf(Row row)
Get the index of the given row relative to the beginning of the range. |
int |
getRangeSize()
Gets the range size. |
int |
getRangeStart()
Gets the absolute index of the first row in the row set range. |
Row |
getRow(Key key)
Accesses a row through a unique key. |
Row |
getRowAtRangeIndex(int index)
Accesses a row through its index in the row set. |
int |
getRowCount()
Counts the total number of rows in the row set. |
int |
getRowCountInRange()
Gets the size of the row set range. |
ViewObject |
getViewObject()
Gets the View Object that owns the view criteria. |
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)
Adds a row to the row set, before the current row. |
void |
insertRowAtRangeIndex(int index,
Row row)
Adds a row to the row set at the given index. |
boolean |
isCriteriaForQuery()
Returns a flag indicating whether the View Criteria is to be included in database query or be used for in memory row filtering. |
boolean |
isRangeAtBottom()
Tests if the row set range is at the end of the result set. |
boolean |
isRangeAtTop()
Tests if the row set range is at the beginning of the result set. |
boolean |
isRowValidation()
Gets the validation flag on this iterator. |
boolean |
isUseAttributeFormatHint()
|
Row |
last()
Designates the last row of the row set as the current row. |
Row |
next()
Steps forward, designating the next row as the current row. |
Row |
previous()
Steps backward, designating the previous row as the current row. |
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 |
removeListener(java.lang.Object target)
Removes a RowSetListener . |
void |
reset()
Clears the "current row" designation and places the iterator in the slot before the first row. |
int |
scrollRange(int amount)
Moves the row set 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 row set index. |
int |
scrollToRangePage(int pageIndex)
This method is a no-op and returns zero. |
void |
setCriteriaForQuery(boolean b)
Sets the flag indicating whether the View Criteria is to be included in database query or be used for in memory row filtering. |
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)
Modifies the iteration mode. |
int |
setRangeSize(int size)
Modifies the size of the row set range. |
int |
setRangeStart(int start)
Moves the row set range. |
void |
setRowValidation(boolean flag)
Sets the validation flag on this iterator. |
void |
setUseAttributeFormatHint(boolean flag)
Turn this flag off to get the 904 and earlier behavior where attribute formatters are not consulated for equality critiera. |
void |
trimNoDataRows()
This method walks through ViewCriteriaRow's in this ViewCriteria and removes those rows that have no data. |
Methods inherited from class java.util.Vector |
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize |
Methods inherited from class java.util.AbstractList |
iterator, listIterator, listIterator |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
iterator, listIterator, listIterator |
Field Detail |
protected com.sun.java.util.collections.ArrayList listeners
Constructor Detail |
public ViewCriteria(ViewObject viewObject)
viewObject
- the owner of this ViewCriteria
.public ViewCriteria(StructureDef structureDef)
Method Detail |
public boolean isCriteriaForQuery()
If true
, when the View Criteria is translated into a
row qualification clause, it will use the name of the database column
to which the attribute is mapped. If false
, the attribute
name is used as is.
If the View Criteria is being used for in memory row filtering,
it should be used in conjunction with RowQualifier. See
for details.
ViewObjectImpl.setRowQualifier(oracle.jbo.server.RowQualifier)
true
) or for in memory row filtering (false
).public void setCriteriaForQuery(boolean b)
If true
, when the View Criteria is translated into a
row qualification clause, it will use the name of the database column
to which the attribute is mapped. If false
, the attribute
name is used as is.
If the View Criteria is being used for in memory row filtering,
it should be used in conjunction with RowQualifier. See
for details.
ViewObjectImpl.setRowQualifier(oracle.jbo.server.RowQualifier)
b
- the flag indicating whether the View Criteria is for database query
(true
) or for in memory row filtering (false
).public ViewObject getViewObject()
ViewObject
that owns this ViewCriteria
.public int getAttributeIndexOf(java.lang.String name)
name
- the attribute name.
public ViewCriteriaRow createViewCriteriaRow()
ViewCriteriaRow
, an array for WHERE clause criteria.ViewCriteriaRow
public Row next()
next
in interface RowIterator
null
if there is no next row.public Row previous()
previous
in interface RowIterator
null
if there is no previous row.public Row first()
first
in interface RowIterator
null
if the row set is empty.public Row last()
last
in interface RowIterator
null
if the row set is empty.public void reset()
A subsequent invocation of next()
will cause the first
row to become the current row.
reset
in interface RowIterator
public boolean hasNext()
hasNext
in interface RowIterator
true
if there is next row.public boolean hasPrevious()
hasPrevious
in interface RowIterator
true
if there is previous row.public int getFetchedRowCount()
getFetchedRowCount
in interface RowIterator
public int getRowCount()
getRowCount
in interface RowIterator
public Row getRowAtRangeIndex(int index)
getRowAtRangeIndex
in interface RowIterator
index
- an integer in the range 0 to
getRangeSize() - 1
.
null
if the index is out of range.public Row getCurrentRow()
getCurrentRow
in interface RowIterator
public int getCurrentRowIndex()
getCurrentRowIndex
in interface RowIterator
public int getCurrentRowSlot()
getCurrentRowSlot
in interface RowIterator
SLOT_
.
See SLOT_
constants in RowIterator
.public boolean setCurrentRow(Row row)
setCurrentRow
in interface RowIterator
row
- the new current row.
true
if the operation succeeded.public Row createAndInitRow(AttributeList nvp)
ViewCriteria
, this method works just like
createRow()
.
createAndInitRow
in interface RowIterator
nvp
- not used.
public Row createRow()
createRow
in interface RowIterator
public void insertRow(Row row)
insertRow
in interface RowIterator
row
- the Row object to be added.public void removeCurrentRow()
removeCurrentRow
in interface RowIterator
public void removeCurrentRowFromCollection()
RowIterator
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
, change currency
to the desired location, and then call #removeAndRetain()
with that row.
RowIterator.insertRow(oracle.jbo.Row)
removeCurrentRowFromCollection
in interface RowIterator
public Row removeCurrentRowAndRetain()
RowIterator
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
in that after the current row is removed from the collection, it can be
inserted back into the collection at another location.
RowIterator.removeCurrentRowFromCollection()
To do so, call
,
and get the returning row. Then, change currency to the desired location,
and call RowIterator.removeCurrentRowAndRetain()
with
that row.
RowIterator.insertRow(oracle.jbo.Row)
removeCurrentRowAndRetain
in interface RowIterator
public int setRangeSize(int size)
This method is a no-op for ViewCriteria. For a ViweCriteria, the range size is always -1.
setRangeSize
in interface RowIterator
size
- this parameter is not used.
-1
, which means that the range contains all rows.RowIterator.setRangeStart(int)
public int getRangeSize()
getRangeSize
in interface RowIterator
-1
, which means that the range contains all rows.public int getRangeStart()
The absolute index is 0-based, and is the row's index relative to the entire result set.
getRangeStart
in interface RowIterator
public int setRangeStart(int start)
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:
vo.setRangeStart(4); vo.setRangeSize(3); Row[] rows = vo.getAllRowsInRange();
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).
setRangeStart
in interface RowIterator
start
- the absolute index of the new first row in the row set range.public int scrollRange(int amount)
scrollRange
in interface RowIterator
amount
- the number of rows to scroll.
A negative value scrolls upward.
public int scrollToRangePage(int pageIndex)
public int scrollRangeTo(Row row, int index)
scrollRangeTo
in interface RowIterator
row
- the row.index
- the row's new index.
public boolean setCurrentRowAtRangeIndex(int index)
setCurrentRowAtRangeIndex
in interface RowIterator
index
- the index of the new current row.
true
if the operation succeeded.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.
insertRowAtRangeIndex
in interface RowIterator
index
- the point where row
is to be added.row
- the Row object to be added.public int getRangeIndexOf(Row row)
getRangeIndexOf
in interface RowIterator
row
- a Row object.
or -1
if the row is not in range.
row
(0 based).public int getRowCountInRange()
getRowCountInRange
in interface RowIterator
public boolean isRangeAtBottom()
isRangeAtBottom
in interface RowIterator
true
if the last row of the range is
the last row of the result set.public boolean isRangeAtTop()
isRangeAtTop
in interface RowIterator
true
if the first row of the range is
the first row of the result set.public java.util.Enumeration enumerateRowsInRange()
Enumeration
interface for the row set.
enumerateRowsInRange
in interface RowIterator
Enumeration
interface.public Row[] getAllRowsInRange()
getAllRowsInRange
in interface RowIterator
setViewSize()
.public Row getRow(Key key)
This operation is not supported by ViewCriteria. Calling this method
will throw InvalidOperException
.
getRow
in interface RowIterator
key
- a key.
InvalidOperException
- is thrown. ViewCriteria
does not support this operation.public Row[] findByKey(Key key, int maxNumOfRows)
This operation is not supported by ViewCriteria. Calling this method
will throw InvalidOperException
.
findByKey
in interface RowIterator
key
- the key to match.maxNumOfRows
- the maximum size of the array to return,
or -1 to return all rows.
InvalidOperException
- is thrown. ViewCriteria
does not support this operation.public Key createKey(AttributeList nvp)
This operation is not supported by ViewCriteria. Calling this method
will throw InvalidOperException
.
createKey
in interface RowIterator
nvp
- the name value pair array.
InvalidOperException
- is thrown. ViewCriteria
does not support this operation.public Row[] findByEntity(int eRowHandle, int maxNumOfRows)
eRowHandle
.
This operation is not supported by ViewCriteria. Calling this method
will throw InvalidOperException
.
findByEntity
in interface RowIterator
eRowHandle
- the entity row handle.maxNumOfRows
- the maximum size of the row array to return,
or -1 to return all rows.
InvalidOperException
- is thrown. ViewCriteria
does not support this operation.public void setRowValidation(boolean flag)
This operation is not supported by ViewCriteria. Calling this method
will throw InvalidOperException
.
setRowValidation
in interface RowIterator
flag
- whether to turn row validation off or not.
InvalidOperException
- is thrown. ViewCriteria
does not support this operation.public boolean isRowValidation()
RowIterator
isRowValidation
in interface RowIterator
public int getIterMode()
As ViewCriteria always works with full range (range size -1), iteration mode is meaningless.
getIterMode
in interface RowIterator
RowIterator.ITER_MODE_LAST_PAGE_FULL
.public void setIterMode(int mode)
This method is a no-op for ViewCriteria. For a ViweCriteria, the range size is always -1, and thus iteration mode is meaningless.
setIterMode
in interface RowIterator
mode
- this parameter is not used.protected com.sun.java.util.collections.ArrayList getListenersList()
public void addListener(java.lang.Object target)
RowSetListener
.
addListener
in interface NavigatableRowIterator
target
- the subscriber to be added. It should implement
RowSetListener
.public void removeListener(java.lang.Object target)
RowSetListener
.
removeListener
in interface NavigatableRowIterator
target
- the subscriber to be removed.public void trimNoDataRows()
public void setUseAttributeFormatHint(boolean flag)
public boolean isUseAttributeFormatHint()
|
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 |
Copyright © 1997, 2004, Oracle. All rights reserved.