|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1) E10653-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RowSet
A RowSet
belongs to a view object. It manages a collection of view rows. One or more row set iterators may be open on the row set to enumerate through the rows. Row set iterator adds the concept of currency (current row) on top of a row set's collection of rows.
A view object may have many row sets. At the same time, a view object is a row set itself. Internally, for each view object, the default row set is created through which the view object can function as a row set. Other row sets that are not the default row set are referred to as secondary row sets.
Whereas a view object manages the query statement, a row set manages query bind parameter values. Hence, a query statement may contain bind variables ('?' for JDBC style, :1, :2, ... for Oracle style, and :var1, :var2, ... for Oracle name binding style) and multiple row sets may be created with different bind variable values.
For example (using Oracle style binding), given the query statement
SELECT ... FROM EMP WHERE DEPTNO = :1
A row set may be opened with a bind value of 10. Such a row set will contain Employee rows of Department 10. Another row set may create opened through
with a bind value of 20, which would represent Employees of Department 20.ViewObject.createRowSet(String)
ViewObject
, RowSetIterator
Field Summary | |
---|---|
static long |
COPY_OPT_ALL_ROWS A deep copy of the rowset copies all the rows accessible from this RowSet |
static long |
COPY_OPT_LIMIT_RANGE A deep copy copies only rows in the current range of this RowSet . |
static byte |
FORWARD_ONLY Row set access mode constant. |
static byte |
RANGE_PAGING Row set access mode constant. |
static byte |
RANGE_PAGING_AUTO_POST Row set access mode constant. |
static byte |
RANGE_PAGING_INCR |
static byte |
SCROLLABLE Row set access mode constant. |
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 |
Fields inherited from interface oracle.jbo.XMLInterface |
---|
XML_IGNORE_DEPTH_COUNT, XML_OPT_ALL_ROWS, XML_OPT_ASSOC_CONSISTENT, XML_OPT_CHANGES_ONLY, XML_OPT_LIMIT_RANGE |
Method Summary | |
---|---|
boolean |
cancelQuery() Cancels a running query. |
void |
closeRowSet() Closes the row set. |
RowSetIterator |
createRowSetIterator(java.lang.String name) Creates an iterator for the row set. |
RowSet |
deepCopy(java.util.HashMap voAttrMap, long options) This method performs a copy of view rows and the Entity row references of the view rows that belong to this RowSet . |
void |
defineNamedWhereClauseParam(java.lang.String name, java.lang.Object defaultValue, int[] indices) Defines a named bind variable to use with the view object's where-clause. |
void |
executeEmptyRowSet() |
void |
executeQuery() Executes the query. |
RowSetIterator |
findRowSetIterator(java.lang.String rsiName) Gets the named row set iterator that was created at runtime for this row set. |
byte |
getAccessMode() |
ApplicationModule |
getApplicationModule() Gets the row set's application module that contains this row set. |
long |
getCappedRowCount(long cap) |
long |
getDeferredEstimatedRowCount() If this ViewObject is marked to not perform the estimatedRowCount query, then return -1 until either the estimatedRowCount is called and the count is known or the RowSet is fetched completely in which case the actual row count is known. |
long |
getEstimatedRowCount() Counts the number of rows in the collection defined by the view object's query. |
RowSetIterator[] |
getMasterRowSetIterators() Return all controlling masters of this row set. |
java.lang.String |
getName() Gets the row set's name. |
java.lang.Object |
getNamedWhereClauseParam(java.lang.String name) Gets the value of a named where-clause parameter for this row set. |
AttributeList |
getNamedWhereClauseParams() Gets all the Name, value pairs of a named where-clause parameter of the viewObject. |
int |
getRangePagingCacheFactor() |
RowSetIterator[] |
getRowSetIterators() Gets all row set iterators that belong to this row set. |
ViewObject |
getViewObject() Gets the view object that owns this row set. |
java.lang.Object[] |
getWhereClauseParams() Gets the bind variable values to be used with the view object's where-clause. |
boolean |
isAssociationConsistent() Returns the flag indicating whether association-consistent mode is on or not. |
boolean |
isDefaultRowSet() Internal: Applications should not use this method. |
boolean |
isExecuted() Returns true if the current ViewObject's query has been executed for this row set. |
boolean |
isFetchComplete() Tests if the query result set has been fetched to the end. |
boolean |
isForwardOnly() Tests if the row set is constrained to sequential access. |
boolean |
isMaxFetchSizeExceeded() Tests if the query result has been fetched to the end and the end was reached due to hitting the maxFetchSize limit |
boolean |
removeMasterRowSetIterator(RowSetIterator masterRSI) Removes a master row set iterator. |
void |
removeNamedWhereClauseParam(java.lang.String name) Removes a named where-clause parameter. |
void |
setAccessMode(byte mode) Constrains the row access based on the following settings: |
void |
setAssociationConsistent(boolean consistent) Sets the association-consistent flag for this row set. |
void |
setForwardOnly(boolean forwardOnly) Constrains the row set to sequential access. |
boolean |
setMasterRowSetIterator(RowSetIterator masterRSI) Sets the master iterator. |
void |
setNamedWhereClauseParam(java.lang.String name, java.lang.Object value) Sets the value of a named where-clause parameter for this row set. |
void |
setNamedWhereClauseParams(AttributeList attrlist) Sets the value of a named where-clause parameters for the entire viewObject. |
void |
setRangePagingCacheFactor(int f) |
void |
setWhereClauseParam(int index, java.lang.Object value) Specifies a single bind variable value to use with the view object's where-clause. |
void |
setWhereClauseParams(java.lang.Object[] values) Specifies the bind variable values to use with the view object's where-clause. |
void |
skipNamedWhereClauseParam(java.lang.String name) Skips the named where-clause parameter for this row set. |
Methods inherited from interface oracle.jbo.RowSetIterator |
---|
addManagementListener, closeRowSetIterator, createDetailRowSet, getDetailRowSets, getEstimatedRangePageCount, getFilteredRows, getFilteredRowsInRange, getNextRangeSet, getPreviousRangeSet, getRowSet, getSyncLock, isNameGenerated, removeManagementListener, scrollToRangePage |
Methods inherited from interface oracle.jbo.NavigatableRowIterator |
---|
addListener, removeListener |
Methods inherited from interface oracle.jbo.VariableManagerOwnerBase |
---|
ensureVariableManager, getMessageBundleClass, getResourceBundleDef, getVariableManager, hasVariables |
Methods inherited from interface oracle.jbo.Properties |
---|
getProperties, getProperty, getProperty, refreshProperty |
Methods inherited from interface oracle.jbo.XMLInterface |
---|
readXML, readXML, writeXML, writeXML, writeXML, writeXML |
Field Detail |
---|
static final byte SCROLLABLE
This is the most flexible mode for accessing rows and working with a row set. It allows forward and backward access to the all rows.
static final byte FORWARD_ONLY
static final byte RANGE_PAGING
New rows inserted in this mode will be inserted at the beginning of the rowset to maintain their row indices.
If an attempt is made to get a row outside of the range when a new row is inserted or a row is removed in the current range, then an InvalidOperException is raised as the current set of changes needs to be posted to recalculate the right ROWNUM.
static final byte RANGE_PAGING_AUTO_POST
RANGE_PAGING
except that it causes any changes in this transaction to be posted when the user accesses a row out of the current range, i.e., when the ROWNUM query is to be exected to get a different set of rows.
static final byte RANGE_PAGING_INCR
static final long COPY_OPT_ALL_ROWS
RowSet
static final long COPY_OPT_LIMIT_RANGE
RowSet
.
Method Detail |
---|
java.lang.String getName()
getName
in interface RowSetIterator
getName
in interface VariableManagerOwner
boolean isDefaultRowSet()
boolean setMasterRowSetIterator(RowSetIterator masterRSI)
masterRSI
- the new master row set iterator for this row set.true
if the operation succeeded.ViewObject getViewObject()
If this row set is the result of calling a view link accessor, the returned view object is an internal view object.
indicates whether the view object is internal or not. Even if a view link is defined between the master and detail view object, and even if an instance of them are included in the application module's data model, calling the view link by default uses a separate view object instance from the one in the AM's data model. To access the view link accessor's ViewObject, use the following code snippet (assuming that the detail side is called "MyDetail"):ViewObject.isInternal()
RowSet detailRS = (RowSet) masterViewRow.getMyDetail(); ViewObject detailVO = detailRS.getViewObject();
void setWhereClauseParams(java.lang.Object[] values)
Setting the where-clause bind values through this method does not automatically execute the query. You must call
to apply the new bind values.executeQuery()
values
- an array of bind values. If the view object is using the JDBC style bindings ("?"
for bind variable), values[n]
is bound to the bind variable that appears in the n-th order (0 based indexing). If the view object is using the Oracle style bindings (":1", ":2",
etc. for bind variable), values[n]
is bound to the bind variable :(n+1)
, i.e., values[0]
is bound to :1
, values[1]
is bound to :2
, etc.void setNamedWhereClauseParams(AttributeList attrlist)
Setting a named where-clause parameter does not automatically execute the query. You must call
to apply the new bind value.executeQuery()
attrlist
- is a Name, value pair of bind variables.AttributeList getNamedWhereClauseParams()
It uses the method getNamedWhereClauseParam to return all the name,value pairs from VariableValueManager.
InvalidParamException
- if the named variable turns out not to be a where-clause parameter.NoDefException
- if the named where-clause parameter does not exist.void setWhereClauseParam(int index, java.lang.Object value)
Setting the where-clause bind values through this method does not automatically execute the query. You must call
to apply the new bind values.executeQuery()
index
- the index identifying the bind variable. If the view object is using the JDBC style bindings ("?"
for bind variable), value
is bound to the bind variable that appears in the index-th
order (0 based indexing). If the view object is using the Oracle style bindings (":1", ":2",
etc. for bind variable), value
is bound to the bind variable :(index+1)
. If index
is 0, value
is bound to :1
. If index
is 1, value
is bound to :2
.value
- the bind variable value.void defineNamedWhereClauseParam(java.lang.String name, java.lang.Object defaultValue, int[] indices)
This named where-clause parameter will be defined as a variable on the view object. That is, if a named where-clause parameter is defined through one row set, all other row sets that belongs to the same parent view object will "see" that parameter.
Through the defaultValue
, one can specify the default value for this where-clause parameter. If no default value is supplied, null
will be used as the parameter value.
The indices
parameter specifies where-clause parameter indices into which this named parameter will be bound. The same value can be bound into multiple indices. For example, if { 1, 2 }
is specified for indices
, the value will be bound for where-clause parameter indices of 1 and 2. I.e., this parameter will produce setWhereClauseParam(1, value)
and setWhereClauseParam(2, value)
.
This method can be invoked to redefine an existing named where-clause paramter (to change the default value and the indices) only if the named parameter is found on the view object. If the named parameter/variable is found on one of the parent objects, a new where-clause parameter definition is still added to the view object.
When redefining, a check is made to ensure that the existing variable has no kind specification (null
) or is of the "where"
kind (which means that the existing variable is a where-clause parameter). If not, an InvalidParamException
is thrown.
Defining a named where-clause parameter does not automatically execute the query. You must call
to apply the new bind value.executeQuery()
name
- the name of the where-clause parameter.defaultValue
- specifies the default value for this where-clause parameter. This default value can be overridden through a call to setNamedWhereClauseParam()
.indices
- where-clause indices into which this parameter value should be bound. See above.InvalidParamException
- if this method is being called to redefine an old parameter and the variable turns out not to be a where-clause parameter.void removeNamedWhereClauseParam(java.lang.String name)
This method removes previously defined named where-clause parameter. A check is made to ensure that the variable being removed is a where-clause parameter (variable kind = "where"
). If not, an InvalidParamException
is thrown.
If the named where-clause parameter is found but it does not belong to the view object that owns this row set, an InvalidOperException
is thrown. This means one is disallowed from removing a named where-clause parameter that belongs to the View definition, for example.
Removing a named where-clause parameter does not automatically execute the query. You must call
for the removal to take effect.executeQuery()
name
- the name of the where-clause parameter to remove.InvalidParamException
- if the specified variable is not a where-clause parameter.InvalidOperException
- if the specified variable does not belong to the view object that owns this row set.java.lang.Object getNamedWhereClauseParam(java.lang.String name)
If the view object owns multiple row sets, each row set may have its own (different) named where-clause parameter value.
name
- the name of the where-clause parameter.InvalidParamException
- if the named variable turns out not to be a where-clause parameter.NoDefException
- if the named where-clause parameter does not exist.void setNamedWhereClauseParam(java.lang.String name, java.lang.Object value)
If the view object owns multiple row sets, each row set may have its own (different) named where-clause parameter value.
Setting a named where-clause parameter does not automatically execute the query. You must call
to apply the new bind value.executeQuery()
name
- the name of the where-clause parameter.value
- the where-clause parameter value for this row set.InvalidParamException
- if the named variable turns out not to be a where-clause parameter.NoDefException
- if the named where-clause parameter does not exist.void skipNamedWhereClauseParam(java.lang.String name)
Skipping a named where-clause parameter does not automatically execute the query. You must call
for the skip to take effect.executeQuery()
name
- the name of the where-clause parameter.InvalidParamException
- if the named variable turns out not to be a where-clause parameter.NoDefException
- if the named where-clause parameter does not exist.java.lang.Object[] getWhereClauseParams()
void executeQuery()
void executeEmptyRowSet()
boolean cancelQuery()
false
if the JDBC statement is not executing a query.boolean isExecuted()
true
if query has been executed.RowSetIterator createRowSetIterator(java.lang.String name)
name
- the name to be given to the iterator.this
.RowSetIterator[] getRowSetIterators()
RowSetIterator findRowSetIterator(java.lang.String rsiName)
rsiName
- a row set iterator name. If null
, it returns the the row set.null
if the named row set iterator is not not found.boolean removeMasterRowSetIterator(RowSetIterator masterRSI)
masterRSI
- the iterator to be removed.true
if masterRS
was found, false
otherwise.RowSetIterator[] getMasterRowSetIterators()
ApplicationModule getApplicationModule()
Strictly speaking, a row set belongs to a view object and the view object to an application module. This method returns the application module that cotains the view object, which contains this row set.
If this row set is the result of calling a View Link accessor, this row set belongs to an internal view object (see
). Such an internal view object belongs to the root application module. Put differently, if you call this method on a row set which is the result of calling a View Link accessor, it will return the root application module.ViewObject.isInternal()
ApplicationModule
to which this row set belongs.long getEstimatedRowCount()
This method uses a "SELECT COUNT(1) FROM (<query-statement>)" query to obtained the initial count. After that, changes to row count (such as insertion and deletion of rows) is kept up to date.
However, since the row counting query and the query to retrieve actual rows are issued at two different times, it is possible for the accurate count to change between these two points. This is why this method is named getEstimatedRowCount()
.
long getDeferredEstimatedRowCount()
long getCappedRowCount(long cap)
boolean isForwardOnly()
true
if the row set is restricted to forward-only processing.setForwardOnly(boolean)
void setForwardOnly(boolean forwardOnly)
When set to true
, a row preceeding the current row cannot be designated as the new current row. This restriction allows performance to be optimized.
forwardOnly
- true
restricts the row set to forward-only processing, false
otherwise.byte getAccessMode()
setAccessMode(byte)
void setAccessMode(byte mode)
Switching access modes for a rowset will not take effect until the next explicit call to executeQuery. Switching accessmode back to SCROLLABLE from any other mode is not allowed.
mode
- One of the four enumerated values SCROLLABLE
, FORWARD_ONLY
, RANGE_PAGING
, RANGE_PAGING_AUTO_POST
.int getRangePagingCacheFactor()
void setRangePagingCacheFactor(int f)
void setAssociationConsistent(boolean consistent)
Association-consistent mode allows the user to see new rows created/inserted through another view object. Note that this mode is effective only for view objects that are entity based. If the view object has no entity base, this mode has no effect.
Suppose we have an entity named E. Suppose two view objects, V1 and V2 are based on E. (V1 and V2 do not have to come from the same view definition.) Suppose the user creates a new row through V1. This creates an instance of E as well. The new entity row is registered only when its primary key is attribute set. At this time, an event is sent out to all view objects based on E, i.e., V1 and V2.
When V2 receives this event, it enumerates through all its collections (essentially its row sets--strictly speaking its query collections) looking for those whose isAssociationConsistent()
value is true. For each row set whose flag value is true (say R2), it checks to see if it has any view row mapped to the new entity row. If not, it create a new view row and maps it to the new entity row. A rowInserted
event fires.
Thus, from the user's view point, R2 is "seeing" the new row, although the row has not yet been posted to database. Hence, setting this flag to true
enables the user to see new rows before the row is posted/queried when the view object is entity based.
If flag is false or if the view object is not entity based, the user needs to post the new row through
and requery the row set through Transaction.postChanges()
to see the new row.executeQuery()
The default value for this flag can be globally controlled through the jbo.viewlink.consistent
property. Its value can be true
, false
, or DEFAULT
. If the property is not specified, the default value is DEFAULT
. A similar property jbo.assoc.consistent
controls whether the new-row-appearing behavior should be supported for row sets returned from entity association accessor calls. For jbo.assoc.consistent
, supported values are true
or false
.
If the property value is set to true
, all row sets will have true
for its initial isAssociationConsistent()
value. If the property value is set to false
, all row sets will have false
for its initial value. If the property value is set to DEFAULT
(which is the default), the view object will use the following logic to compute its initial isAssociationConsistent()
value: if the view object has multiple entity bases that are updateable, then the initial value is false
. If the view object has a where-clause, then the initial value is false
. Otherwise, it is true.
Once this method is called to set the flag value manually, neither the property setting nor the view object's initial flag value has an effect.
consistent
- indicates whether association-consistency should be on or not.boolean isAssociationConsistent()
true
if un-posted new rows are to appear, false
otherwise. This flag has no effect if the view object is not entity based.setAssociationConsistent(boolean)
void closeRowSet()
closeRowSet
removes this row set from the master row set iterator.boolean isFetchComplete()
true
if the result set has been fetched to the end.boolean isMaxFetchSizeExceeded()
true
if the result set has been fetched to the maxFetchSize limit and there are still more rows in the database.RowSet deepCopy(java.util.HashMap voAttrMap, long options)
RowSet
. To avoid unique key constraint violations, the values of the key attributes are not copied.
voAttrMap
attribute could be used to specify a subset of the attributes that need to be copied. The map consists of name value pairs of the view object name and its attributes.
By including the name of the Accessor in the voAttrMap
as a key, deep copy could be used to copy rows obtained by traversing the view links.
Example 1: Deep copy a OrderLine RowSet copying attributes value of Item ID, Order ID and Description of a OrderLine view row.
voOrderLine = myAM.findViewObject("OrderLine"); attrFilter = new HashMap(); filterAttrDefs = new ArrayList(); filterAttrDefs.add("ItemID"); filterAttrDefs.add("OrderID"); filterAttrDefs.add("Description"); attrFilter.put(voOrderLine.getDefFullName(), (String[]) filterAttrDefs.toArray(new String[filterAttrDefs.size()])); RowSet rsOrderLinesCopy = rsOrderLines.deepCopy(attrFilter, RowSet.COPY_OPT_ALL_ROWS);Row API could be used to set the primary keys on the newly created rows and eventually the transaction commit would insert the rows in the database.
Example 2: Deep copy a set of Orders and their Lines. Copy the Customer attribute from an Order and Item ID, Description from Order Lines.
voOrder = myAM.findViewObject("Order"); voOrderLine = myAM.findViewObject("OrderLine"); attrFilter = new HashMap(); filterAttrDefs = new ArrayList(); filterAttrDefs.add("Customer"); // The name of the Order Line Accessor filterAttrDefs.add("Lines"); attrFilter.put(voOrder.getDefFullName(), (String[]) filterAttrDefs.toArray(new String[filterAttrDefs.size()])); filterAttrDefs = new ArrayList(); filterAttrDefs.add("ItemID"); filterAttrDefs.add("Description"); attrFilter.put(voOrderLine.getDefFullName(), (String[]) filterAttrDefs.toArray(new String[filterAttrDefs.size()])); RowSet rsCopy = rs.deepCopy(attrFilter, RowSet.COPY_OPT_ALL_ROWS);For each Order row in the copied rowset the accessor could be used to get its Order Lines. If there is Cascade update set on the association, setting the Order number on an Order row would update the foreign key in its Order Line rows.
voAttrMap
- a name value pair of a View Object name and an array of its AttributeDef
objects or an array of attribute names. A null
value for this parameter results in copying all the non-key attribute values of this RowSet
. View Links are not traversed for a null
value.options
- valid values are COPY_OPT_ALL_ROWS
and COPY_OPT_LIMIT_RANGE
.RowSet
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1) E10653-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |