|
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 oracle.jbo.common.NamedObjectImpl oracle.jbo.server.NamedObjectImpl oracle.jbo.server.ComponentObjectImpl oracle.jbo.server.ViewObjectImpl
The implementation of the
ViewObject
interface, the middle-tier class that manages
database queries and the view rows that result from executing queries.
A View Object manages a view row set (ViewRowSetImpl
).
When the application calls a
RowSet
method on a View Object, the call is delegated to the
its view row set, which performs the actual operation.
A View Object's base definition is provided by a View Definition object, which is built from the meta-data stored in an XML file. The View Object inherits many of its definitions from its View Definition, but applications can override them in instances.
A View Object persists until it, or the Application Module from which it was created, is explicitly deleted (using remove methods). You can use a given View Object definition more than once within an Application Module; the Business Component framework uses View instance names to distinguish between them.
ViewObject
,
RowSet
,
ViewRowSetImpl
Field Summary | |
protected static java.lang.String |
DATA_ROWKEYTAG
|
static byte |
FETCH_ALL
A fetch mode that causes all rows to be retrieved from a JDBC result set immediately, and then closes the result set. |
static byte |
FETCH_AS_NEEDED
A fetch mode that causes rows to be retrieved from a JDBC result set as the user navigates through the row set. |
static byte |
FETCH_DEFAULT
A fetch mode that indicates that the default mode to be used. |
static int |
FULLSQL_MODE_AUGMENTATION
A full SQL mode that indicates that ViewObject level query augmentation (where-clause, order-by-clause) will be added to the query specified through a call to setQuery() . |
static int |
FULLSQL_MODE_NO_AUGMENTATION
A full SQL mode that indicates that no ViewObject level query augmentation (where-clause, order-by-clause) will be added to the query specified through a call to setQuery() . |
protected java.lang.String |
mAssocClause
|
protected java.lang.String |
mAssocFromClause
|
protected com.sun.java.util.collections.ArrayList |
mAssocRefs
|
protected ViewAttributeDefImpl[] |
mAttrDefs
|
protected com.sun.java.util.collections.HashMap |
mAttrDefsForExtendedVOs
|
protected com.sun.java.util.collections.HashMap |
mAttrDefsTab
|
protected boolean |
mAutoPostChanges
|
protected int[] |
mChangedAttrIndices
|
protected int |
mChgAttrIndUseCount
|
static int |
mDefaultMaxActiveNodes
|
static int |
mDefaultMaxRowsPerNode
|
static int |
MIN_ACTIVE_NODES
|
static int |
MIN_ROWS_PER_NODE
|
protected ViewAttributeDefImpl[] |
mKeyAttrRefs
|
protected java.lang.String |
mOptimizerHint
|
protected java.lang.String |
mOrderBy
|
static boolean |
mUsePersColl
The meaning of this static field has changed. |
protected java.lang.String |
mUserDefinedQuery
|
protected ViewDefImpl |
mViewDef
|
protected ViewRowSetImpl |
mViewRowSet
|
protected java.lang.String |
mWhere
|
protected static java.lang.String |
NEW_ROW_HANDLE
|
protected static java.lang.String |
NEW_ROW_INDEX
|
protected static java.lang.String |
NEW_ROW_TRACKER
|
protected static java.lang.String |
QC_TAG
|
protected static java.lang.String |
TRANSIENT_DATA_ROWTAG
|
static java.lang.String |
XML_ELEM_PASSIVATE_TRANSIENT
|
Fields inherited from class oracle.jbo.common.NamedObjectImpl |
mFullName, mObjName, mParent, mProperties |
Fields inherited from interface oracle.jbo.RowSet |
FORWARD_ONLY, RANGE_PAGING, RANGE_PAGING_AUTO_POST, SCROLLABLE |
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 |
Constructor Summary | |
ViewObjectImpl()
Constructs a new View Object. |
|
ViewObjectImpl(java.lang.String name,
ViewDefImpl voDef)
Constructs a new View Object. |
Method Summary | |
protected ViewRowImpl |
activateCurrentRow(ViewRowSetIteratorImpl vrsi,
ViewRowSetImpl vrs,
Key key)
Override this to provide custom current row lookup. |
void |
activateIteratorState(Element node,
boolean clearIteratorState)
Internal: Applications should not use this method. |
protected void |
activateNewRowTracker(Element parent)
Deprecated. since 9.0.3.3 |
protected void |
activateNewRowTracker(ViewRowSetImpl vrs,
Element parent)
Advanced Internal method only. |
protected void |
activateState(Element parent)
Allows subclasses to retrieve custom data from an XML-node under the given parent element. |
protected void |
activateState(ViewRowImpl currentRow,
Element parent)
Deprecated. since 9.0.3.3 use activateState(ViewRowSetImpl vrs...) |
protected void |
activateState(ViewRowSetImpl vrs,
ViewRowImpl currentRow,
Element parent)
Deprecated. since 9.0.3.3 use activateState(ViewRowSetImpl vrs...) |
protected void |
activateTransientAttribute(ViewRowImpl row,
Node transRow,
AttributeDefImpl ad)
Override this method if activation of a transient attribute needs to also set/populate/ calculate some dependent attributes. |
protected void |
activateTransients(AttributeDefImpl[] attrs,
Element parent)
Deprecated. since 9.0.3.3 use activateTransients with ViewRowSetImpl |
protected void |
activateTransients(ViewRowSetImpl vrs,
AttributeDefImpl[] attrs,
Element parent)
ReStores the attributes from the given array for either just the current row or all the rows in the given ViewRowSet into the given parent xml node. |
AttributeDef |
addDynamicAttribute(java.lang.String attrName)
Adds a dynamic attribute to this View Object. |
void |
addListener(java.lang.Object listener)
Registers an event listener with this View Object. |
void |
addManagementListener(RowSetManagementListener listener)
Adds a subscriber (listener) to be notified of RowSetManagementListener
events generated by this Row Set Iterator. |
void |
addOrderByClause(java.lang.String expr)
Appends an expession to the query's ORDER BY clause. |
protected void |
addRowSet(ViewRowSetImpl rs)
|
protected boolean |
addViewCriteriaToWhereClause()
|
protected void |
addViewLink(ViewLinkImpl viewLink,
boolean isReversed)
|
void |
addWhereClause(java.lang.String expr)
Appends an additional WHERE clause to the query. |
void |
afterCommit(TransactionEvent event)
Handles events raised after a transaction has been committed. |
protected void |
afterEntityRemove(Entity srow)
Notification handler called after an entity row is removed. |
void |
afterRemove(TransactionEvent event)
Handles events raised after rows have been removed. |
void |
afterRollback(TransactionEvent event)
Handles events raised after a transaction has been rolled back. |
protected void |
appendXMLElementNodes(oracle.jbo.server.RowSetImpl rs,
Document xmlDoc,
Node voNode,
int depthCount,
long options)
Calls RowImpl.getXMLElementNodes to append row nodes to the given parent View Object node (voNode). |
protected void |
appendXMLElementNodes(oracle.jbo.server.RowSetImpl rs,
Document xmlDoc,
Node voNode,
int depthCount,
long options,
com.sun.java.util.collections.HashMap voAttrMap)
Calls RowImpl.getXMLElementNodes to append row nodes to the given parent View Object node (voNode). |
void |
applyViewCriteria(ViewCriteria criteria)
Applies the view criteria to this View Object. |
void |
beforeCommit(TransactionEvent e)
Handles events raised before a transaction is committed. |
protected void |
beforeEntityRemove(Entity entity)
Notification handler called before an entity row is removed. |
void |
beforeRollback(TransactionEvent e)
Handles events raised before a transaction is rolled back. |
protected void |
bindRangePagingParams(java.sql.PreparedStatement stmt,
int noUserParams,
int rangeStart,
int rangeSize)
If Applications override buildRangePaging() method to create a custom/wrapped query, they may also override this method to bind any/extra parameters that they add to the query. |
protected java.lang.String |
buildFromClause()
|
protected RowFilter |
buildNewCollection(java.lang.Object[] newParamValues)
|
protected boolean |
buildOrderByClause(java.lang.StringBuffer sqlBuffer,
java.lang.String defOrderByClause)
Builds the order-by-clause part of the query and adds it into the string buffer. |
protected RowFilter[] |
buildQualifyingRowFilters(java.lang.Object[] newParamValues)
|
protected java.lang.String |
buildQuery(int noUserParams,
boolean forRowCount)
|
protected java.lang.String |
buildRangePagingQuery(java.lang.String qry,
int noUserParams)
Applications may use this method to wrap this ViewObject query with rownum query or other mechanism to fetch rows in the current range. |
protected RowFilter |
buildRowFilter(java.lang.Object[] paramValues)
|
protected boolean |
buildWhereClause(java.lang.StringBuffer sqlBuffer,
int noUserParams)
Builds the WHERE clause part of the query and adds it into the string buffer. |
protected boolean |
checkPassivateViewAttributes()
Applications should override this method to indicate if all View Attribute (Transient, SQLDerived or Dynamic) needs to be passivated when this ViewObject is passivated. |
void |
clearCache()
Clears the View Object cache. |
void |
closeFreedStatements()
|
void |
closeRowSet()
Closes the Row Set. |
void |
closeRowSetIterator()
Closes this row set iterator. |
Row |
createAndInitRow(AttributeList initVals)
Creates and initializes a new Row object, but does not insert it into the Row Set. |
RowSet |
createDetailRowSet(java.lang.String rsName,
java.lang.String linkDefName)
Creates a detail Row Set. |
ViewRowImpl |
createInstance(ViewRowSetImpl viewRowSet,
AttributeList attrValList)
Creates a view row instance. |
ViewRowImpl |
createInstanceFromResultSet(QueryCollection qc,
java.sql.ResultSet resultSet)
Internal: Applications should not use this method. |
Key |
createKey(AttributeList nvp)
Given a set of attribute values (name-value pairs), creates a key object for this ViewObject. |
protected ViewRowImpl |
createNewRowForCollection(java.lang.Object qc)
|
Row |
createRow()
Creates a new view row. |
protected ViewRowImpl |
createRowFromResultSet(java.lang.Object qc,
java.sql.ResultSet resultSet)
|
RowSet |
createRowSet(java.lang.String name)
Creates and returns a new (secondary) row set for this View Object. |
RowSetIterator |
createRowSetIterator(java.lang.String name)
Creates and returns a new (secondary) row set iterator for this row set. |
ViewCriteria |
createViewCriteria()
Creates a new view criteria object for this View Object. |
protected ViewRowSetImpl |
createViewLinkAccessorRS(AssociationDefImpl assocDef,
ViewObjectImpl accessorVO,
Row masterRow,
java.lang.Object[] values)
|
protected ViewObjectImpl |
createViewLinkAccessorVO(AssociationDefImpl assocDef,
java.lang.String voName,
ViewDefImpl vDef,
ViewLinkDefImpl vlDef)
|
java.lang.String |
createXMLDefinition(int depthCount)
Creates a DTD definition for the View Object and all its contents (including contained RowSets if depthCount is non-zero). |
boolean |
doesRowFilterMatch(Row[] masterRows,
java.lang.Object[] rowFilterValues)
|
void |
dumpQCs()
Internal: Applications should not use this method. |
java.util.Enumeration |
enumerateRowsInRange()
Creates and returns an enumerator of the rows in the range. |
java.lang.Object[] |
executeDetailQuery(Row[] masterRows)
|
void |
executeEmptyRowSet()
|
void |
executeQuery()
Executes the query. |
protected void |
executeQueryForCollection(java.lang.Object qc,
java.lang.Object[] params,
int noUserParams)
This method is invoked right before the row set executes the query. |
void |
findAndSetCurrentRowByKey(Key key,
int rangeIndex)
|
AttributeDef |
findAttributeDef(java.lang.String name)
Finds a named attribute definition. |
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[] |
findByKey(Key key,
int maxNumOfRows,
boolean skipWhere)
|
Row |
findRowInQCs(java.lang.Object[] rowFilterValues,
Key key,
java.lang.Object rowHandle)
Internal: Applications should not use this method. |
RowSet |
findRowSet(java.lang.String rsName)
Gets the named Row Set that was created at runtime for this View Object. |
RowSetIterator |
findRowSetIterator(java.lang.String rsiName)
Gets the named Row Set Iterator that was created at runtime for this Row Set. |
AttributeDef |
findViewLinkAccessor(ViewLink vl)
Finds the View Link accessor attribute. |
protected ViewObjectImpl |
findViewLinkAccessorVO(AssociationDefImpl assocDef,
java.lang.String voName,
ViewDefImpl vDef,
ViewLinkDefImpl vlDef)
|
Row |
first()
Navigates to the first row in the row set. |
byte |
getAccessMode()
|
Row[] |
getAllRowsInRange()
Returns an array of all rows in the iterator's range. |
ApplicationModule |
getApplicationModule()
Returns the application module to which this View Object belongs. |
protected java.lang.String |
getAssociationClause(int noUserParams)
Internal: Applications should not use this method. |
AttributeDef[] |
getAttrDefsForEntityAttr(java.lang.String eoName,
java.lang.String eoAttrName)
This method performs the same operation as getAttrIndicesForEntityAttr , except that it
return an array of attribute definitions, not just indices. |
int |
getAttributeCount()
Counts a View Object's attributes. |
AttributeDef |
getAttributeDef(int index)
Gets the attribute definition at the specified position. |
AttributeDef[] |
getAttributeDefs()
Constructs an array of attribute definitions. |
int |
getAttributeIndexOf(java.lang.String attrName)
Gets the index of an attribute given its name. |
int[] |
getAttrIndicesForEntityAttr(java.lang.String eoName,
java.lang.String eoAttrName)
Returns an array of indices of view attributes that are mapped to the entity attribute identified by the entity name (the eoName parameter) and the entity attribute name
(the eoAttrName ). |
int |
getBindingStyle()
Returns the binding style. |
ViewRowSetImpl |
getByKeyFinderRS()
Internal: Applications should not use this method. |
int |
getCalculatedAttributeCount()
Counts the number of "calculated" attributes. |
SvcMsgIteratorState |
getCliIteratorState()
|
Row |
getCurrentRow()
Returns the current row of the iterator. |
int |
getCurrentRowIndex()
Returns the absolute row index of the iterator's current row. |
int |
getCurrentRowSlot()
Returns the current row's slot status. |
DBTransaction |
getDBTransaction()
Gets the transaction within which this View Object operates. |
ViewRowSetImpl |
getDefaultRowSet()
Internal: Applications should not use this method. |
java.lang.String |
getDefFullName()
Returns the full name of the view definition from which this View Object was created. |
java.lang.String |
getDefName()
Returns the name of the view definition from which this view object was created. |
protected int[] |
getDeleteParticipants()
Internal: Applications should not use this method. |
long |
getDetailEstimatedRowCount(Row[] masterRows)
|
RowSet[] |
getDetailRowSets()
Gets an array of detail Row Sets for which this Iterator is the master. |
protected int[] |
getDiscrColLoadIndices()
|
int |
getDynamicAttributeCount()
Internal: Applications should not use this method. |
int |
getDynamicAttributeOffset()
Internal: Applications should not use this method. |
protected EntityDefImpl |
getEntityDef(int index)
INTERNAL: Applications should not use this method. |
protected int |
getEntityDefCount()
Internal: Applications should not use this method. |
protected EntityDefImpl[] |
getEntityDefs()
Returns an array of entity definitions of the entity bases. |
int |
getEstimatedRangePageCount()
Returns getEstimatedRowCount()/rangePageSize, if rangeSize > 0. |
long |
getEstimatedRowCount()
Makes an estimated count of the rows in this row set. |
int |
getFetchedRowCount()
Counts the number of rows fetched from the JDBC result set. |
byte |
getFetchMode()
Gets the current fetch mode. |
short |
getFetchSize()
Gets the row pre-fetch size. |
Row[] |
getFilteredRows(RowQualifier qualifier)
|
Row[] |
getFilteredRows(java.lang.String attrName,
java.lang.Object attrValue)
Returns all rows in this collection whose attribute value matches the value being passed in attrValue . |
Row[] |
getFilteredRowsInRange(RowQualifier qualifier)
|
Row[] |
getFilteredRowsInRange(java.lang.String attrName,
java.lang.Object attrValue)
Returns all rows in this range whose attribute value matches the value being passed in attrValue . |
int |
getFullSqlMode()
|
static ViewRowSetIteratorImpl |
getImplObject(java.lang.Object rsi)
Internal: Applications should not use this method. |
protected int[] |
getInsertParticipants()
Internal: Applications should not use this method. |
int |
getIterMode()
Gets the current iteration mode. |
AttributeDef[] |
getKeyAttributeDefs()
Constructs an array of definitions of key attributes for the View Object. |
protected int[] |
getLockParticipants()
Internal: Applications should not use this method. |
RowSetIterator[] |
getMasterRowSetIterators()
Returns an array of all master row set iterators for this row set. |
int |
getMaxFetchSize()
Gets the maximum row fetch size. |
Row[] |
getNextRangeSet()
Gets the next set of rows in the range. |
java.lang.String |
getOrderByClause()
Returns the query's ORDER BY clause. |
java.lang.Object[] |
getParametersAsStorageTypes()
Constructs an array of the bind values used for binding arguments to the query. |
protected java.sql.PreparedStatement |
getPreparedStatement(int noUserParams,
boolean[] barr)
|
Row[] |
getPreviousRangeSet()
Gets the previous set of rows in the range. |
AttributeDefImpl[] |
getPrimaryKeys()
Constructs an array of entity attribute definitions of the primary keys of the View Object's Entity Objects. |
com.sun.java.util.collections.HashMap |
getPropertiesMap()
Retrieves all properties pertaining to this View Object. |
java.lang.Object |
getProperty(java.lang.String propName)
Retrieves the specified property. |
java.lang.String |
getProxyClassName()
Internal: Applications should not use this method. |
java.lang.String |
getProxyInterfaceName()
|
protected RowFilter[] |
getQualifyingRowFilters(java.lang.Object[] rowParamValues)
|
java.lang.String |
getQuery()
Returns the query statement. |
QueryCollection |
getQueryCollection()
Internal: Applications should not use this method. |
long |
getQueryHitCount(ViewRowSetImpl viewRowSet)
Counts the number of rows that would be returned if the View Object were executed with the current query. |
long |
getQueryHitCount(ViewRowSetImpl viewRowSet,
Row[] masterRows)
|
java.lang.String |
getQueryOptimizerHint()
Returns any Query Optimizer Hint set for this ViewObject or for it's definition object. |
int |
getRangeIndexOf(Row row)
Returns the range index of a given row. |
int |
getRangeSize()
Returns the range size of the iterator. |
int |
getRangeStart()
Returns the absolute row index of the first row in the range. |
Row |
getRow(Key key)
Returns the first row matching a given key. |
Row |
getRowAtRangeIndex(int index)
Returns the row at a given range position. |
java.lang.Class |
getRowClass()
Gets the Java class of this View Object's rows. |
int |
getRowCount()
Counts the total number of rows in this row set. |
int |
getRowCountInRange()
Counts the rows actually in the range. |
protected java.util.Enumeration |
getRowFilters()
|
java.lang.Object[] |
getRowFilterValues()
|
Row |
getRowFromHandle(java.lang.Object hdl)
Internal: Applications should not use this method. |
java.lang.String |
getRowProxyClassName()
Internal: Applications should not use this method. |
RowQualifier |
getRowQualifier()
|
RowSet |
getRowSet()
Returns the View Object as a RowSet object. |
ViewRowSetImpl |
getRowSetImpl(java.lang.String name,
java.lang.Object accessKey)
|
RowSetIterator |
getRowSetIterator()
Gets the row set iterator interface of this View Object. |
RowSetIterator[] |
getRowSetIterators()
Gets all Row Set Iterators that belong to this Row Set. |
RowSet[] |
getRowSets()
Get all Row Sets that belong to this view object. |
AttributeDef[] |
getScanRowFilterAttributeDefs()
|
long |
getSignature()
Internal: Applications should not use this method. Only for use in Object marshalling for remote tiers. |
java.lang.Object |
getSyncLock()
Gets the locking object for this Row Set Iterator. |
int |
getTransPostHandle()
Internal: Applications should not use this method. |
protected java.lang.Object |
getUserDataForCollection(java.lang.Object qc)
|
java.lang.String |
getUserDefinedQuery()
Gets the user-defined query, if one exists. |
ViewAttributeDefImpl[] |
getViewAttributeDefImpls()
Internal: Applications should not use this method. |
ViewCriteria |
getViewCriteria()
Gets the view criteria for this View Object. |
java.lang.String |
getViewCriteriaClause()
Generates the WHERE clause expression from the view criteria. |
protected ViewDefImpl |
getViewDef()
Internal: Applications should not use this method. |
protected com.sun.java.util.collections.ArrayList |
getViewLinkDestinationAttributes()
|
java.lang.String[] |
getViewLinkNames()
Constructs an array of names of View Links that involve this View Object. |
ViewLink[] |
getViewLinks()
Constructs an array of View Links that involve this View Object. |
ViewObject |
getViewObject()
Gets the View Object that contains this Row Set. |
java.lang.String |
getWhereClause()
Gets the query's WHERE clause. |
java.lang.Object[] |
getWhereClauseParams()
Constructs an array of the bind values currently specified for the query's WHERE clause. |
java.lang.String |
getXMLElementTag()
Returns the XML element name for this View Object. |
java.lang.String |
getXMLRowElementTag()
Returns the XML element name for this View Object. |
protected ViewRowImpl |
handleActivatedRowNotFound(Key k)
Applications should override this method and create a new row if they want to "own" management of a row that was not found during this VOs activation. |
boolean |
hasDefaultRowSet()
|
boolean |
hasNext()
Indicates whether the iterator has a next row. |
protected boolean |
hasNextForCollection(java.lang.Object qc)
|
boolean |
hasPrevious()
Indicates whether the iterator has a previous row or not. |
void |
insertRow(Row row)
Inserts a row into the row set. |
void |
insertRowAtRangeIndex(int index,
Row row)
Inserts a row into the row set at the specified range position. |
boolean |
isAssociationConsistent()
Returns the state of the association-consistent flag for this row set. |
boolean |
isAutoPostChanges()
Indicates whether auto-post-changes is enabled or not. |
protected boolean |
isCollectionPresent(RowFilter rowFilter)
|
boolean |
isDynamicAttribute(int index)
Indicates whether an attribute is dynamic. |
boolean |
isDynamicAttribute(java.lang.String name)
Indicates whether the named attribute is dynamic. |
boolean |
isExecuted()
Indicates whether the row set has been executed or not. |
boolean |
isFetchComplete()
Tests if the query result set has been fetched to the end. |
protected boolean |
isForeignKey(ViewAttributeDefImpl attr)
Checks if a view attribute is involved in a View Link in which this View Object is detail. |
boolean |
isForScan()
|
boolean |
isForwardOnly()
Indicates whether this row set is forward-only. |
boolean |
isInternal()
Returns whether this View Object was created internally by BC4J or by an explicit user request. |
boolean |
isManageRowsByKey()
Returns a flag indicating whether this View Object "manages rows by key" or not. |
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 |
isNameGenerated()
Tests if the Iterator's name was generated by the system. |
protected boolean |
isPassivatableTransientAttribute(ViewAttributeDefImpl voAttr)
Returns true if this Transient attribute should be passivated when the ViewObject data is being passivated. |
boolean |
isPassivationEnabled()
Advanced method: Checks if passivation is enabled for this ViewObject. |
boolean |
isPostedToDB()
|
protected boolean |
isQueryChanged()
Internal: Applications should not use this method. |
boolean |
isRangeAtBottom()
Indicates whether the iterator range contains the last row of the row set. |
boolean |
isRangeAtTop()
Indicates whether the iterator range contains the first row of the row set. |
boolean |
isReadOnly()
Tests whether this View Object is read-only. |
boolean |
isRowValidation()
Gets the validation flag on this iterator. |
boolean |
isTransientTransactionListener()
Tests whether this transaction listener is transient or permanent. |
boolean |
isTransientTransactionPostListener()
Reports that this view object is not a transient transaction post listener. |
boolean |
isViewLinkAccessorRetained()
|
Row |
last()
Navigates to the last row in the row set. |
AttributeDef |
lookupAttributeDef(java.lang.String name)
Finds a named attribute definition. |
Row |
next()
Navigates to the next row in the row set. |
protected void |
notifyRowDeleted(ViewRowSetImpl vrs,
Row viewRow,
int rowIndex)
This method is invoked by the framework when a row is deleted from the given ViewRowSet for this ViewObject. |
protected void |
notifyRowInserted(ViewRowSetImpl vrs,
Row viewRow,
int rowIndex)
This method is invoked by the framework when inserts are made to the given ViewRowSet for this ViewObject. |
protected void |
notifyRowUpdated(ViewRowSetImpl vrs,
Row[] viewRows,
int[] attrIndices)
This method is invoked by the framework when updates are made to any attribute for rows in the given ViewRowSet for this ViewObject. |
protected void |
passivateNewRowTracker(QueryCollection qc,
RowFilterKey rf,
Document doc,
Element parent)
Stores the NewRow index and keys. |
protected void |
passivateState(Document doc,
Element parent)
Allows subclasses to store custom data as XML-nodes under the given parent element, in the given document. |
protected void |
passivateState(ViewRowImpl currentRow,
Document doc,
Element parent)
Allows subclasses to store custom data as XML-nodes under the given parent element, in the given document. |
protected void |
passivateState(ViewRowSetImpl vrs,
ViewRowImpl currentRow,
Document doc,
Element parent)
Override this to store custom data as XML-nodes for the given ViewRowSetImpl. |
protected void |
passivateTransients(ViewRowImpl currentRow,
AttributeDefImpl[] attrs,
Document doc,
Element parent)
Deprecated. since 9.0.3.3 use passivateTransients(ViewRowSetImpl vrs...) |
protected void |
passivateTransients(ViewRowSetImpl vrs,
ViewRowImpl currentRow,
AttributeDefImpl[] attrs,
Document doc,
Element parent)
Stores the attributes from the given array for either just the current row or all the rows in the given ViewRowSet into the given parent xml node. |
protected void |
populateAttributeForRow(ViewRowImpl row,
int index,
java.lang.Object value)
|
void |
postChanges(TransactionEvent e)
This method is not implemented in this class. |
protected void |
prepareForActivation(Element amNode)
Override this method to activate custom data in the ViewObject from this VO's xml node. |
void |
prepareForBatchMode(SvcMsgIteratorState iteratorState,
boolean setCurrentRow)
|
protected void |
prepareForPassivation(Document out,
Element parent)
Override this method to passivate custom data in the ViewObject, before any ViewObject settings are passivated. |
Row |
previous()
Navigates to the previous row in the row set. |
protected java.lang.String |
printXMLDefinition(oracle.jbo.server.RowSetImpl rs,
java.util.Hashtable allDefs,
java.io.PrintWriter pw,
int depthCount)
Calls RowImpl.printXMLDefinition(java.util.Hashtable, java.io.PrintWriter, int)
to generate the definition for the
rowset and all its contents (including contained rowsets if depthCount
is non-zero). |
void |
readFromXml(XmlDocumentReader reader,
Element el)
|
void |
readRowXML(Element rowElt,
int depthCount)
Reads the data in XML form (in the format as generated by writeXML()) by finding a row that matches the key in the given XML and then reading in that row. |
void |
readRowXML(Element elem,
int depthCount,
XSLStylesheet xslt)
|
void |
readXML(Element elem,
int depthCount)
Given the document interface, finds the rowset Element and invokes readFromXMLElementNode() to read in the data from the XML. |
void |
readXML(Element elem,
int depthCount,
XSLStylesheet xslt)
Given the document interface, finds the rowset Element and invokes JboXMLUtil.processAndReadXML(XMLInterface, org.w3c.dom.Element, int, oracle.xml.parser.v2.XSLStylesheet)
to read in the data from
the XML. |
java.lang.Object[] |
refreshCollection(Row[] masterRows,
boolean resetIter,
boolean fillUpRange)
|
protected void |
releaseUserDataForCollection(java.lang.Object qc,
java.lang.Object data)
|
void |
remove()
Removes this View Object from its containing application module. |
void |
removeCurrentRow()
Removes the current row. |
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 listener)
Removes an event listener. |
void |
removeManagementListener(RowSetManagementListener listener)
Removes a subscriber (listener) for RowSetManagementListener
events generated by this row set iterator. |
boolean |
removeMasterRowSetIterator(RowSetIterator masterRSI)
Removes the master row set iterator (masterRSI) from a master-detail View Link. |
void |
removeRowHandle(java.lang.Object hdl)
Internal: Applications should not use this method. |
protected void |
removeRowSet(ViewRowSetImpl rs)
|
void |
reset()
Resets the iterator. |
protected void |
resetSession()
BC4J invokes this method when a ViewObject is being reset for potential reuse by another client session. |
protected Row[] |
retrieveByKey(ViewRowSetImpl rs,
Key key,
int maxNumOfRows)
|
protected Row[] |
retrieveByKey(ViewRowSetImpl rs,
Key key,
int maxNumOfRows,
boolean skipWhere)
|
protected boolean |
rowQualifies(ViewRowImpl vr)
|
int |
scrollRange(int amount)
Scrolls the range. |
int |
scrollRangeTo(Row row,
int index)
Scrolls the range to a specified row. |
int |
scrollToRangePage(int amount)
Moves the row set range start to the given page index where every page consists of RangeSize number of rows. |
void |
setAccessMode(byte isAccessMode)
Constrains the row access based on the following settings: |
void |
setAssociationConsistent(boolean isConsistent)
Sets the association-consistent flag for this row set. |
void |
setAutoPostChanges(boolean bAutoPostChanges)
Sets the auto-post-changes flag. |
void |
setBindingStyle(int bindingStyle)
Sets the binding style. |
boolean |
setCurrentRow(Row row)
Designates a given row as the current row. |
boolean |
setCurrentRowAtRangeIndex(int index)
Designates a row at a specified position as the current row. |
protected void |
setFetchCompleteForCollection(java.lang.Object qc,
boolean val)
|
protected void |
setFetchMode(byte fetchMode)
Sets the fetch mode. |
void |
setFetchSize(short size)
Sets the number of rows that JDBC will fetch from the database during one round trip. |
void |
setForwardOnly(boolean isForwardOnly)
Sets whether this row set will be forward-only or not. |
void |
setFullSqlMode(int fullSqlMode)
|
void |
setIterMode(int mode)
Sets the iteration mode for this Row Iterator. |
void |
setKeyAttributeDefs(int[] keyIndices)
Advanced method: Sets the key attributes for this ViewObject to be the attributes at the given indices. |
void |
setListenToEntityEvents(boolean b)
Sets the listen-to-entity-events flag. |
void |
setManageRowsByKey(boolean manageRowsByKey)
Sets the flag indicating whethter this View Object "manages rows by key" or not. |
boolean |
setMasterRowSetIterator(RowSetIterator masterRSI)
Sets the master row set iterator in a master-detail View Link. |
void |
setMaxFetchSize(int size)
Maximum number of rows to fetch for this View Object. |
void |
setNestedSelectForFullSql(boolean b)
|
void |
setOrderByClause(java.lang.String orderByClause)
Sets the query's ORDER BY clause. |
protected void |
setPassivatableTransientAttribute(ViewAttributeDefImpl voAttr,
boolean flag)
Marks the given attribute def for this VO as passivatable. |
void |
setPassivationEnabled(boolean enabled)
Advanced method: Enables/disables passivation for this ViewObject instance. |
void |
setPostedToDB(boolean b)
|
protected void |
setProxyClassName(java.lang.String platform,
java.lang.String proxyClassName)
Internal: Applications should not use this method. |
void |
setQuery(java.lang.String query)
Sets the user-defined query. |
protected void |
setQueryAsChanged(boolean isChanged)
|
protected void |
setQueryChanged(boolean isChanged)
Internal: Applications should not use this method. |
void |
setQueryOptimizerHint(java.lang.String hintText)
If this ViewObject does not have an expert mode query, then this hint is added to the select clause of the SQL for this ViewObject before the columns are listed e.g., SELECT \/*+ |
int |
setRangeSize(int size)
Sets the range size for the iterator. |
int |
setRangeStart(int start)
Positions the range. |
protected void |
setResultSetForCollection(java.lang.Object qc,
java.sql.ResultSet rs)
|
void |
setRowFilterValues(java.lang.Object[] rowFilterValues)
|
void |
setRowQualifier(RowQualifier rowQualifier)
|
void |
setRowValidation(boolean flag)
Sets the validation flag on this iterator. |
void |
setTransPostHandle(int hdl)
Internal: Applications should not use this method. |
protected void |
setUserDataForCollection(java.lang.Object qc,
java.lang.Object data)
|
void |
setViewCriteriaAdapter(ViewCriteriaAdapter adapter)
|
void |
setViewLinkAccessorRetained(boolean b)
|
void |
setWhereClause(java.lang.String whereClause)
Sets the query's WHERE clause. |
void |
setWhereClauseParam(int index,
java.lang.Object value)
Sets a specified the bind value, by index position. |
void |
setWhereClauseParams(java.lang.Object[] values)
Sets the query's bind values. |
void |
showCursorUsage(java.io.Writer out)
Internal: Applications should not use this method. |
void |
sourceChanged(EntityEvent event)
Handles events reported to ( EntityListener )s. |
protected void |
updateRowSetFromXML(Element node,
int depthCount,
oracle.jbo.server.RowSetImpl rs)
Creates a key from the given element's sub-elements to find an existing row. |
void |
validate()
Validates all view rows within this View Object. |
Node |
writeXML(int depthCount,
long options)
Writes the contents of this View Object by creating a new RowSet and rendering it in XML. |
Node |
writeXML(int depthCount,
long options,
XSLStylesheet xslt)
Writes the contents of this View Object by creating a new RowSet and rendering it in XML. |
Node |
writeXML(long options,
com.sun.java.util.collections.HashMap voAttrRules)
Renders data in a canonical XML-format. |
Node |
writeXML(long options,
com.sun.java.util.collections.HashMap voAttrMap,
XSLStylesheet xslt)
|
Methods inherited from class oracle.jbo.server.ComponentObjectImpl |
addListener, create, createRef, getCompListeners, getCompListenersList, getProxyClassName, getRootApplicationModule, isRegWithPiggyMan, setName, setParent |
Methods inherited from class oracle.jbo.server.NamedObjectImpl |
setParent, setPropertiesMap |
Methods inherited from class oracle.jbo.common.NamedObjectImpl |
getFullName, getName, getParent, getProperties, getPropertiesAsStrings, refreshProperty, setFullName, setProperty |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface oracle.jbo.StructureDef |
getFullName, getName |
Methods inherited from interface oracle.jbo.RowSet |
getName |
Methods inherited from interface oracle.jbo.Properties |
getProperties, refreshProperty |
Methods inherited from interface oracle.jbo.ComponentObject |
getFullName, getName |
Field Detail |
public static final byte FETCH_AS_NEEDED
setFetchMode(byte)
,
Constant Field Valuespublic static final byte FETCH_ALL
setFetchMode(byte)
,
Constant Field Valuespublic static final byte FETCH_DEFAULT
FETCH_AS_NEEDED
.
setFetchMode(byte)
,
Constant Field Valuespublic static final int FULLSQL_MODE_NO_AUGMENTATION
setQuery()
.
setFullSqlMode(int)
,
setQuery(String)
,
Constant Field Valuespublic static final int FULLSQL_MODE_AUGMENTATION
setQuery()
.
setFullSqlMode(int)
,
setQuery(String)
,
Constant Field Valuespublic static final java.lang.String XML_ELEM_PASSIVATE_TRANSIENT
protected ViewDefImpl mViewDef
protected com.sun.java.util.collections.ArrayList mAssocRefs
protected java.lang.String mOptimizerHint
protected java.lang.String mAssocFromClause
protected java.lang.String mAssocClause
protected java.lang.String mUserDefinedQuery
protected java.lang.String mOrderBy
protected java.lang.String mWhere
protected ViewRowSetImpl mViewRowSet
protected ViewAttributeDefImpl[] mAttrDefs
protected int mChgAttrIndUseCount
protected int[] mChangedAttrIndices
protected com.sun.java.util.collections.HashMap mAttrDefsTab
protected ViewAttributeDefImpl[] mKeyAttrRefs
protected com.sun.java.util.collections.HashMap mAttrDefsForExtendedVOs
protected boolean mAutoPostChanges
protected static final java.lang.String QC_TAG
protected static final java.lang.String NEW_ROW_TRACKER
protected static final java.lang.String NEW_ROW_INDEX
protected static final java.lang.String TRANSIENT_DATA_ROWTAG
protected static final java.lang.String DATA_ROWKEYTAG
protected static final java.lang.String NEW_ROW_HANDLE
public static boolean mUsePersColl
Before 9.0.2, we had two different ways of handling rows in a QueryCollection. The first used use Vector and the second used PCollection. Before 9.0.2, this field controlled which of these two ways would be used. If the user specifies jbo.user.pers.coll config parameter, it would set this field directly.
By 9.0.3, the Vector approach was effectively obsoleted. This flag was still present and could be used to choose the Vector approach. However, that was strongly discouraged. Having two different row management strategy was confusing and proned to problems. If the user specified jbo.use.pers.coll=false or true, that config param no longer affected this field. Regardless of the config param value, we used the PCollection approach. It instead controlled whether the PColl manager (owned by the DBTransactionImpl object) has a database persistence manager or not. If false, the PColl manager is created with no DB persistence manager. This means spill-to-disk will occur for no View Objects, regardless of the View Definition's PCollection related parameters.
If the user set this flag to false programmatically (which was still possible), we went with the Vector row management approach, but that code path was scarecely tested.
In 9.0.5, we removed the Vector management logic altogether. This static flag is still here. It now carries a slightly different meaning. When a QueryCollection is created, If this flag is false, and if the View Definition does not have a specific max-active-nodes value, it uses -1 as the max-active-nodes value, i.e., that View Object will not spill rows to disk.
The jbo.use.pers.coll config param has not changed its meaning. Thus, if jbo.use.pers.coll=false, no spill-to-disk will occur for all View Objects. Contrast that with jbo.pers.max.active.nodes=-1, which means no spill-to-disk for View Objects that do not have a max-active-nodes value in its View Definition. Setting mUsePersColl=false will have the same effect.
public static int mDefaultMaxRowsPerNode
public static int mDefaultMaxActiveNodes
public static final int MIN_ROWS_PER_NODE
public static final int MIN_ACTIVE_NODES
Constructor Detail |
public ViewObjectImpl()
public ViewObjectImpl(java.lang.String name, ViewDefImpl voDef)
name
- the name to be assigned to the View Object.voDef
- a view definition.Method Detail |
public final java.lang.Object getSyncLock()
RowSetIterator
ApplicationModule.getSyncLock()
for details.
getSyncLock
in interface RowSetIterator
public final boolean isNameGenerated()
RowSetIterator
isNameGenerated
in interface RowSetIterator
true
if the name was generated by the system.
false
if the name was given by the user and
not generated by the system.public final boolean isInternal()
ViewObject
isInternal
in interface ViewObject
public java.lang.Object getProperty(java.lang.String propName)
getProperty
in interface Properties
getProperty
in class NamedObjectImpl
propName
- the name of the property.
public com.sun.java.util.collections.HashMap getPropertiesMap()
getPropertiesMap
in class NamedObjectImpl
public final ApplicationModule getApplicationModule()
getApplicationModule
in interface RowSet
getApplicationModule
in class ComponentObjectImpl
public java.lang.String getDefName()
The name returned has the format viewDefName.
The following code sample uses this method to detect if a View Link is a self-join:
ViewLink info = appMod.findViewLink(viewName); // Detect if it is a self join with an accessor if (info.getSource().getDefName().equals(info.getDestination().getDefName()) && info.getSource().findViewLinkAccessor(info) != null) { ...do some processing... }
getDefName
in interface StructureDef
getDefName
in class ComponentObjectImpl
public java.lang.String getDefFullName()
The name has the format packageName.ViewDefName.
getDefFullName
in interface StructureDef
getDefFullName
in class ComponentObjectImpl
protected ViewDefImpl getViewDef()
Returns the view definition object from which this View Object was created.
public ViewAttributeDefImpl[] getViewAttributeDefImpls()
Returns an array of view attribute definitions.
This array includes dynamic attributes
(created through the addDynamicAttribute
method)
on this View Object.
This is an internal method. To get similar functionality, applications
should use getAttributeDefs
instead.
public ViewLink[] getViewLinks()
A View Link can use this View Object as either its source or destination. To determine whether it is the source or destination, use code such as:
viewLink.getDestination() == thisThis method should not be overridden.
public java.lang.String[] getViewLinkNames()
A View Link may use this View Object as either its source or destination. This method should not be overridden.
getViewLinkNames
in interface ViewObject
protected void addViewLink(ViewLinkImpl viewLink, boolean isReversed)
public boolean isReadOnly()
A View Object is read-only if it does not have a Primary Key, or if all its Entity Objects are read-only.
This method should not be overridden.
isReadOnly
in interface ViewObject
true
if this View Object is
read-only; false if it is updateable.public QueryCollection getQueryCollection()
Returns the query collection for this View Object's default row set.
public boolean hasDefaultRowSet()
public ViewRowSetImpl getDefaultRowSet()
Gets the default View Row Set.
This Row Set gets the same name as this View Object. This method should not be overridden.
public java.lang.String getWhereClause()
This WHERE clause is obtained from the
View Object instance. To get the WHERE clauses built from the View Object
instance, the View definition, and the detail View Objects, use
buildWhereClause
getWhereClause
in interface ViewObject
public void addWhereClause(java.lang.String expr)
The new WHERE clause is appended to the current WHERE clause. This method does not interpose "AND" or any other conjunctive between the old and new clauses: the application must provide it.
The modified WHERE clause does not take effect until
executeQuery()
is called.
This method should not be overridden.
expr
- the SQL WHERE clause to be appended.public void setWhereClause(java.lang.String whereClause)
The new WHERE clause does not take effect until
executeQuery()
is called. For an example usage of this method,
see setWhereClause
.
Note that calling
setWhereClause() does not clear the previous settings of WHERE clause
parameters. To reset WHERE clause parameters, call
setWhereClauseParams
explicitly with a null value. For example:
vo.setWhereClauseParams(null);This method should not be overridden.
setWhereClause
in interface ViewObject
whereClause
- a SQL WHERE clause.public RowQualifier getRowQualifier()
public void setRowQualifier(RowQualifier rowQualifier)
protected boolean rowQualifies(ViewRowImpl vr)
public java.lang.String getOrderByClause()
This method should not be overridden.
getOrderByClause
in interface ViewObject
public void addOrderByClause(java.lang.String expr)
The new expression is appended to the current order-by-clause, and a "," is interposed between them, if necessary.
The modified ORDER BY clause does not take effect until
executeQuery
is called.
This method should not be overridden.
expr
- the SQL ORDER BY expression to be appended.public void setOrderByClause(java.lang.String orderByClause)
The new ORDER BY clause does not take effect until
executeQuery
is called.
This method should not be overridden.
setOrderByClause
in interface ViewObject
orderByClause
- a SQL ORDER BY clause.public java.lang.Object[] getWhereClauseParams()
This method should not be overridden.
getWhereClauseParams
in interface RowSet
public boolean isExecuted()
isExecuted
in interface RowSet
public void setWhereClauseParams(java.lang.Object[] values)
The new WHERE clause parameter values do not take effect until
executeQuery
is invoked. To reset WHERE clause parameters,
call this method explicitly with a null value. For example:
vo.setWhereClauseParams(null);This method should not be overridden.
setWhereClauseParams
in interface RowSet
values
- an array of bind values.public void setWhereClauseParam(int index, java.lang.Object value)
The new WHERE clause parameter value does not take effect until
executeQuery
is invoked.
In the following exmple, setWhereClause uses a hard-coded value for the the WHERE clause, and setWhereClauseParam specifies userID for the first (index=0) parameter position.
ViewObject xVO = getUsersAvailableAssetsVO(); String whereClause = "ASSET_ID = 100315"; System.out.println("setWhereClause("+whereClause+") with setWhereClauseParam() after"); xVO.setWhereClause(whereClause); xVO.setWhereClauseParam(0, userId); xVO.executeQuery(); printVO(xVO);This method should not be overridden.
setWhereClauseParam
in interface RowSet
index
- the position of the bind value.value
- the bind value.public DBTransaction getDBTransaction()
This method should not be overridden.
public int getFullSqlMode()
public void setFullSqlMode(int fullSqlMode)
public java.lang.String getUserDefinedQuery()
This method is used when the View Object's query is created in Expert Mode.
The View Object's query statement is normally built from various
clauses, such as FROM, WHERE, and ORDER BY. An application can
bypass this mechanism by supplying a complete query though
setQuery
.
This method returns null if the query was not created in Expert Mode.
public void setNestedSelectForFullSql(boolean b)
public boolean isViewLinkAccessorRetained()
public void setViewLinkAccessorRetained(boolean b)
public java.lang.String getQuery()
getUserDefinedQuery
this method will return a SQL statement regardless of whether the query
was created in Expert or non-Expert Mode.
getQuery
in interface ViewObject
protected java.lang.String buildQuery(int noUserParams, boolean forRowCount)
protected java.lang.String buildRangePagingQuery(java.lang.String qry, int noUserParams)
protected void bindRangePagingParams(java.sql.PreparedStatement stmt, int noUserParams, int rangeStart, int rangeSize)
public long getQueryHitCount(ViewRowSetImpl viewRowSet)
This method obtains the row count by executing:
SELECT COUNT(1) FROM query-statement ESTCOUNTBased on the value returned, you might want to adjust the JDBC row prefetch size.
public long getQueryHitCount(ViewRowSetImpl viewRowSet, Row[] masterRows)
protected java.lang.String buildFromClause()
protected boolean buildWhereClause(java.lang.StringBuffer sqlBuffer, int noUserParams)
The WHERE clause is made up of the following parts:
sqlBuffer
- StringBuffer
into which the
WHERE clause is appended.noUserParams
- the number of bind variables in the WHERE clause.
Typically, this number is
getWhereClauseParams().length
.
true
if a WHERE clause was appended.protected boolean buildOrderByClause(java.lang.StringBuffer sqlBuffer, java.lang.String defOrderByClause)
The order-by-clause is made up of the following parts:
sqlBuffer
- StringBuffer
into which the
order-by-clause is appended.defOrderByClause
- order-by-clause from the definition object.
true
if an order-by-clause was appended.public void setQuery(java.lang.String query)
The View Object's query statement is normally built from various
clauses, such as FROM, WHERE, and ORDER BY. An application can
bypass this mechanism by using this method to supply a complete query.
The new query statement does not take effect until
executeQuery
is invoked.
query
- a user-defined query statement.
InvaildOperException
- if this method is called on a
View Object that is a detail of a View Link.public java.lang.Object[] getParametersAsStorageTypes()
The resulting array is a union of the following sets of bind values:
setWhereClauseParam()
.
null
if none.public java.lang.Class getRowClass()
ViewRowImpl
public ViewRowImpl createInstance(ViewRowSetImpl viewRowSet, AttributeList attrValList)
This method is called by ViewObjectImpl.createRow()
.
The view row is created, and if it is a detail row for some View Link,
its foreign key value attributes are initialized.
viewRowSet
- the row set requesting the new row instance.attrValList
- a list of attribute values to be used
for initializing the view row.
If it is a detail row for some View Link, this list will
contain foreign key values.
createRow()
public ViewRowImpl createInstanceFromResultSet(QueryCollection qc, java.sql.ResultSet resultSet)
Creates a view row instance from the query result.
This method is called as the user navigates through the query result.
As rows are traversed through the JDBC ResultSet
, view
rows are created through calls to this method.
qc
- query collection.resultSet
- JDBC ResultSet
.
protected ViewRowImpl createNewRowForCollection(java.lang.Object qc)
protected void populateAttributeForRow(ViewRowImpl row, int index, java.lang.Object value)
protected int[] getDiscrColLoadIndices()
protected ViewRowImpl createRowFromResultSet(java.lang.Object qc, java.sql.ResultSet resultSet)
protected int getEntityDefCount()
Returns the number of entity bases.
protected EntityDefImpl getEntityDef(int index)
Returns the definition of an entity base at the specified index.
protected EntityDefImpl[] getEntityDefs()
This method could be used to perform meta-data initializations like "custom" Properties that are calculated using the current transaction.
protected int[] getLockParticipants()
Returns an array of indices of entity bases that participate in processing the lock operation of the view row.
protected int[] getDeleteParticipants()
Returns an array of indices of entity bases that participate in processing the delete (remove) operation of the view row.
protected int[] getInsertParticipants()
Returns an array of indices of entity bases that participate in processing the insert operation of the view row.
public AttributeDef[] getAttributeDefs()
This array includes dynamic attributes
created through addDynamicAttribute
.
The following code snippet uses this method to create an array of attribute defninitions, then uses getName() to pull the attribute names from the definitions.
AttributeDef[] meta = vo.getAttributeDefs(); ... int attrCount = vo.getAttributeCount(); for (int i = 0; i < attrCount; i++) { String curName = meta[i].getName(); ...do some processing... }This method should not be overridden.
getAttributeDefs
in interface StructureDef
public AttributeDef[] getKeyAttributeDefs()
Use this method to find out how the key is composed for the View Row. The View Object's key is a composite key, consisting of view attributes mapped to the primary keys of its Entity Objects.
getKeyAttributeDefs
in interface ViewObject
public AttributeDef[] getAttrDefsForEntityAttr(java.lang.String eoName, java.lang.String eoAttrName)
getAttrIndicesForEntityAttr
, except that it
return an array of attribute definitions, not just indices.
getAttrDefsForEntityAttr
in interface ViewObject
eoName
- fully qualified name of the entity object.eoAttrName
- entity object attribute name.
getAttrIndicesForEntityAttr(String, String)
public int[] getAttrIndicesForEntityAttr(java.lang.String eoName, java.lang.String eoAttrName)
eoName
parameter) and the entity attribute name
(the eoAttrName
).
Note that it returns an array because more than one view object attribute may be mapped to one entity attribute.
This method can be used to identify view attributes that map into a particular entity object attribute. In particular, if a validation error fails on an entity attribute, this method can be used to find view attributes that map into that entity attribute.
eoName
- fully qualified name of the entity object.eoAttrName
- entity object attribute name.
public int getCalculatedAttributeCount()
Calculated attributes are those that are not directly mapped to entity attributes, such as SQL derived attributes and association accessor attributes.
This method should not be overridden.
public AttributeDefImpl[] getPrimaryKeys()
This method returns
an array of Entity attribute definitions, in contrast to
getKeyAttributeDefs
, which returns an
array of View attribute definitions.
If the View Object uses two or more Entity Objects, this method returns the concatenation of Entity attribute definitions.
This method should not be overridden.
protected java.lang.String getAssociationClause(int noUserParams)
Returns the where-clause expression generated from View Links.
public void executeQuery()
This method does not necessarily retrieve data. The View Object's
fetch mode determines whether the rows are retrieved immediately
or not. If FETCH_AS_NEEDED is specified, the ResultSet
is left open, and the rows are retrieved as the user navigates through
the row set.
Calling this method will ensure that the user will see the latest data from the database, as well as the data changes that the user has made in the current transaction.
If the user changes the SQL statement, or modifies attributes used by it, view rows that were visible may "disappear" after this method is invoked, and the new WHERE clause takes effect.
When a row set is first instantiated and the application calls a navigational method such as, next(), previous(), first(), or last(), this method is implicitly called.
Upon successful execution of the query, this method fires a
RangeRefreshEvent
event to RowSetListener
's
registered with this object, by calling
RowSetListener.rangeRefreshed()
.
executeQuery
in interface RowSet
setFetchMode(byte)
,
RowSetListener.rangeRefreshed(oracle.jbo.RangeRefreshEvent)
,
RangeRefreshEvent
public void executeEmptyRowSet()
executeEmptyRowSet
in interface WSRowSetMarshaller
public java.lang.Object[] executeDetailQuery(Row[] masterRows)
executeDetailQuery
in interface WSRowSetMarshaller
protected void executeQueryForCollection(java.lang.Object qc, java.lang.Object[] params, int noUserParams)
In contrast, if the user overrides the view object's executeQuery(), the custom logic in it only applies only when the user calls executeQuery() on the view object. If he calls executeQuery() on secondary row sets, the custom logic in executeQuery() will not apply.
qc
- the query collection about to execute the query.params
- the bind parameters that will be applied to the query.noUserParams
- the number of user bind parameters supplied
through the setWhereClauseParam calls.protected void setResultSetForCollection(java.lang.Object qc, java.sql.ResultSet rs)
protected boolean hasNextForCollection(java.lang.Object qc)
protected void setFetchCompleteForCollection(java.lang.Object qc, boolean val)
protected java.lang.Object getUserDataForCollection(java.lang.Object qc)
protected void setUserDataForCollection(java.lang.Object qc, java.lang.Object data)
protected void releaseUserDataForCollection(java.lang.Object qc, java.lang.Object data)
public int getAttributeCount()
This number includes dynamic attributes
created through addDynamicAttribute
.
This method is used in the following helper function that prints data to the screen.
// This is a helper method that prints data to the screen. public static void printRow(Row row) { String rowAttrs = ""; for (int i = 0; i < row.getAttributeCount(); i++) { rowAttrs += (row.getAttribute(i) + "\t"); } System.out.println(rowAttrs); }This method should not be overridden.
getAttributeCount
in interface StructureDef
public AttributeDef findAttributeDef(java.lang.String name)
The following code snippet uses this method to find the attribute definitions needed to create a link between two View Objects.
ViewObject voDept = myAM.createViewObject("MyDept", "package1.DeptVO"); ViewObject voEmp = myAM.createViewObject("MyEmp", "package1.EmpVO"); // Build an attribute array, consisting of DeptVO.DeptNum. AttributeDef[] deptAttrs = new AttributeDef[1]; deptAttrs[0] = voDept.findAttributeDef("DeptNum"); // Build an attribute array, consisting of EmpVO.DeptNum. AttributeDef[] empAttrs = new Attributedef[1]; empAttrs[0] = voEmp.findAttributeDef("DeptNum"); ViewLink vl = myAM.createViewLinkBetweenViewObjects("MyLink3", "Employees", // accessor name voDept, // master deptAttrs, voEmp, // detail empAttrs, null); // assoc clauseThis method should not be overridden.
findAttributeDef
in interface StructureDef
name
- the name of the attribute.
name
.
InvalidDefNameException
- if the name
is invalid.
NoDefException
- if the attribute is not found.public AttributeDef lookupAttributeDef(java.lang.String name)
The following code snippet uses this method to find the attribute definitions needed to create a link between two View Objects.
ViewObject voDept = myAM.createViewObject("MyDept", "package1.DeptVO"); ViewObject voEmp = myAM.createViewObject("MyEmp", "package1.EmpVO"); // Build an attribute array, consisting of DeptVO.DeptNum. AttributeDef[] deptAttrs = new AttributeDef[1]; deptAttrs[0] = voDept.findAttributeDef("DeptNum"); // Build an attribute array, consisting of EmpVO.DeptNum. AttributeDef[] empAttrs = new Attributedef[1]; empAttrs[0] = voEmp.findAttributeDef("DeptNum"); ViewLink vl = myAM.createViewLinkBetweenViewObjects("MyLink3", "Employees", // accessor name voDept, // master deptAttrs, voEmp, // detail empAttrs, null); // assoc clauseThis method should not be overridden.
lookupAttributeDef
in interface StructureDef
name
- the name of the attribute.
name
or null if no
attribute was found.
InvalidDefNameException
- if the name
is invalid.public AttributeDef getAttributeDef(int index)
// Loop over the attributes in the Row and Print names and values for (int i = 0; i < vo.getAttributeCount(); i++) { String attrName = vo.getAttributeDef(i).getName(); String attrVal = r.getAttribute(i).toString(); System.out.println(attrName + " = " + attrVal); }This method should not be overridden.
getAttributeDef
in interface StructureDef
index
- the position of the attribute definition.
null
if the index is
out of range.public int getDynamicAttributeCount()
Returns the number of dynamic attributes.
getDynamicAttributeCount
in interface ViewObjectDynAttr
public int getDynamicAttributeOffset()
Returns the attribute index of the first dynamic attribute.
getDynamicAttributeOffset
in interface ViewObjectDynAttr
public AttributeDef addDynamicAttribute(java.lang.String attrName)
Dynamic attributes are typeless, in that the application can set the attribute value to any object. You can use a dynamic attribute to store information created at runtime that you want to store with the row data. It is used only by the View Object that created it. Attributes can be any Serializable object.
If this attribute is to be passivated for failover/saveForLater/undo, the attribute-value should be able to recreate itself from its string representations. Types like Hashtables, Vectors etc. will not be handled automatically. For these one may create a domain and implement oracle.jbo.domain.XMLDomainWriter interface and then the domain can render itself as it feels fit. For a usage see source for oracle.jbo.domain.Array
This method should not be overridden.
addDynamicAttribute
in interface ViewObject
attrName
- the name of the dynamic attribute.
NameClashException
- if an attribute of the same name already exists.public int getAttributeIndexOf(java.lang.String attrName)
For example:
int idxQuantity = this.getAttributeIndexOf("Quantity");This method should not be overridden.
getAttributeIndexOf
in interface StructureDef
attrName
- the name of the attribute.
NoDefException
- if the attribute is not found.public boolean isDynamicAttribute(int index)
This method should not be overridden.
index
- the attribute's position.
true
if the attribute is dynamic;
false
otherwise.public boolean isDynamicAttribute(java.lang.String name)
This method should not be overridden.
name
- the attribute'same.
true
if the attribute is dynamic, or
false
otherwise.public void validate()
This method enumerates through all rows in the row set and calls
validate()
on any that have been modified.
ValidationException
- if validation fails for any row.ViewRowImpl.validate()
public boolean isAutoPostChanges()
If true, changes are automatically posted to the database before the View Object's query is executed.
public void setAutoPostChanges(boolean bAutoPostChanges)
If enabled, changes are automatically posted to the database before the View Object's query is executed.
bAutoPostChanges
- true enables auto-post-changes.protected RowFilter buildRowFilter(java.lang.Object[] paramValues)
protected java.util.Enumeration getRowFilters()
protected boolean isCollectionPresent(RowFilter rowFilter)
protected RowFilter[] getQualifyingRowFilters(java.lang.Object[] rowParamValues)
protected RowFilter buildNewCollection(java.lang.Object[] newParamValues)
protected RowFilter[] buildQualifyingRowFilters(java.lang.Object[] newParamValues)
public byte getFetchMode()
For more information on fetch modes, see setFetchMode
.
setFetchMode(byte)
protected void setFetchMode(byte fetchMode)
The fetchMode
parameter should be one of the FETCH_...
constants. This fetch mode controls how rows are retrieved
out of JDBC's ResultSet
.
After the query is executed, the row data are retrieved from
the ResultSet
. If FETCH_AS_NEEDED is specified, the
result set is left open and rows are retrieved as the user navigates
through the row set. If the user navigates to the end of the row
set, the result set is closed.
If FETCH_ALL is specified, all rows are retrieved out of the results set even if the user has not navigated through the row set. After all rows are retrieved, the result set is closed.
Additionally, if FETCH_ALL is specified, any value for setFetchSize(short)
is disregarded.
FETCH_DEFAULT is not implemented and should not used.
FETCH_ALL should be used if the number of rows in the row set
relatively small and the number of row sets open on the View Object
is large. This is because FETCH_ALL enables the user to avoid using
up JDBC ResultSet
s. If FETCH_AS_NEEDED is specified
and too many row sets are open (and left open because they are not
navigated to the end), the user may run out of ResultSet
s.
On the other hand, if the result set contains many rows, FETCH_ALL
may not desirable because it incurs the cost of retrieving all rows
up front.
For example, if your application does a lot of work with master-detail tables and the application does not fetch all of the rows from the detail, it could run out of cursors. If this happens, use FETCH_ALL.
fetchMode
- the new fetch mode. Can be FETCH_ALL or FETCH_AS_NEEDED.public int getBindingStyle()
public void setBindingStyle(int bindingStyle)
bindingStyle
- the binding style. Can be one of BINDING_STYLE_ORACLE, BINDING_STYLE_JDBC, or
BINDING_STYLE_UNKNOWN.public short getFetchSize()
The framework will use this value to set the JDBC row pre-fetch size. Note that the row pre-fetch size has performance ramifications. A larger fetch size is more expensive in terms of memory usage than a smaller size.
For each View Object, this method is customizable. Deciding what value to use could be made at runtime based on how many rows are expected for a particular View Object.
public int getMaxFetchSize()
This number is used to set the maximum number of rows to retrieve from JDBC. A value of 0 indicates all rows will be fetched.
getMaxFetchSize
in interface ViewObject
public void setFetchSize(short size)
The framework will use this value to set the JDBC row pre-fetch size. Note that the row pre-fetch size has performance ramifications. A larger fetch size is more expensive in terms of memory usage than a smaller size. The default fetch size is 1 row.
If the value of setFetchMode(byte)
is FETCH_ALL, then
the value of setFetchSize is disregarded.
For each View Object, this method is customizable. Deciding what value to use could be made at runtime based on how many rows are expected for a particular View Object.
size
- number of rows to fetch from the database. 1 is the default.setFetchMode(byte)
public void setMaxFetchSize(int size)
Passing -1 to this method will retrieve an unlimited number of rows. In other words, all the row returned by this ViewObject's query result set may be retrieved. This is the default.
Passing 0 to this method will cause the database query not to be executed. The View Object will initially work with an empty row set. If you want to execute query later, call setMaxFetchSize again with a non-zero argument, then call executeQuery().
setMaxFetchSize
in interface ViewObject
public ViewCriteria createViewCriteria()
A view criteria is a more structured way
of creating a SQL query WHERE clause. After setting various conditions for the
view criteria object, the application can call
applyViewCriteria
This method should not be overridden.
createViewCriteria
in interface ViewObject
ViewCriteria
,
applyViewCriteria(ViewCriteria)
protected boolean addViewCriteriaToWhereClause()
public void applyViewCriteria(ViewCriteria criteria)
This method should not be overridden.
applyViewCriteria
in interface ViewObject
criteria
- the view criteria to apply.public ViewCriteria getViewCriteria()
This method should not be overridden.
getViewCriteria
in interface ViewObject
null
if none is specified.public void setViewCriteriaAdapter(ViewCriteriaAdapter adapter)
public java.lang.String getViewCriteriaClause()
This method should not be overridden.
public boolean isForScan()
public AttributeDef[] getScanRowFilterAttributeDefs()
public void setKeyAttributeDefs(int[] keyIndices)
This method could be used to shorten the Key object for the rows of this ViewObject, if this ViewObject has a number of referenced entities and only one or a few updateable Entities, as long as
1. each row in the ViewObject is uniquely identifiable from the given set of key-attributes
2. the primary key of referenced entities are not updated in the cache. e.g, In case of EmpDeptView where Dept is referenced Entity if new Dept rows are added to the cache but not posted or Dept primary key values are changed, they may not be found by this ViewObject, as the key definition for this ViewObject may not have attribute-parts to identify the Depts in the cache. To avoid such cases, post changes for the Entites that make up references in this ViewObject before using findByKey
public boolean isManageRowsByKey()
If a View Object has an Entity base, then View row cache manages
View rows by the Entity rows on which each View row is based.
For example, if you call findByKey
on an Entity-based
View Object, BC4J first locates the Entity row with the given
primary key, then goes to this View row cache to find View rows
that are based on this Entity row.
A View Object which is not based on any Entity Object does not
have an Entity Object by which its rows can be organized.
For such a View Object, you have an option to organize its
rows by its keys. (For an EO-less View Object, its keys can
be specified by setKeyAttributeDefs
).
This flag indicates whether the rows should be organized by
its keys or not. The default is false
.
When this flag is true
, a small additional
overhead will be added in View row management because of
the bookkeeping associated with row management by key.
However, findByKey
will run faster because
rows with match key can be found faster. Further, when
this flag is true
, findByKey
can avoid returning duplicate rows in that the system
can check to see if the row with the given key is already in
the View row cache or not. If this flag is false
,
findByKey
may cause duplicate rows to show up in the
View row cache.
Note that for an EO based View Object, this flag is meaningless as rows are already organized and managed by its constituent Entity rows.
public void setManageRowsByKey(boolean manageRowsByKey)
isManageRowsByKey
for explanation of
flag.
manageRowsByKey
- the new flag value. Note that if the View Object
is EO-based, this flag is meaningless as rows are already
organized and managed by its constituent Entity rows.public RowSet getRowSet()
Note that the RowSetIterator.getRowSet() method returns the RowSet that owns the RowSetIterator. Since a View Object is a RowSetIterator, the object that owns the RowSetIterator for that View Object is the View Object itself.
getRowSet
in interface RowSetIterator
RowSetIterator.getRowSet()
public RowSetIterator getRowSetIterator()
public Row next()
This method delegates to the default RowSetIterator.
If this method is called on a row set that has not yet been
executed, executeQuery()
is implicitly called.
If the current row designation is to change, ViewRowImpl.validate()
is
called to validate the current row.
The row set has a "slot" before the first row, and
one after the last row. When the row set is executed the iterator
is positioned at the slot before the first row. If next()
is invoked on a newly-executed row,
the first row will be returned.
If next()
is called when the iterator is positioned
on the last row of the row set, null
is returned
and the iterator is positioned at the slot following the last row.
If the iterator is at the last row of the range when next()
is called, RowSetListener.rangeScrolled()
is called to send
ScrollEvent
to registered
RowSetListener
s.
When successful, this method fires a
NavigationEvent
to registered
RowSetListener
s, by calling
RowSetListener.navigated()
. The row returned is
designated as the current row.
next
in interface RowIterator
null
if no next row.
ValidationException
- if the prevously current row fails
validation.NavigationEvent
,
RowSetListener
,
ScrollEvent
,
ViewRowImpl.validate()
public Row previous()
This method delegates to the default RowSetIterator.
If this method is called on a row set that has not yet been
executed, executeQuery()
is implicitly called.
If the current row designation is to change, ViewRowImpl.validate()
is
called to validate the current row.
The row set has a "slot" before the first row, and
one after the last row. When the row set is executed the iterator
is positioned at the slot before the first row.
If previous()
is called when the iterator is positioned
on the first row of the row set, null
is returned
and the iterator is positioned at the slot preceeding the first row.
If the iterator is at the first row of the range when previous()
is called, RowSetListener.rangeScrolled()
is called to send
ScrollEvent
to registeredRowSetListener
s.
When successful, this method fires a
NavigationEvent
to registered
RowSetListener
s, by calling
RowSetListener.navigated()
. The row returned is designated as
the current row.
previous
in interface RowIterator
null
if no previous row.
ValidationException
- if the prevously current row fails
validation.NavigationEvent
,
RowSetListener
,
ScrollEvent
,
ViewRowImpl.validate()
public Row first()
This method delegates to the default RowSetIterator.
If this method is called on a row set that has not yet been
executed, executeQuery()
is implicitly called.
If the current row designation is to change, ViewRowImpl.validate()
is
called to validate the current row.
If the range does not include the first row when next()
is called, RowSetListener.rangeScrolled()
is called to send
ScrollEvent
to registered
RowSetListener
s.
When successful, this method fires a
NavigationEvent
to registered RowSetListener
s, by calling
RowSetListener.navigated()
. The row returned is designated as
the current row.
first
in interface RowIterator
null
if the set has no rows.
InvalidOperException
- if this is called on a forward-only
row set, and the iterator has passed the first row.
ValidationException
- if the prevously current row fails
validation.NavigationEvent
,
RowSetListener
,
ViewRowImpl.validate()
public Row last()
This method delegates to the default RowSetIterator.
If this method is called on a row set that has not yet been
executed, executeQuery()
is implicitly called.
If the current row designation is to change, ViewRowImpl.validate()
is
called to validate the current row.
This method retrieves rows until the end of row set is found.
Thus, this operation may be slow.
If the range does not include the last row when next()
is called, RowSetListener.rangeScrolled()
is called to send
ScrollEvent
to registered RowSetListener
s.
When successful, this method fires a
NavigationEvent
to registered RowSetListener
s, by calling
RowSetListener.navigated()
. The row returned is designated as
the current row.
last
in interface RowIterator
null
if the set has no rows.
ValidationException
- if the prevously current row fails
validation.NavigationEvent
,
RowSetListener
,
ViewRowImpl.validate()
public boolean doesRowFilterMatch(Row[] masterRows, java.lang.Object[] rowFilterValues)
doesRowFilterMatch
in interface WSRowSetMarshaller
public java.lang.Object[] refreshCollection(Row[] masterRows, boolean resetIter, boolean fillUpRange)
refreshCollection
in interface WSRowSetMarshaller
public void reset()
This method delegates to the default RowSetIterator. The iterator is positioned to the slot before the first row, the state of a newly-executed row set.
reset
in interface RowIterator
public boolean hasNext()
This method delegates to the default RowSetIterator.
If this method is called on a row set that has not yet been
executed, executeQuery
is implicitly called.
This method does not move the current row.
hasNext
in interface RowIterator
true
if the row set has a next row, or
false
if not.public boolean hasPrevious()
This method delegates to the default RowSetIterator.
If this method is called on a row set that has not yet been
executed, executeQuery
is implicitly called.
This method does not move the current row.
hasPrevious
in interface RowIterator
true
if the row set a previous row, or
false
if not.public boolean isRangeAtBottom()
This method delegates to the default RowSetIterator.
If this method is called on a row set that has not yet been
executed, executeQuery
is implicitly called.
This method does not move the current row.
isRangeAtBottom
in interface RowIterator
true
if the range contains the last row, or
false
if not.public boolean isRangeAtTop()
This method delegates to the default RowSetIterator.
If this method is called on a row set that has not yet been
executed, executeQuery
is implicitly called.
This method does not move the current row.
isRangeAtTop
in interface RowIterator
true
if the range contains the first row, or
false
if not.public int getFetchedRowCount()
This method delegates to the default RowSetIterator.
This method can be used to determine whether the View Object has read
all the rows from the cursor. For example,
getEstimatedRowCount
returns an equivalent
of count(*) on the View Object. The getFetchedRowCount()
method returns the count of rows already fetched. If getFetchedRowCount() returns a
value less than getEstimatedRowCount(), then the View Object has not read all rows
from the cursor.
getFetchedRowCount
in interface RowIterator
public int getRowCount()
This method retrieves all rows from the View Object by executing the View Object's query and then calling next() until the last row is retrieved. Thus, since it iterates through the View Object one record at a time, this method may be slow.
If you are working with a large number of rows, or if your application
demands a fast response, use
getEstimatedRowCount
to obtain a
quicker count.
The following sample code uses getRowCount() to set up separate iterators for even numbered and odd numbered rows:
// Default iterator gets even-numbered rows. // Second iterator gets odd-numbered rows. long nRows = vo.getRowCount(); String msg = ""; for (int i = 0; i < nRows; i +=2) { // Get and set row index values relative to a range. // Index of first row = 0. vo.setCurrentRowAtRangeIndex(i); Row currRow = vo.getCurrentRow(); msg = " Default iterator (even): " + vo.getRangeIndexOf(currRow); printRow(currRow, msg); secondIter.setCurrentRowAtRangeIndex(i + 1); currRow = secondIter.getCurrentRow(); msg = " Second iterator (odd): " + vo.getRangeIndexOf(currRow); printRow(secondIter.getCurrentRow(), msg); }
getRowCount
in interface RowIterator
getEstimatedRowCount()
public long getEstimatedRowCount()
This method estimates the number of rows in the row count
by calling getQueryHitCount
(which performs a SELECT COUNT (*) FROM table).
Internal logic in Business Components for Java keeps the
EstimatedRowCount up-to-date as rows are
inserted and removed.
Thus, after the first call to this method, it can return
the estimated count quickly.
For example:
// Get the rowcount again because of deleted or inserted row rowCount = (int) iter.getRowSet().getEstimatedRowCount();
If you are working with a large number of rows, or if your application
demands a fast response, use this method instead of
getRowCount
.
Note however, that this method might not be as accurate as
getRowCount(). To test whether the View Object has read
all the rows from the cursor, you can use getEstimatedRowCount()
in conjunction with getFetchedRowCount(). For example,
getEstimatedRowCount() returns an equivalent
of count(*) on the View Object. The getFetchedRowCount
method returns the count of rows already fetched. If getFetchedRowCount() returns a
value less than getEstimatedRowCount(), then the View Object has not read all rows
from the cursor.
getEstimatedRowCount
in interface RowSet
getQueryHitCount(ViewRowSetImpl)
,
getFetchedRowCount()
public long getDetailEstimatedRowCount(Row[] masterRows)
getDetailEstimatedRowCount
in interface WSRowSetMarshaller
public java.lang.Object[] getRowFilterValues()
getRowFilterValues
in interface WSRowSetIteratorMarshaller
public void setRowFilterValues(java.lang.Object[] rowFilterValues)
setRowFilterValues
in interface WSRowSetIteratorMarshaller
public SvcMsgIteratorState getCliIteratorState()
getCliIteratorState
in interface WSRowSetIteratorMarshaller
public void prepareForBatchMode(SvcMsgIteratorState iteratorState, boolean setCurrentRow)
prepareForBatchMode
in interface WSRowSetIteratorMarshaller
public int setRangeSize(int size)
The following code example creates one View Object, uses the default iterator to display one row at a time, and creates a second iterator on the same View Object to display a range of five rows.
// Create the View Object within the context defined by the // Application Module. The View Object provides a default iterator. ViewObject vo = appMod.createViewObject(voName, voDefFile); // Create another iterator. RowSetIterator secondIter = vo.createRowSetIterator("Two"); secondIter.setRangeSize(5);
setRangeSize
in interface RowIterator
size
- the new range size, or -1 if all rows are to be included.
InvalidOperException
- if the iterator is forward-only and
size
is greater than 1.RowIterator.setRangeStart(int)
public int getRangeSize()
A range size of -1 indicates that the range will contain all the rows of the row set.
The following code sample uses this method as a parameter to
scrollRange
.
Assume that printRows is a helper routine defined elsewhere.
// Use the second iterator to print a range of rows. secondIter.scrollRange(secondIter.getRangeSize()); printRows(secondIter.getAllRowsInRange());
getRangeSize
in interface RowIterator
public int getRangeStart()
An absolute row index is a row index in the entire row set.
For an example usage of this method, see setRangeStart
getRangeStart
in interface RowIterator
public int setRangeStart(int start)
This method scrolls the range to make the row of
the specified start index the first row of the range. If successful,
RowSetListener.rangeScrolled()
is called to send
a ScrollEvent
to registered RowSetListener
.
If start
indicates a row beyond the last row, the range
will be scrolled to the end of the row set.
In the following code sample, the range starts with the fourth row. Assume that printRows is a helper function defined elsewhere.
vo.setRangeStart(4); vo.setRangeSize(3); // this command prints rows 4 - 6. printRows(vo.getAllRowsInRange(), vo.getRangeStart());
setRangeStart
in interface RowIterator
start
- an absolute row index.
ScrollEvent
,
RowSetListener
public int scrollRange(int amount)
The number of rows to scroll, amount
, may be positive or negative.
If negative, the range is scrolled upward (backward).
The following code sample scrolls the range two rows backwards.
// Range window scrolls 2 rows backwards. Range size stays the same. vo.scrollRange(-2); // Positive scrolls forward, negative scrolls back.
If amount
would scroll the range
beyond either end of the row set, this method scrolls to that end of the range.
After the range is scrolled, this method
calls RowSetListener.rangeScrolled
() to send
a ScrollEvent
to registered RowSetListener
s.
scrollRange
in interface RowIterator
amount
- the number of rows to scroll.
InvalidOperException
- if this method is called on
on a forward-only row set and amount
is negative.ScrollEvent
,
RowSetListener
public int scrollToRangePage(int amount)
RowSetIterator
(rangeSize * (pageSize-1)) - getRangeStart();
scrollToRangePage
in interface RowSetIterator
amount
- the page number to go to in the result set.
public int getEstimatedRangePageCount()
RowSetIterator
This number may fluxuate when the View Object is syncronized with its Entity Object.
getEstimatedRangePageCount
in interface RowSetIterator
public int scrollRangeTo(Row row, int index)
This method scrolls the range to position the specified row at a specified range index. This operation may be slow.
After the range is scrolled, this method
calls RowSetListener.rangeScrolled
() to send
a ScrollEvent
to registered RowSetListener
s.
scrollRangeTo
in interface RowIterator
row
- the row to scroll the range to.index
- the range index at which row is to be positioned.
InvalidParamException
- thrown if index
is
outside the range, or if
row
is not found
in the row set.
InvalidOperException
- thrown if this method is called on
on a forward-only row set.ScrollEvent
,
RowSetListener
public Row getRow(Key key)
This method retrieves rows from the database until a match is found or the end of the row set is reached.
If this View Object has multiple Entity Objects, the key
need not be specified for all. When this is the case multiple rows may
match the key. The first of these rows will be returned.
This method differs from findByKey
in the
following respects:
getRow
returns one row only, findByKey()
returns
multiple rows.
getRow
populates the collection
until it finds a match, but findByKey
retrieves rows
first from the cache and then from the database,
and does not populate the collection.
findByKey
may be much faster than getRow
.
getRow
returns the first matching row,
findByKey
may retrieve rows in the order not specified by the query.
getRow
in interface RowIterator
key
- the key to be matched.
null
if none match.findByKey(Key, int)
public Row getRowAtRangeIndex(int index)
getRowAtRangeIndex
in interface RowIterator
index
- a zero-based index within the range.
null
if index
is outside of the range.public Row getRowFromHandle(java.lang.Object hdl)
Returns the row with a handle specified by hdl
.
A view row can be assigned a handle unique in the running
session (ViewRowImpl.getHandle
). This handle
can be used to get back the row. This method returns the
row given the row handle.
The row handle is valid only within the running session and may not be persisted across sessions.
This method is an internal routine. The client should
use the row's key (ViewRowImpl.getKey
) if he wishes to
get the row back at a later time. Also, the key
may be persisted and used across sessions.
hdl
- the row handle.
ViewRowImpl.getHandle()
,
ViewRowImpl.getKey()
public void removeRowHandle(java.lang.Object hdl)
Removes the row handle from the row handle hash table.
A view row can be assigned a handle unique in the running
session (ViewRowImpl.getHandle
). This handle
can be used to get back the row. This method removes the
row handle from the row handle hash table.
hdl
- the row handle to remove.ViewRowImpl.getHandle()
public Row getCurrentRow()
This method delegates to the default RowSet iterator.
If the row set has not been executed, or if this method is called
immediately after the current row is removed, then it returns
null
(no current row).
getCurrentRow
in interface RowIterator
null
if no current row.public int getCurrentRowIndex()
This method is used in the following example that refreshes a viewPort.
private void refresh() { // This is the expensive way where we refresh the entire viewPort fireTableDataChanged(); int rangeRow = iter.getCurrentRowIndex(); if (rangeRow >= 0) // -1 if null or out of range { int tableRow = rangeRow + iter.getRangeStart(); table.setRowSelectionInterval(tableRow, tableRow); } else { table.clearSelection(); }If the row set has not been executed, or the iterator has been reset, -1 is returned.
getCurrentRowIndex
in interface RowIterator
public int getCurrentRowSlot()
The current row's slot status is one of the following
oracle.jbo.RowIterator
constants:
The following example uses a switch statement to return a different string message based on the value returned by this method.
public String getCurrentRowSlot() { switch (mViewObject.getCurrentRowSlot()) { case mViewObject.SLOT_VALID: return new String("SLOT_VALID"); case mViewObject.SLOT_DELETED: return new String("SLOT_DELETED"); case mViewObject.SLOT_BEFORE_FIRST: return new String("SLOT_BEFORE_FIRST"); case mViewObject.SLOT_BEYOND_LAST: return new String("SLOT_BEYOND_LAST"); }
getCurrentRowSlot
in interface RowIterator
RowIterator
public int getIterMode()
RowIterator
getIterMode
in interface RowIterator
public void setIterMode(int mode)
RowIterator
setIterMode
in interface RowIterator
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".public boolean isRowValidation()
RowIterator
isRowValidation
in interface RowIterator
public void setRowValidation(boolean flag)
RowIterator
setRowValidation
in interface RowIterator
flag
- Whether to turn row validation off or not.public boolean setCurrentRow(Row row)
This method calls ViewRowImpl.validate
to
validate the previous current row.
After designating row as the current row, this method
invokes RowSetListener.navigated()
to send a
NavigationEvent
to registered RowSetListener
s.
setCurrentRow
in interface RowIterator
row
- the row that is to become the current row.
ValidationException
- if the previous current row fails
validation.NavigationEvent
,
RowSetListener
,
ViewRowImpl.validate()
public boolean setCurrentRowAtRangeIndex(int index)
This method calls ViewRowImpl.validate
to
validate the previous current row.
After designating row as the current row, this method
invokes RowSetListener.navigated()
to send a
NavigationEvent
to registered RowSetListener
s.
setCurrentRowAtRangeIndex
in interface RowIterator
index
- the position of the row that is to become the current row.
ValidationException
- if the previous current row fails
validation.NavigationEvent
,
RowSetListener
,
ViewRowImpl.validate()
public Row createAndInitRow(AttributeList initVals)
RowIterator
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.
When this method is called, underlying entities are created.
After the new entities are created, a new view row is created.
After that 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.
createAndInitRow
in interface RowIterator
initVals
- a list of name-value pairs.
public Row createRow()
Note that the constituent entities will be added to the entity-cache if the primary key of these entites are populated/set when the relevant entity's create() method is called. PrimaryKey attributes of Bc4J generated ID types (like RowID, DBSequence, etc) are defaulted before Entity.create and thus entities with such types as Primary Key attribute will be placed in the entity cache during create.
Following is a short example of a helper routine that uses this method to add a row to a View Object.
public static void addRow(ApplicationModule appMod, ViewObject vo) { // Create a row and fill in the columns. Row newRow = vo.createRow(); newRow.setAttribute("Deptno", new Number(14)); newRow.setAttribute("Dname", "Pubs"); newRow.setAttribute("Loc", "Honolulu"); vo.insertRow(newRow);
createRow
in interface RowIterator
public void insertRow(Row row)
The row is inserted at the current row position and becomes the current row. The indices for rows below the insertion point are incremented.
Upon successful insertion, this method
invokes RowSetListener.rowInserted()
to send a
InsertEvent
to registered RowSetListener
s.
If you want to insert a row but not change currency consider using
insertRowAtRangeIndex
.
insertRow
in interface RowIterator
row
- the view row to insert.public void insertRowAtRangeIndex(int index, Row row)
The row is inserted at the given range index. The indices for rows below the insertion point are incremented.
Note that this method does not change currency.
Upon successful insertion, this method
invokes RowSetListener.rowInserted()
to send a
InsertEvent
to registered RowSetListener
s.
insertRowAtRangeIndex
in interface RowIterator
index
- the range index at which row is to be inserted.row
- the view row to insert.public void removeCurrentRow()
This method marks constituent Entity Object rows as deleted. When changes are posted to database or transaction committed, the database rows are deleted.
Upon successful removal of the row, the current row position does not
move. However, the current row is set to null
,
and its slot status is set to SLOT_DELETED.
Calling next()
or previous()
after removal
will return a row adjacent to the removed row.
After removing the row, this method
invokes RowSetListener.rowDeleted()
to send a
DeleteEvent
to registered RowSetListener
s.
removeCurrentRow
in interface RowIterator
RowSetListener.rowDeleted(oracle.jbo.DeleteEvent)
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 getRangeIndexOf(Row row)
getRangeIndexOf
in interface RowIterator
row
- a row.
public java.util.Enumeration enumerateRowsInRange()
enumerateRowsInRange
in interface RowIterator
public Row[] getAllRowsInRange()
getAllRowsInRange
in interface RowIterator
public Row[] getNextRangeSet()
RowSetIterator
getNextRangeSet()
will return rows 10 through 19.
If the next range set does not have enough rows to fill up the range,
getNextRangeSet()
returns a partially filled range.
That is, this method operates as if the iteration mode is
.
RowIterator.ITER_MODE_LAST_PAGE_PARTIAL
If there is no more rows, this method returns an empty array (an array of length 0).
While obtaining the next range set, the range will be scrolled.
This causes a
to 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
).
After the next range set is obtained, the method sets the first
Row of the range as the current row. This may fire a
and sends it to
#oracle.jbo.NavigationEvent
.
#oracle.jbo.RowSetListener.navigated(oracle.jbo.NavigationEvent)
getNextRangeSet
in interface RowSetIterator
public Row[] getPreviousRangeSet()
RowSetIterator
getPreviousRangeSet()
will return rows 0 through 9.
If there is no more rows, this method returns an empty array (an array of length 0).
While obtaining the previous range set, the range will be scrolled.
This causes a
to 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
).
After the previous range set is obtained, the method sets the first
Row of the range as the current row. This may fire a
and sends it to
#oracle.jbo.NavigationEvent
.
#oracle.jbo.RowSetListener.navigated(oracle.jbo.NavigationEvent)
getPreviousRangeSet
in interface RowSetIterator
public ViewObject getViewObject()
RowSet
If this Row Set is the result of calling a View Link accessor,
the returned View Object is an internal View Object.
See
.
ViewObject.isInternal()
getViewObject
in interface RowSet
public boolean setMasterRowSetIterator(RowSetIterator masterRSI)
The given iterator must be valid: a View Link must
associate this detail View Object with another View Object, for which
masterRSI
is the master iterator.
setMasterRowSetIterator
in interface RowSet
masterRSI
- a master row set iterator.
public boolean removeMasterRowSetIterator(RowSetIterator masterRSI)
If masterRSI
is a master row set iterator for this
row set, it is removed from the list of master row set
iterators.
removeMasterRowSetIterator
in interface RowSet
masterRSI
- master row set iterator to be removed.
public RowSetIterator[] getMasterRowSetIterators()
getMasterRowSetIterators
in interface RowSet
public RowSet[] getDetailRowSets()
In a master-detail relationship in an Application Module, the master in reality is a Row Set Iterator. (Though we often speak of master View Object, in reality, it is the Iterator behind the View Object which is playing the role of the master). Whenever the currency of this master Iterator moves, the detail Row Sets are re-executed to show related Rows.
Calling this method returns an array of Row Sets that are related to this Iterator as detail Row Sets.
getDetailRowSets
in interface RowSetIterator
RowSet
.public RowSet createDetailRowSet(java.lang.String rsName, java.lang.String linkDefName)
getDetailRowSets()
for explanation of detail Row Sets.
This method creates a new detail Row Set for this Iterator.
createDetailRowSet
in interface RowSetIterator
rsName
- the name of the new detail Row Set.linkDefName
- the name of a View Link definition.
This View Link chooses the relationship in which
this Iterator is the master and the new Row Set
is the detail. It must be a fully qualified
name (including the package name).
public void addListener(java.lang.Object listener)
The listener listens to changes on the rows. Typical events that it listens for are scrolls to the next row, currency changes, deletes/inserts/updates/executes on a row.
addListener
in interface NavigatableRowIterator
listener
- a RowSetListener
instance.RowSetListener
public void removeListener(java.lang.Object listener)
removeListener
in interface NavigatableRowIterator
listener
- the listener to be removed.public void addManagementListener(RowSetManagementListener listener)
RowSetIterator
RowSetManagementListener
events generated by this Row Set Iterator.
addManagementListener
in interface RowSetIterator
listener
- the subscriber to be added. It should implement
RowSetManagementListener
.public void removeManagementListener(RowSetManagementListener listener)
RowSetIterator
RowSetManagementListener
events generated by this row set iterator.
removeManagementListener
in interface RowSetIterator
listener
- the subscriber to be removed.public RowSet createRowSet(java.lang.String name)
createRowSet
in interface ViewObject
name
- the name of the new row set.
public RowSetIterator createRowSetIterator(java.lang.String name)
The following example creates a second iterator on a View Object and sets the range size to 5.
// Create another iterator. RowSetIterator secondIter = vo.createRowSetIterator("Two"); secondIter.setRangeSize(5);
createRowSetIterator
in interface RowSet
name
- the name of the new row set iterator.
public RowSetIterator[] getRowSetIterators()
RowSet
getRowSetIterators
in interface RowSet
public RowSetIterator findRowSetIterator(java.lang.String rsiName)
RowSet
findRowSetIterator
in interface RowSet
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.public int getRowCountInRange()
If the range is at the end of the row set, the number of rows in the range may be less than the range size.
The definition of getChildCount() uses the number of rows returned by this method to represent the number of child rows.
// Returns the number of children. public int getChildCount() { if (children == null) { return 0; } else { return children.getRowCountInRange(); } }
getRowCountInRange
in interface RowIterator
public Row[] findByKey(Key key, int maxNumOfRows)
See
for details.
#oracle.jbo.RowIterator.findByKey(oracle.jbo.Key, int)
findByKey
in interface RowIterator
key
- the key to match.maxNumOfRows
- the maximum size of the array to return,
or -1 to return all rows.
getRow(oracle.jbo.Key)
public void findAndSetCurrentRowByKey(Key key, int rangeIndex)
findAndSetCurrentRowByKey
in interface WSRowSetIteratorMarshaller
public Row[] findByKey(Key key, int maxNumOfRows, boolean skipWhere)
public Key createKey(AttributeList nvp)
createKey
in interface RowIterator
public Row[] findByEntity(int eRowHandle, int maxNumOfRows)
RowIterator
eRowHandle
.
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.
protected void setQueryChanged(boolean isChanged)
Sets whether the query should be marked changed or not.
If the query is marked as changed, this method walks through the list of view row sets and tells each to refresh its content.
isChanged
- the new change flag.protected void setQueryAsChanged(boolean isChanged)
protected boolean isQueryChanged()
Indicates whether the query is marked changed or not.
protected void notifyRowInserted(ViewRowSetImpl vrs, Row viewRow, int rowIndex)
vrs
- ViewRowSetImpl instance to be notified about the new row.viewRow
- View Row instance that have been inserted.protected void notifyRowDeleted(ViewRowSetImpl vrs, Row viewRow, int rowIndex)
vrs
- ViewRowSetImpl instance to be notified about the deleted row.viewRow
- View Row instance that have been deleted.protected void notifyRowUpdated(ViewRowSetImpl vrs, Row[] viewRows, int[] attrIndices)
vrs
- ViewRowSetImpl instance to be notified about the attribute(s) updateviewRows
- A collection of View Row instances that have been modified.attrIndices
- A collection of attribute indices in the View Rows that have
been modified.public RowSet[] getRowSets()
getRowSets
in interface ViewObject
public RowSet findRowSet(java.lang.String rsName)
ViewObject
findRowSet
in interface ViewObject
rsName
- a Row Set name. If null
, it returns the
the View Object.
null
if the named Row Set is not
not found.public ViewRowSetImpl getRowSetImpl(java.lang.String name, java.lang.Object accessKey)
protected void addRowSet(ViewRowSetImpl rs)
protected void removeRowSet(ViewRowSetImpl rs)
protected com.sun.java.util.collections.ArrayList getViewLinkDestinationAttributes()
protected boolean isForeignKey(ViewAttributeDefImpl attr)
attr
- a view attribute definition.
public long getSignature()
public java.lang.String getProxyClassName()
Returns the name of this View Object's proxy class. The proxy is the name of the class to instantiate on the client (in 3-tier case) to play the role of remote proxy for this view object. The proxy class name can be different depending on the Application Server platform. For example, for Visibroker, the proxy class name can be "X", while for Oracle8i the name of the same proxy class can be "Y".
getProxyClassName
in class ComponentObjectImpl
public java.lang.String getProxyInterfaceName()
protected void setProxyClassName(java.lang.String platform, java.lang.String proxyClassName)
Sets the name of this View Object's proxy class, given a platform name.
The platforms currently recognized are VB (Visibroker) and 8i (Oracle8i). The proxy class name can be different depending on the Application Server platform. For example, for Visibroker, the proxy class name can be "X", while for Oracle8i the name of the same proxy class can be "Y".
setProxyClassName
in class ComponentObjectImpl
platform
- name of the platform. Currently, can be either
VB (Visibroker) or 8i (Oracle8i).proxyClassName
- a name for the proxy class.public java.lang.String getRowProxyClassName()
Returns the name of this View Object's row proxy class.
public void remove()
If you subclassed View Object to perform some tasks that are not a normal part of the View Object functionality, then you might have to override this method.
remove
in interface ComponentObject
remove
in class ComponentObjectImpl
InvalidOperException
- if the View Object is involved
in a View Link. Remove View Links before removing
the View Object.public void closeRowSet()
RowSet
closeRowSet
removes
this Row Set from the master Row Set Iterator.
closeRowSet
in interface RowSet
public void closeRowSetIterator()
RowSetIterator
closeRowSetIterator
closes all detail row sets.
After that, it fires a RowSetManagementListener.iteratorClosed()
event to its RowSetManagementListener's
.
Then, it deregisters this row set iterator from the owning row set, and deregisters all its listeners.
closeRowSetIterator
in interface RowSetIterator
public byte getAccessMode()
getAccessMode
in interface RowSet
RowSet.setAccessMode(byte)
public void setAccessMode(byte isAccessMode)
RowSet
SCROLLABLE
- if this RowSet should fetch rows
and cache the ViewRows in a collection. This is the most flexible
mode for accessing rows and working with a RowSet.
FORWARD_ONLY
- if this RowSet should only provide
sequential access to Rows in its collection. The iterators on this
RowSet will not allow scrolling back.
RANGE_PAGING
- if this RowSet should fetch rows
in ranges (set using setRangeSize() - the default range size is -1 to
fetch all rows), such that on scroll to the
the next range or to fetch a row that's not in the current range,
it's fetched back from the database using ROWNUM query and the
row at the desired index is placed as the first row in the current
range. 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.
RANGE_PAGING_AUTO_POST
- if this rowset should also
post any changes in this transaction to access a row out of the current
range.
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.
setAccessMode
in interface RowSet
isAccessMode
- One of the four enumerated values SCROLLABLE
,
FORWARD_ONLY
, RANGE_PAGING
, RANGE_PAGING_AUTO_POST
public void setForwardOnly(boolean isForwardOnly)
Forward-only row sets manage only one row, and constrain users to working only with the current row. Data-update operations are not allowed.
Forward-only row sets are useful for
batch operations which proceed linearly.
The only allowed
navigation operation is next()
.
A foward-only row set is faster and
consumes fewer resources than a normal row set.
setForwardOnly
in interface RowSet
isForwardOnly
- true if the row set should be
forward-only.public boolean isForwardOnly()
Forward-only row sets manage only one row, and constrain users to working only with the current row. Data-update operations are not allowed.
Forward-only row sets are useful for
batch operations which proceed linearly.
The only allowed
navigation operation is next()
.
A foward-only row set is faster and
consumes fewer resources than a normal row set.
isForwardOnly
in interface RowSet
RowSet.setForwardOnly(boolean)
public void setAssociationConsistent(boolean isConsistent)
When association-consistency is disabled (the default), changes made in one View Object may not be visible in other View Objects until posted to the database.
When association-consistency is enabled, modified data will be fetched from the cache, rather than from the database, so changes will be visible before they are posted. Rows with modified foreign keys, newly created rows, deletions will be consistently shown. However, performace will be degraded. If association-consistency is on, the row set will reflect rows with modified foreign keys, newly created rows, and removed (deleted) rows.
If association-consistency is off, the user can post the pending changes to database. This way all subsequent queries into the database will include the data changes.
This method is relevant only if this row set was returned by a call to an entity association accessor. This methodl's default value is true for Entity Associations View Objects and false for View Link View Objects.
setAssociationConsistent
in interface RowSet
isConsistent
- true if association-consistency is to be enabled.public boolean isFetchComplete()
RowSet
isFetchComplete
in interface RowSet
true
if the result set has been
fetched to the end.public final boolean isMaxFetchSizeExceeded()
RowSet
isMaxFetchSizeExceeded
in interface RowSet
true
if the result set has been
fetched to the maxFetchSize limit and there
are still more rows in the database.public boolean isAssociationConsistent()
isAssociationConsistent
in interface RowSet
setAssociationConsistent(boolean)
protected java.sql.PreparedStatement getPreparedStatement(int noUserParams, boolean[] barr)
public void closeFreedStatements()
public void showCursorUsage(java.io.Writer out)
Debug routine that prints the cursor usage for this View Object.
out
- where to write the output.protected void beforeEntityRemove(Entity entity)
If some action causes an entity row to be removed, this handler
is invoked (before the entity row is removed). The user can
override this method to respond to the remove event. Note that
this handler is invoked regardless of whether the removed
entity
affects one of the rows in this View Object.
entity
- entity about to be removed.protected void afterEntityRemove(Entity srow)
If some action causes an entity row to be removed, this handler
is invoked (after the entity row is removed). The user can
override this method to respond to the remove event. Note that
this handler is invoked regardless of whether the removed
entity
affects one of the rows in this View Object.
public void sourceChanged(EntityEvent event)
EntityListener
)s.
This event is sent by the entity cache to notify listeners of changes to entity rows. It is invoked for attribute changes and row removal.
When rows are remmoved this method is invoked twice,
first as a BEFORE_REMOVE event,
and then as a STATE_CHANGE
event.
sourceChanged
in interface EntityListener
event
- the Entity Object event.EntityListener
,
EntityEvent
public void afterCommit(TransactionEvent event)
Override this method to perfom any subclass-specific behavior.
afterCommit
in interface TransactionListener
event
- the transaction event.TransactionListener
public void clearCache()
clearCache
in interface ViewObject
public void afterRollback(TransactionEvent event)
afterRollback
in interface TransactionListener
event
- the transaction event.TransactionListener
public void afterRemove(TransactionEvent event)
afterRemove
in interface TransactionListener
event
- the transaction event.TransactionListener
public void beforeCommit(TransactionEvent e)
beforeCommit
in interface TransactionListener
e
- the transaction event.TransactionListener
public void beforeRollback(TransactionEvent e)
beforeRollback
in interface TransactionListener
e
- the transaction event.TransactionListener
public boolean isTransientTransactionListener()
Transient listeners are automatically removed at the end of a transaction commit or rollback cycle; permanent listeners remain across these cycles.
isTransientTransactionListener
in interface TransactionListener
true
if the listener is transient.public void postChanges(TransactionEvent e)
postChanges
in interface TransactionPostListener
e
- ignored.public boolean isPostedToDB()
isPostedToDB
in interface TransactionPostListener
public void setPostedToDB(boolean b)
setPostedToDB
in interface TransactionPostListener
public int getTransPostHandle()
Implements the getTransPostHandle
method for the
(TransactionPostListener
)
interface.
Transaction post handle is a handle identifying a row object in the transaction post listener list. View Objects do not have a transaction post handle, and thus returns -1.
getTransPostHandle
in interface TransactionPostListener
public void setTransPostHandle(int hdl)
Implements the setTransPostHandle
method for the transaction
post listener (TransactionPostListener
)
interface.
Transaction post handle is a handle identifying a row object in the transaction post listener list. View Objects do not have a transaction post handle, and thus this method does nothing.
setTransPostHandle
in interface TransactionPostListener
hdl
- the transaction post handle.
public boolean isTransientTransactionPostListener()
Transient listeners are automatically removed at the end of a transaction post cycle; permanent listeners remain across post cycles. This property does not change.
isTransientTransactionPostListener
in interface TransactionPostListener
false
public void setListenToEntityEvents(boolean b)
This flag controls whether the View Object should listen to entity events or not. If false, the View Object and all its row sets will not receive events generated from changes to entity row data. This is useful for batch processing because suppressing events improves performance.
b
- the new listen-to-entity-events flag.protected ViewObjectImpl findViewLinkAccessorVO(AssociationDefImpl assocDef, java.lang.String voName, ViewDefImpl vDef, ViewLinkDefImpl vlDef)
protected ViewObjectImpl createViewLinkAccessorVO(AssociationDefImpl assocDef, java.lang.String voName, ViewDefImpl vDef, ViewLinkDefImpl vlDef)
protected ViewRowSetImpl createViewLinkAccessorRS(AssociationDefImpl assocDef, ViewObjectImpl accessorVO, Row masterRow, java.lang.Object[] values)
public AttributeDef findViewLinkAccessor(ViewLink vl)
findViewLinkAccessor
in interface ViewObject
vl
- the View Link whose accessor is sought.
null
.public ViewRowSetImpl getByKeyFinderRS()
Returns the most recently opened rowset for servicing retrieveByKey.
protected Row[] retrieveByKey(ViewRowSetImpl rs, Key key, int maxNumOfRows)
protected Row[] retrieveByKey(ViewRowSetImpl rs, Key key, int maxNumOfRows, boolean skipWhere)
public static ViewRowSetIteratorImpl getImplObject(java.lang.Object rsi)
Given a RowSetIterator interface, this routine returns the inner ViewRowSetIteratorImpl object.
rsi
- the outer object that implements the RowSetIterator interface.
public final java.lang.String createXMLDefinition(int depthCount)
depthCount
- represents to what level in the View Object
the creation of the DTD definition
should recurse.public Node writeXML(long options, com.sun.java.util.collections.HashMap voAttrRules)
XMLInterface
ViewObjectImpl
and
ViewRowImpl
implement this method to render
data in XML.
Use this method whenever data is required in XML format, either to present a UI (after converting XML data into some HTTP format using a stylesheet) or to pass the data as payload for messages via JMS.
The options parameter represents a set of bit flags that will control the writeXML behavior. The following bit flags have been defined:
EntityImpl
. The voAttrMap parameter represents in a hashmap, the mapping between a given ViewObject's definition type and the corresponding Attributes/accessors to render. A null entry in the hashmap means, render all attributes and accessors of that viewobject type.
writeXML
in interface XMLInterface
options
- a set of bit flags that will control the writeXMLvoAttrRules
- HashMap containing Definition names of ViewObjects and an
array of AttributeDef to render for a ViewObject of that definition type.public Node writeXML(int depthCount, long options, XSLStylesheet xslt)
writeXML
in interface XMLInterface
depthCount
- represents to what level data writing should recurse.options
- a set of bit flags that will control the writeXML behavior.xslt
- public Node writeXML(long options, com.sun.java.util.collections.HashMap voAttrMap, XSLStylesheet xslt)
writeXML
in interface XMLInterface
public final Node writeXML(int depthCount, long options)
writeXML
in interface XMLInterface
depthCount
- represents to what level data writing should recurse.options
- a set of bit flags that will control the writeXML behavior.protected java.lang.String printXMLDefinition(oracle.jbo.server.RowSetImpl rs, java.util.Hashtable allDefs, java.io.PrintWriter pw, int depthCount)
RowImpl.printXMLDefinition(java.util.Hashtable, java.io.PrintWriter, int)
to generate the definition for the
rowset and all its contents (including contained rowsets if depthCount
is non-zero).
rs
- the rowSet for which you want to generate the DTD definition.allDefs
- a hashtable of predefined XML definitions passed from whatever calls this method.pw
- print writer into which the defnition is being printed.depthCount
- the number of child levels for which the DTD definition should be generated.protected void appendXMLElementNodes(oracle.jbo.server.RowSetImpl rs, Document xmlDoc, Node voNode, int depthCount, long options, com.sun.java.util.collections.HashMap voAttrMap)
rs
- the rowSet to which you want to append row nodes.xmlDoc
- the DTDvoNode
- the View Object node that owns the rowSet.depthCount
- the number of child levels deep to append the row nodes.options
- a set of bit flags that will control the writeXML behavior.protected void appendXMLElementNodes(oracle.jbo.server.RowSetImpl rs, Document xmlDoc, Node voNode, int depthCount, long options)
rs
- the rowSet to which you want to append row nodes.xmlDoc
- the DTDvoNode
- the View Object node that owns the rowSet.depthCount
- the number of child levels deep to append the row nodes.options
- a set of bit flags that will control the writeXML behavior.public final void readXML(Element elem, int depthCount, XSLStylesheet xslt)
JboXMLUtil.processAndReadXML(XMLInterface, org.w3c.dom.Element, int, oracle.xml.parser.v2.XSLStylesheet)
to read in the data from
the XML.
Note that if the XML contains modifications to row-keys, other RowSets
for this object may not pick those changes up unless the rows are posted
to the database. Call Transaction.postChanges()
to sync up all
RowSets for this View Object.
readXML
in interface XMLInterface
elem
- the element to which data should be read.depthCount
- represents to what level reading of data should recurse.xslt
- public final void readXML(Element elem, int depthCount)
Note that if the XML contains modifications to row-keys, other RowSets
for this object may not pick those changes up unless the rows are posted
to the database. Call Transaction.postChanges()
to sync up all
RowSets for this View Object.
readXML
in interface XMLInterface
elem
- the element from which data should be read.depthCount
- represents to what level the reading should recurse.public void readFromXml(XmlDocumentReader reader, Element el)
public java.lang.String getXMLElementTag()
public java.lang.String getXMLRowElementTag()
protected void updateRowSetFromXML(Element node, int depthCount, oracle.jbo.server.RowSetImpl rs)
node
- the node that corresponds to the row which is sought.depthCount
- represents to what level the updating should recurse.rs
- the rowSet in which the row should be found.
ReadXMLException
- when the read operation
fails while reading the rows for this rowset. This exception
may contain one exception per Row in this rowset.protected boolean checkPassivateViewAttributes()
protected final boolean isPassivatableTransientAttribute(ViewAttributeDefImpl voAttr)
protected final void setPassivatableTransientAttribute(ViewAttributeDefImpl voAttr, boolean flag)
protected void passivateState(Document doc, Element parent)
passivateState(ViewRowImpl, Document, Element)
is
that this method may be used to store custom data that does not depend
upon the VO Iterator or RowSet state which may include:
By default the ViewObject does not store anything in this method. On
activation, the ViewObject calls activateState(Element)
with
the parent element for the reverse operation.
doc
- the XML document where the custom data will be stored.parent
- the parent element under which the custom data will be
stored.protected void passivateState(ViewRowImpl currentRow, Document doc, Element parent)
This method lets customized View Objects determine how they want to store private data for:
The only requirement is that this data should be stored under a child node under the parent element. Note that the data cannot be stored under the first child, because that is where default passivation routines always store the key.
The default implementation of this method stores transient row data and new row tracker data in the parent element. The default implementation should not be overriden.
On activation, the View Object calls activateState(Element)
to notify
the activation of ViewObject instance state and activateState(ViewRowImpl, Element)
with the
currentRow, and parent element to notify the activation of iterator state.
currentRow
- the View Row for which the key has been passivated.doc
- the name of the XML document where the custom data will be
stored.parent
- the name of the parent element under which the custom data
will be stored.protected void passivateState(ViewRowSetImpl vrs, ViewRowImpl currentRow, Document doc, Element parent)
protected void passivateNewRowTracker(QueryCollection qc, RowFilterKey rf, Document doc, Element parent)
protected void passivateTransients(ViewRowImpl currentRow, AttributeDefImpl[] attrs, Document doc, Element parent)
protected void passivateTransients(ViewRowSetImpl vrs, ViewRowImpl currentRow, AttributeDefImpl[] attrs, Document doc, Element parent)
protected void activateNewRowTracker(Element parent)
protected void activateNewRowTracker(ViewRowSetImpl vrs, Element parent)
protected ViewRowImpl handleActivatedRowNotFound(Key k)
Typically Applications will throw a RowNotFoundException for these cases based on their locking modes. By default this method simply prints a diagnostic warning.
k
- Key object for the row that was not found during activation.protected void activateTransientAttribute(ViewRowImpl row, Node transRow, AttributeDefImpl ad)
protected void activateTransients(AttributeDefImpl[] attrs, Element parent)
protected void activateTransients(ViewRowSetImpl vrs, AttributeDefImpl[] attrs, Element parent)
protected void activateState(Element parent)
activateState(ViewRowImpl, Element)
in that the ViewObject RowSet and Iterator state are not restored when
this method is invoked. Applications that define persistent, custom
data which is dependent upon RowSet and/or Iterator state should
extend passivateState(ViewRowImpl, Document, Element)
and
activateState(ViewRowImpl, Element)
instead.
parent
- element which could be null if nothing was passivated in it in passivateStateprotected void activateState(ViewRowImpl currentRow, Element parent)
currentRow
- the View Row for which the key has been passivated. This could be
null if there is no current row or current row could not be activated.parent
- the name of the parent element under which the custom data resides.
This could be null if there was no custom data stored for this VO in passivateState.protected void activateState(ViewRowSetImpl vrs, ViewRowImpl currentRow, Element parent)
vrs
- ViewRowSetImpl being activated.currentRow
- the View Row for which the key has been passivated. This could be
null if there is no current row or current row could not be activated.parent
- the name of the parent element under which the custom data resides.
This could be null if there was no custom data stored for this VO in passivateState.public void readRowXML(Element rowElt, int depthCount)
ViewObject
The depthcount parameter represents to what level the rendering should recurse. A depthcount of zero (0) means do not traverse any View Links while rendering. One (1) means traverse the View Links on this object but no View Links thereafter, and so on.
readRowXML
in interface ViewObject
public void readRowXML(Element elem, int depthCount, XSLStylesheet xslt)
readRowXML
in interface ViewObject
public void setQueryOptimizerHint(java.lang.String hintText)
setQueryOptimizerHint
in interface ViewObject
public java.lang.String getQueryOptimizerHint()
getQueryOptimizerHint
in interface ViewObject
public void dumpQCs()
Debugging aid to dump info for QCs.
public Row findRowInQCs(java.lang.Object[] rowFilterValues, Key key, java.lang.Object rowHandle)
public void activateIteratorState(Element node, boolean clearIteratorState)
Used by the framework to force an iterator activation. Applications
should extend #activateIteratorState(ViewRowImpl, Element)
.
protected ViewRowImpl activateCurrentRow(ViewRowSetIteratorImpl vrsi, ViewRowSetImpl vrs, Key key)
Override this method and use another VO to fetch an equivalent row and add it to the given ViewRowSet. The caller activation routine will set the row as current.
protected void prepareForActivation(Element amNode)
protected void prepareForPassivation(Document out, Element parent)
out
- Document in which to create xml nodes.parent
- Element node under which this VO's data is being passivated.protected void resetSession()
ApplicationModuleImpl.resetState(boolean)
public void setPassivationEnabled(boolean enabled)
public boolean isPassivationEnabled()
setPassivationEnabled(boolean)
public Row[] getFilteredRows(RowQualifier qualifier)
public Row[] getFilteredRowsInRange(RowQualifier qualifier)
public Row[] getFilteredRows(java.lang.String attrName, java.lang.Object attrValue)
RowSetIterator
attrValue
.
Note that this method does not affect the current RowSetIterator
.
getFilteredRows
in interface RowSetIterator
attrName
- name of the attribute to be used for filtering.attrValue
- attribute value for filtering.
public Row[] getFilteredRowsInRange(java.lang.String attrName, java.lang.Object attrValue)
RowSetIterator
attrValue
.
This method uses getAllRowsInRange()
to retrieve
all rows and then match the rows.
getFilteredRowsInRange
in interface RowSetIterator
attrName
- name of the attribute to be used for filtering.attrValue
- attribute value for filtering.
|
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.