Business Components

oracle.jbo.server
Class ViewObjectImpl

java.lang.Object
  |
  +--oracle.jbo.common.BaseObject
        |
        +--oracle.jbo.server.NamedObjectImpl
              |
              +--oracle.jbo.server.ComponentObjectImpl
                    |
                    +--oracle.jbo.server.ViewObjectImpl

public class ViewObjectImpl
extends ComponentObjectImpl
implements ViewObject, EntityListener, TransactionListener, TransactionPostListener

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.

Since:
JDeveloper 3.0
See Also:
ViewObject, RowSet, ViewRowSetImpl

Field Summary
static byte FETCH_ALL
          A fetch mode that causes 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
          Not implemented. A fetch mode that causes all rows to be retrieved from a JDBC result set.
protected  java.lang.String mAssocClause
           
protected  java.util.Vector mAssocRefs
           
protected  oracle.jbo.server.ViewAttributeDefImpl[] mAttrDefs
           
protected  boolean mAutoPostChanges
           
static int mDefaultMaxActiveNodes
           
static int mDefaultMaxRowsPerNode
           
static int MIN_ACTIVE_NODES
           
static int MIN_ROWS_PER_NODE
           
protected  oracle.jbo.server.ViewAttributeDefImpl[] mKeyAttrRefs
           
protected  java.lang.String mOrderBy
           
static boolean mUsePersColl
           
protected  java.lang.String mUserDefinedQuery
           
protected  oracle.jbo.server.ViewDefImpl mViewDef
           
protected  ViewRowSetImpl mViewRowSet
           
protected  java.lang.String mWhere
           
 
Fields inherited from class oracle.jbo.server.NamedObjectImpl
mFullName, mName, mParent, mProperties
 
Fields inherited from class oracle.jbo.common.BaseObject
TRACE_EVERY_ALLOC, TRACE_NONE, TRACE_OCCASIONAL, TRACE_UNINITIALIZED
 
Fields inherited from interface oracle.jbo.XMLInterface
XML_OPT_CHANGES_ONLY, XML_OPT_LIMIT_RANGE
 
Fields inherited from interface oracle.jbo.RowIterator
SLOT_BEFORE_FIRST, SLOT_BEYOND_LAST, SLOT_DELETED, SLOT_VALID
 
Constructor Summary
ViewObjectImpl()
          Constructs a new View Object.
ViewObjectImpl(java.lang.String name, oracle.jbo.server.ViewDefImpl voDef)
          Constructs a new View Object.
 
Method Summary
protected  void activateState(ViewRowImpl currentRow, org.w3c.dom.Element parent)
           
 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 addOrderByClause(java.lang.String expr)
          Appends an expession to the query's ORDER BY clause.
 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, org.w3c.dom.Document xmlDoc, org.w3c.dom.Node voNode, int depthCount, long options)
          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  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  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.
 void clearCache()
          Clears the View Object cache.
 RowSet createDetailRowSet(java.lang.String rsName, java.lang.String linkDefName)
          Creates and returns an new detail row set for this row set iterator.
 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.
 Row createRow()
          Creates a new view row.
 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.
 java.lang.String createXMLDefinition(int depthCount)
          Creates a DTD defintion for the View Object and all its contents (including contained RowSets if bContainees is true)
 java.util.Enumeration enumerateRowsInRange()
          Creates and returns an enumerator of the rows in the range.
 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.
 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)
          Creates an array of rows matching a given key.
 AttributeDef findViewLinkAccessor(ViewLink vl)
          Finds the View Link accessor attribute.
 Row first()
          Navigates to the first row in the row set.
 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.
 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 getBindingStyle()
          Returns the binding style.
 int getCalculatedAttributeCount()
          Counts the number of "calculated" attributes.
 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()
          Gets the default view row set.
 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.
 RowSet[] getDetailRowSets()
          Returns an array of all detail row sets for this row set iterator.
protected  EntityDefImpl[] getEntityDefs()
          Returns an array of entity definitions of the entity bases.
 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.
static ViewRowSetIteratorImpl getImplObject(java.lang.Object rsi)
           
 AttributeDef[] getKeyAttributeDefs()
          Constructs an array of definitions of key attributes for the View Object.
 RowSetIterator[] getMasterRowSetIterators()
          Returns an array of all master row set iterators for this row set.
 int getMaxFetchSize()
          Gets the maximum row fetch size.
 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.
 AttributeDefImpl[] getPrimaryKeys()
          Constructs an array of entity attribute definitions of the primary keys of the View Object's Entity Objects.
 java.util.Hashtable getProperties()
          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.
protected  java.lang.String getProxyClassName(java.lang.String platform)
          Internal: Applications should not use this method.
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.
 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()
           
 Row getRowFromHandle(java.lang.Object hdl)
          Internal: Applications should not use this method.
 java.lang.String getRowProxyClassName()
          Internal: Applications should not use this method.
 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.
 int getTransPostHandle()
          Internal: Applications should not use this method.
 java.lang.String getUserDefinedQuery()
          Gets the user-defined query, if one exists.
 oracle.jbo.server.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  oracle.jbo.server.ViewDefImpl getViewDef()
          Internal: Applications should not use this method.
 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 the 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.
protected  java.lang.String getXMLElementTag()
          Returns the XML element name for this View Object.
 boolean hasNext()
          Indicates whether the iterator has a next row.
 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.
protected  boolean isForeignKey(oracle.jbo.server.ViewAttributeDefImpl attr)
          Checks if a view attribute is involved in a View Link in which this View Object is detail.
 boolean isForwardOnly()
          Indicates whether this row set is forward-only.
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 isTransientTransactionListener()
          Tests whether this transaction listener is transient or permanent.
 boolean isTransientTransactionPostListener()
          Reports that this view object is not a transient transaction post listener.
 Row last()
          Navigates to the last row in the row set.
 Row next()
          Navigates to the next row in the row set.
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 passivateState(ViewRowImpl currentRow, org.w3c.dom.Document doc, org.w3c.dom.Element parent)
           
 void postChanges(TransactionEvent e)
          This method is not implemented in this class.
 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 the RowImpl.printXMLDefintion to generate the definition for the rowset and all its contents (including contained rowsets if bContainees is true).
 void readXML(org.w3c.dom.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(org.w3c.dom.Element elem, int depthCount, oracle.xml.parser.v2.XSLStylesheet xslt)
          Given the document interface, finds the rowset Element and invokes readFromXMLElementNode() to read in the data from the XML.
 void remove()
          Removes this View Object from its containing application module.
 void removeCurrentRow()
          Removes the current row.
 void removeListener(java.lang.Object listener)
          Removes an event listener.
 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.
 void reset()
          Resets the iterator.
 int scrollRange(int amount)
          Scrolls the range.
 int scrollRangeTo(Row row, int index)
          Scrolls the range to a specified row.
 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 setFetchMode(byte fetchMode)
          Sets the fetch mode.
 void setFetchSize(short size)
           
 void setForwardOnly(boolean isForwardOnly)
          Sets whether this row set will be forward-only or not.
 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.
 boolean setMasterRowSetIterator(RowSetIterator masterRSI)
          Sets the master row set iterator in a master-detail View Link.
 void setMaxFetchSize(int size)
          Set the maximum number of rows to fetch during query processing.
 void setOrderByClause(java.lang.String orderByClause)
          Sets the query's ORDER BY clause.
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 setQueryChanged(boolean isChanged)
          Internal: Applications should not use this method.
 int setRangeSize(int size)
          Sets the range size for the iterator.
 int setRangeStart(int start)
          Positions the range.
 void setRowValidation(boolean flag)
          Sets the validation flag on this iterator.
 void setTransPostHandle(int hdl)
          Internal: Applications should not use this method.
 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(org.w3c.dom.Element node, int depthCount, oracle.jbo.server.RowSetImpl rs)
          /* Creates a key from the given element's sub-elements to find out an existing row, and if found, updates the row with other attribute values, else creates a new row and sets the attribute values and inserts the row in the rowset.
 void validate()
          Validates all view rows within this View Object.
 org.w3c.dom.Node writeXML(int depthCount, long options)
          Writes the contents of this View Object by creating a new RowSet and rendering it in XML.
 org.w3c.dom.Node writeXML(int depthCount, long options, oracle.xml.parser.v2.XSLStylesheet xslt)
          Writes the contents of this View Object by creating a new RowSet and rendering it in XML.
 
Methods inherited from class oracle.jbo.server.ComponentObjectImpl
addListener, create, createRef, getCompListeners, getRootApplicationModule, isRegWithPiggyMan
 
Methods inherited from class oracle.jbo.server.NamedObjectImpl
getFullName, getName, getParent, getPropertiesAsStrings, refreshProperty, setFullName, setProperty
 
Methods inherited from class oracle.jbo.common.BaseObject
dumpState, setTraceLevel, setTraceWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FETCH_AS_NEEDED

public static final 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.

See Also:
setFetchMode(byte)

FETCH_ALL

public static final byte FETCH_ALL
A fetch mode that causes rows to be retrieved from a JDBC result set immediately, and then closes the result set.

See Also:
setFetchMode(byte)

FETCH_DEFAULT

public static final byte FETCH_DEFAULT
Not implemented. A fetch mode that causes all rows to be retrieved from a JDBC result set.

See Also:
setFetchMode(byte)

mViewDef

protected oracle.jbo.server.ViewDefImpl mViewDef

mAssocRefs

protected java.util.Vector mAssocRefs

mAssocClause

protected java.lang.String mAssocClause

mUserDefinedQuery

protected java.lang.String mUserDefinedQuery

mOrderBy

protected java.lang.String mOrderBy

mWhere

protected java.lang.String mWhere

mViewRowSet

protected ViewRowSetImpl mViewRowSet

mAttrDefs

protected oracle.jbo.server.ViewAttributeDefImpl[] mAttrDefs

mKeyAttrRefs

protected oracle.jbo.server.ViewAttributeDefImpl[] mKeyAttrRefs

mAutoPostChanges

protected boolean mAutoPostChanges

mUsePersColl

public static boolean mUsePersColl

mDefaultMaxRowsPerNode

public static int mDefaultMaxRowsPerNode

mDefaultMaxActiveNodes

public static int mDefaultMaxActiveNodes

MIN_ROWS_PER_NODE

public static final int MIN_ROWS_PER_NODE

MIN_ACTIVE_NODES

public static final int MIN_ACTIVE_NODES
Constructor Detail

ViewObjectImpl

public ViewObjectImpl()
Constructs a new View Object.

ViewObjectImpl

public ViewObjectImpl(java.lang.String name,
                      oracle.jbo.server.ViewDefImpl voDef)
Constructs a new View Object.
Parameters:
name - the name to be assigned to the View Object.
voDef - a view definition.
Method Detail

getProperty

public java.lang.Object getProperty(java.lang.String propName)
Retrieves the specified property. If it is not found in this View Object, is is retrieved from the view definition.
Overrides:
getProperty in class NamedObjectImpl
Parameters:
propName - the name of the property.
Returns:
the property's value, or null if not found.

getProperties

public java.util.Hashtable getProperties()
Retrieves all properties pertaining to this View Object.
Overrides:
getProperties in class NamedObjectImpl
Returns:
a hash table of the properties of the View Object and the view definition.

getApplicationModule

public final ApplicationModule getApplicationModule()
Returns the application module to which this View Object belongs. This method should not be overridden.
Overrides:
getApplicationModule in class ComponentObjectImpl
Returns:
an application module.

getDefName

public java.lang.String getDefName()
Returns the name of the view definition from which this view object was created. This method should not be overridden.

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...
                }
 
Overrides:
getDefName in class ComponentObjectImpl
Returns:
the view definition name, without its package name.

getDefFullName

public java.lang.String getDefFullName()
Returns the full name of the view definition from which this View Object was created. For example, given a View Object, use this method to get the View Def name, in order to create another instance of the object based on the View Def name.

The name has the format packageName.ViewDefName.

Overrides:
getDefFullName in class ComponentObjectImpl
Returns:
the fully qualified view definition name.

getViewDef

protected oracle.jbo.server.ViewDefImpl getViewDef()
Internal: Applications should not use this method.

Returns the view definition object from which this View Object was created.

Returns:
the view definition.

getViewAttributeDefImpls

public oracle.jbo.server.ViewAttributeDefImpl[] getViewAttributeDefImpls()
Internal: Applications should not use this method.

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.

Returns:
an array of view attribute definitions.

getViewLinks

public ViewLink[] getViewLinks()
Constructs an array of View Links that involve this View Object.

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() == this
 
This method should not be overridden.
Returns:
the array of View Links.

getViewLinkNames

public java.lang.String[] getViewLinkNames()
Constructs an array of names of View Links that involve this View Object.

A View Link may use this View Object as either its source or destination. This method should not be overridden.

Specified by:
getViewLinkNames in interface ViewObject
Returns:
the array of View Link names.

isReadOnly

public boolean isReadOnly()
Tests whether this View Object is read-only.

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.

Specified by:
isReadOnly in interface ViewObject
Returns:
true if this View Object is read-only; false if it is updateable.

getQueryCollection

public QueryCollection getQueryCollection()
Internal: Applications should not use this method.

Returns the query collection for this View Object's default row set.

Returns:
the QueryCollection for the default row set.

getDefaultRowSet

public ViewRowSetImpl getDefaultRowSet()
Gets the default view row set.

This row set has the same name as this View Object. This method should not be overridden.

Returns:
the default row set.

getWhereClause

public java.lang.String getWhereClause()
Gets the query's WHERE clause. If the query does not have a WHERE clause, this method returns null.

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

Specified by:
getWhereClause in interface ViewObject
Returns:
the WHERE clause; null if no WHERE clause exists.

addWhereClause

public void addWhereClause(java.lang.String expr)
Appends an additional WHERE clause to the query.

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.

Parameters:
expr - the SQL WHERE clause to be appended.

setWhereClause

public void setWhereClause(java.lang.String whereClause)
Sets the query's WHERE clause.

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.
Specified by:
setWhereClause in interface ViewObject
Parameters:
whereClause - a SQL WHERE clause.

getOrderByClause

public java.lang.String getOrderByClause()
Returns the query's ORDER BY clause. If the query does not have an ORDER BY clause, this method returns null.

This method should not be overridden.

Specified by:
getOrderByClause in interface ViewObject
Returns:
the SQL ORDER BY clause; null if no ORDER BY clause exists.

addOrderByClause

public void addOrderByClause(java.lang.String expr)
Appends an expession to the query's ORDER BY clause.

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.

Parameters:
expr - the SQL ORDER BY expression to be appended.

setOrderByClause

public void setOrderByClause(java.lang.String orderByClause)
Sets the query's ORDER BY clause.

The new ORDER BY clause does not take effect until executeQuery is called.

This method should not be overridden.

Specified by:
setOrderByClause in interface ViewObject
Parameters:
orderByClause - a SQL ORDER BY clause.

getWhereClauseParams

public java.lang.Object[] getWhereClauseParams()
Constructs an array of the bind values currently specified for the query's WHERE clause. This method delegates its call to the default RowSet.

This method should not be overridden.

Returns:
the array of bind values.

isExecuted

public boolean isExecuted()
Indicates whether the row set has been executed or not.
Returns:
true if the row set has been executed.

setWhereClauseParams

public void setWhereClauseParams(java.lang.Object[] values)
Sets the query's bind values. This method delegates its call to the default RowSet.

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.
Parameters:
values - an array of bind values.

setWhereClauseParam

public void setWhereClauseParam(int index,
                                java.lang.Object value)
Sets a specified the bind value, by index position. This method delegates its call to the default RowSet.

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.
Parameters:
index - the position of the bind value.
value - the bind value.

getDBTransaction

public DBTransaction getDBTransaction()
Gets the transaction within which this View Object operates.

This method should not be overridden.

Returns:
the database transaction.

getUserDefinedQuery

public java.lang.String getUserDefinedQuery()
Gets the user-defined query, if one exists.

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.

Returns:
the user-defined SQL query if one exists, otherwise, null.

getQuery

public java.lang.String getQuery()
Returns the query statement. Unlike getUserDefinedQuery this method will return a SQL statement regardless of whether the query was created in Expert or non-Expert Mode.

Specified by:
getQuery in interface ViewObject
Returns:
the user-defined SQL query if one exists, otherwise, a query statement is assembled from defined FROM, WHERE, and ORDER BY clauses.

getQueryHitCount

public long getQueryHitCount(ViewRowSetImpl viewRowSet)
Counts the number of rows that would be returned if the View Object were executed with the current query.

This method obtains the row count by executing:

    SELECT COUNT(1) FROM query-statement;
 
Based on the value returned, you might want to adjust the JDBC row prefetch size.
Returns:
the number of rows.

buildWhereClause

protected boolean buildWhereClause(java.lang.StringBuffer sqlBuffer,
                                   int noUserParams)
Builds the WHERE clause part of the query and adds it into the string buffer.

The WHERE clause is made up of the following parts:

Parameters:
sqlBuffer - StringBuffer into which the WHERE clause is appended.
defWhereClause - WHERE clause from the definition object.
noUserParams - the number of bind variables in the WHERE clause. Typically, this number is getWhereClauseParams().length.
Returns:
true if a WHERE clause was appended.

buildOrderByClause

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.

The order-by-clause is made up of the following parts:

Parameters:
sqlBuffer - StringBuffer into which the order-by-clause is appended.
defOrderByClause - order-by-clause from the definition object.
Returns:
true if an order-by-clause was appended.

setQuery

public void setQuery(java.lang.String query)
Sets the user-defined 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.

Parameters:
query - a user-defined query statement.
Throws:
InvaildOperException - if this method is called on a View Object that is a detail of a View Link.

getParametersAsStorageTypes

public java.lang.Object[] getParametersAsStorageTypes()
Constructs an array of the bind values used for binding arguments to the query. If the bind values are domain instances the actual data is retrieved from the domain.

The resulting array is a union of the following sets of bind values:

Returns:
the array of the bind values as storage types, or null if none.

getRowClass

public java.lang.Class getRowClass()
Gets the Java class of this View Object's rows. Typically, this will be an instance of the oracle.jbo.server.ViewRowImpl class. If the Row Class (ViewRowImpl) was overridden during the Design Time, override this method.
Returns:
a Java class.
See Also:
ViewRowImpl

createInstance

public ViewRowImpl createInstance(ViewRowSetImpl viewRowSet,
                                  AttributeList attrValList)
Creates a view row instance.

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.

Parameters:
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.
Returns:
a new view row instance.
See Also:
createRow()

createInstanceFromResultSet

public ViewRowImpl createInstanceFromResultSet(QueryCollection qc,
                                               java.sql.ResultSet resultSet)
Internal: Applications should not use this method.

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.

Parameters:
qc - query collection.
resultSet - JDBC ResultSet.
Returns:
a new view row instance.

getEntityDefs

protected EntityDefImpl[] getEntityDefs()
Returns an array of entity definitions of the entity bases.

This method could be used to perform meta-data initializations like "custom" Properties that are calculated using the current transaction.

Returns:
an array of entity definitions of the entity bases.

getAttributeDefs

public AttributeDef[] getAttributeDefs()
Constructs an array of attribute definitions.

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.
Returns:
an array of attribute definitions.

getKeyAttributeDefs

public AttributeDef[] getKeyAttributeDefs()
Constructs an array of definitions of key attributes for the View Object.

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.

Specified by:
getKeyAttributeDefs in interface ViewObject
Returns:
the array of attribute definitions.

getCalculatedAttributeCount

public int getCalculatedAttributeCount()
Counts the number of "calculated" attributes.

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.

Returns:
the number of calculated attributes.

getPrimaryKeys

public AttributeDefImpl[] getPrimaryKeys()
Constructs an array of entity attribute definitions of the primary keys of the View Object's Entity Objects.

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.

Returns:
the array of entity attribute definitions.

executeQuery

public void executeQuery()
Executes the query.

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().

See Also:
setFetchMode(byte), oracle.jbo.RowSetListener#rangeRefreshed(), RangeRefreshEvent

executeQueryForCollection

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. If this method is overridden, the custom logic will be applied to all row sets.

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.

Parameters:
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.

getAttributeCount

public int getAttributeCount()
Counts a View Object's attributes.

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.
Returns:
the number of attributes.

findAttributeDef

public AttributeDef findAttributeDef(java.lang.String name)
Finds a named attribute definition.

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 clause
 
This method should not be overridden.
Parameters:
name - the name of the attribute.
Returns:
the attribute definition of the given name.
Throws:
InvalidDefNameException - if the name is invalid.
NoDefException - if the attribute is not found.

getAttributeDef

public AttributeDef getAttributeDef(int index)
Gets the attribute definition at the specified position. The following code snippet uses this method to find and print the attribute names and values in a row.

  // 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.
Parameters:
index - the position of the attribute definition.
Returns:
the attribute definition, or null if the index is out of range.

addDynamicAttribute

public AttributeDef addDynamicAttribute(java.lang.String attrName)
Adds a dynamic attribute to this View Object.

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.

This method should not be overridden.

Specified by:
addDynamicAttribute in interface ViewObject
Parameters:
attrName - the name of the dynamic attribute.
Returns:
the attribute definition the newly added dynamic attribute.
Throws:
NameClashException - if an attribute of the same name already exists.

getAttributeIndexOf

public int getAttributeIndexOf(java.lang.String attrName)
Gets the index of an attribute given its name.

For example:

 int idxQuantity  = this.getAttributeIndexOf("Quantity");
 
This method should not be overridden.
Parameters:
attrName - the name of the attribute.
Returns:
the index of the attribute.
Throws:
NoDefException - if the attribute is not found.

isDynamicAttribute

public boolean isDynamicAttribute(int index)
Indicates whether an attribute is dynamic.

This method should not be overridden.

Parameters:
index - the attribute's position.
Returns:
true if the attribute is dynamic; false otherwise.

isDynamicAttribute

public boolean isDynamicAttribute(java.lang.String name)
Indicates whether the named attribute is dynamic.

This method should not be overridden.

Parameters:
name - the attribute'same.
Returns:
true if the attribute is dynamic, or false otherwise.

validate

public void validate()
Validates all view rows within this View Object.

This method enumerates through all rows in the row set and calls validate() on any that have been modified.

Throws:
ValidationException - if validation fails for any row.
See Also:
ViewRowImpl.validate()

isAutoPostChanges

public boolean isAutoPostChanges()
Indicates whether auto-post-changes is enabled or not. The default is false

If true, changes are automatically posted to the database before the View Object's query is executed.

Returns:
true if auto-post-changes is enabled.

setAutoPostChanges

public void setAutoPostChanges(boolean bAutoPostChanges)
Sets the auto-post-changes flag.

If enabled, changes are automatically posted to the database before the View Object's query is executed.

Parameters:
bAutoPostChanges - true enables auto-post-changes.

buildRowFilter

protected RowFilter buildRowFilter(java.lang.Object[] paramValues)

getRowFilters

protected java.util.Enumeration getRowFilters()

isCollectionPresent

protected boolean isCollectionPresent(RowFilter rowFilter)

getQualifyingRowFilters

protected RowFilter[] getQualifyingRowFilters(java.lang.Object[] rowParamValues)

buildNewCollection

protected RowFilter buildNewCollection(java.lang.Object[] newParamValues)

buildQualifyingRowFilters

protected RowFilter[] buildQualifyingRowFilters(java.lang.Object[] newParamValues)

getFetchMode

public byte getFetchMode()
Gets the current fetch mode.

For more information on fetch modes, see setFetchMode.

Returns:
the fetch mode. Can be FETCH_ALL or FETCH_AS_NEEDED.
See Also:
setFetchMode(byte fetchMode)

setFetchMode

protected void setFetchMode(byte fetchMode)
Sets the fetch mode.

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.

FETCH_DEFAULT should not used for now.

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 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.

Parameters:
fetchMode - the new fetch mode. Can be FETCH_ALL or FETCH_AS_NEEDED.

getBindingStyle

public int getBindingStyle()
Returns the binding style. Can be one of:

Returns:
the binding style. Can be one of BINDING_STYLE_ORACLE, BINDING_STYLE_JDBC, or BINDING_STYLE_UNKNOWN.

setBindingStyle

public void setBindingStyle(int bindingStyle)
Sets the binding style. Can be one of:

Parameters:
bindingStyle - the binding style. Can be one of BINDING_STYLE_ORACLE, BINDING_STYLE_JDBC, or BINDING_STYLE_UNKNOWN.

getFetchSize

public short getFetchSize()
Gets the row pre-fetch 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.

Returns:
the row pre-fetch size.

getMaxFetchSize

public int getMaxFetchSize()
Gets the maximum row fetch size.

This number is used to set the maximum number of rows to retrieve from JDBC. The default is 0, indicating no limit.

Specified by:
getMaxFetchSize in interface ViewObject
Returns:
the maximum row fetch size.

setFetchSize

public void setFetchSize(short size)

setMaxFetchSize

public void setMaxFetchSize(int size)
Set the maximum number of rows to fetch during query processing. This number is used to set the maximum number of rows to retrieve for this ViewObject. The default is 0, indicating no limit.
Specified by:
setMaxFetchSize in interface ViewObject
Parameters:
size - the number of rows.

createViewCriteria

public ViewCriteria createViewCriteria()
Creates a new view criteria object for this View Object. A view criteria object is an alternative to using an arbitrary SQL statement. A view criteria is a list of row criteria for a View Object's WHERE clause, where a row criteria is an array containing criteria for the individual attributes.

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.

Specified by:
createViewCriteria in interface ViewObject
Returns:
the new view criteria object.
See Also:
ViewCriteria, applyViewCriteria(ViewCriteria)

applyViewCriteria

public void applyViewCriteria(ViewCriteria criteria)
Applies the view criteria to this View Object.

This method should not be overridden.

Specified by:
applyViewCriteria in interface ViewObject
Parameters:
criteria - the view criteria to apply.

getViewCriteria

public ViewCriteria getViewCriteria()
Gets the view criteria for this View Object.

This method should not be overridden.

Specified by:
getViewCriteria in interface ViewObject
Returns:
the view criteria, or null if none is specified.

getViewCriteriaClause

public java.lang.String getViewCriteriaClause()
Generates the WHERE clause expression from the view criteria. The view criteria is used to generate a WHERE clause. This method returns a String representation of that clause.

This method should not be overridden.

Returns:
the SQL statement's WHERE clause.

setKeyAttributeDefs

public void setKeyAttributeDefs(int[] keyIndices)
Advanced method: Sets the key attributes for this ViewObject to be the attributes at the given indices. 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

getRowSet

public RowSet getRowSet()
Returns the View Object as a RowSet object.

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.

See Also:
RowSetIterator.getRowSet()

getRowSetIterator

public RowSetIterator getRowSetIterator()
Gets the row set iterator interface of this View Object. That is, it returns the View Object as a RowSetIterator object.
Returns:
a row set interface.

next

public Row next()
Navigates to the next row in the row set.

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 RowSetListeners.

When successful, this method fires a NavigationEvent to registered RowSetListeners, by calling RowSetListener.navigated(). The row returned is designated as the current row.

Returns:
the next row, or null if no next row.
Throws:
ValidationException - if the prevously current row fails validation.
See Also:
NavigationEvent, RowSetListener, ScrollEvent, ViewRowImpl.validate()

previous

public Row previous()
Navigates to the previous row in the row set.

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 registeredRowSetListeners.

When successful, this method fires a NavigationEvent to registered RowSetListeners, by calling RowSetListener.navigated(). The row returned is designated as the current row.

Returns:
the previous row, or null if no previous row.
Throws:
ValidationException - if the prevously current row fails validation.
See Also:
NavigationEvent, RowSetListener, ScrollEvent, ViewRowImpl.validate()

first

public Row first()
Navigates to the first row in the row set.

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 RowSetListeners.

When successful, this method fires a NavigationEvent to registered RowSetListeners, by calling RowSetListener.navigated(). The row returned is designated as the current row.

Returns:
the first row, or null if the set has no rows.
Throws:
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.
See Also:
NavigationEvent, RowSetListener, ViewRowImpl.validate()

last

public Row last()
Navigates to the last row in the row set.

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 RowSetListeners.

When successful, this method fires a NavigationEvent to registered RowSetListeners, by calling RowSetListener.navigated(). The row returned is designated as the current row.

Returns:
the last row, or null if the set has no rows.
Throws:
ValidationException - if the prevously current row fails validation.
See Also:
NavigationEvent, RowSetListener, ViewRowImpl.validate()

reset

public void reset()
Resets the iterator.

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.


hasNext

public boolean hasNext()
Indicates whether the iterator has a next row.

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.

Returns:
true if the row set has a next row, or false if not.

hasPrevious

public boolean hasPrevious()
Indicates whether the iterator has a previous row or not.

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.

Returns:
true if the row set a previous row, or false if not.

isRangeAtBottom

public boolean isRangeAtBottom()
Indicates whether the iterator range contains the last row of the row set.

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.

Returns:
true if the range contains the last row, or false if not.

isRangeAtTop

public boolean isRangeAtTop()
Indicates whether the iterator range contains the first row of the row set.

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.

Returns:
true if the range contains the first row, or false if not.

getFetchedRowCount

public int getFetchedRowCount()
Counts the number of rows fetched from the JDBC result set.

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 the latter returns a value less than the former, then the View Object has not read all rows from the cursor.

Returns:
the number of rows already fetched.

getRowCount

public int getRowCount()
Counts the total number of rows in this row set.

This method retrieves rows until the last row is retrieved. Thus, this operation may be slow.

Use getEstimatedRowCount to obtain a quicker count.

Returns:
the number of rows in the row set.
See Also:
getEstimatedRowCount()

getEstimatedRowCount

public long getEstimatedRowCount()
Makes an estimated count of the rows in this row set.

This method estimates the number of rows in the row count by calling getQueryHitCount, and then modifies this number as rows are added 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();
 
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 the latter returns a value less than the former, then the View Object has not read all rows from the cursor.
Returns:
an estimate of the number of rows in the row set.
See Also:
getQueryHitCount(ViewRowSetImpl), getFetchedRowCount()

setRangeSize

public int setRangeSize(int size)
Sets the range size for the iterator.

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);
 
Parameters:
size - the new range size, or -1 if all rows are to be included.
Returns:
the new range size.
Throws:
InvalidOperException - if the iterator is forward-only and size is greater than 1.

getRangeSize

public int getRangeSize()
Returns the range size of the iterator.

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());
 
Returns:
the range size.

getRangeStart

public int getRangeStart()
Returns the absolute row index of the first row in the range.

An absolute row index is a row index in the entire row set.

For an example usage of this method, see setRangeStart

Returns:
the absolute row index of the first row in the range.

setRangeStart

public int setRangeStart(int start)
Positions the range.

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());
 
Parameters:
start - an absolute row index.
Returns:
the absolute row index of the first row of the resulting range.
See Also:
ScrollEvent, RowSetListener

scrollRange

public int scrollRange(int amount)
Scrolls the range.

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 RowSetListeners.

Parameters:
amount - the number of rows to scroll.
Returns:
the actual number of rows scrolled. A negative number indicates an upward scroll.
Throws:
InvalidOperException - if this method is called on on a forward-only row set and amount is negative.
See Also:
ScrollEvent, RowSetListener

scrollRangeTo

public int scrollRangeTo(Row row,
                         int index)
Scrolls the range to a specified row.

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 RowSetListeners.

Parameters:
row - the row to scroll the range to.
index - the range index at which row is to be positioned.
Returns:
the actual number of rows scrolled. A negative number indicates an upward scroll.
Throws:
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.
See Also:
ScrollEvent, RowSetListener

getRow

public Row getRow(Key key)
Returns the first row matching a given 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:

This method does not fire any navigation event, nor does it move the range or the current row.
Parameters:
key - the key to be matched.
Returns:
the first matching row, or null if none match.
See Also:
findByKey(Key, int)

getRowAtRangeIndex

public Row getRowAtRangeIndex(int index)
Returns the row at a given range position.

Parameters:
index - a zero-based index within the range.
Returns:
the row at the specified range index, or null if index is outside of the range.

getRowFromHandle

public Row getRowFromHandle(java.lang.Object hdl)
Internal: Applications should not use this method.

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.

Parameters:
hdl - the row handle.
Returns:
the row identified by the row handle.
See Also:
ViewRowImpl.getHandle(), ViewRowImpl.getKey()

removeRowHandle

public void removeRowHandle(java.lang.Object hdl)
Internal: Applications should not use this method.

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.

Parameters:
hdl - the row handle to remove.
See Also:
ViewRowImpl.getHandle()

getCurrentRow

public Row getCurrentRow()
Returns the current row of the iterator.

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).

Returns:
the current row. null if no current row.

getCurrentRowIndex

public int getCurrentRowIndex()
Returns the absolute row index of the iterator's current row. An absolute row index is a zero-based index relative to the entire row set.

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.
Returns:
the absolute row index of the current row, or -1 if there is no current row.

getCurrentRowSlot

public int getCurrentRowSlot()
Returns the current row's slot status.

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");
      }
 

Returns:
the current row's slot status.
See Also:
RowIterator

setRowValidation

public void setRowValidation(boolean flag)
Description copied from interface: RowIterator
Sets the validation flag on this iterator. By default a RowIterator validates the current row when navigating to another row. This method can be used to turn this row-validation off by passing 'false' as parameter.
Tags copied from interface: RowIterator
Parameters:
flag - Whether to turn row validation off or not.
Throws:
InvalidOperException - is thrown if this iterator is the default iterator of a ViewObject or a RowSet.

setCurrentRow

public boolean setCurrentRow(Row row)
Designates a given row as the current 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 RowSetListeners.

Parameters:
row - the row that is to become the current row.
Returns:
true if the current row designation was changed to row.
Throws:
ValidationException - if the previous current row fails validation.
See Also:
NavigationEvent, RowSetListener, ViewRowImpl.validate()

setCurrentRowAtRangeIndex

public boolean setCurrentRowAtRangeIndex(int index)
Designates a row at a specified position as the current 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 RowSetListeners.

Parameters:
index - the position of the row that is to become the current row.
Returns:
true if the current row designation was changed to row.
Throws:
ValidationException - if the previous current row fails validation.
See Also:
NavigationEvent, RowSetListener, ViewRowImpl.validate()

createRow

public Row createRow()
Creates a new view row. The new row is not placed in the entity cache until its primary key is initialized. It is inserted into the database when changes are posted to database and the transaction is committed.

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);
 
Returns:
the new view row.

insertRow

public void insertRow(Row row)
Inserts a row into the row set.

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 RowSetListeners.

If you want to insert a row but not change currency consider using insertRowAtRangeIndex.

Parameters:
row - the view row to insert.

insertRowAtRangeIndex

public void insertRowAtRangeIndex(int index,
                                  Row row)
Inserts a row into the row set at the specified range position.

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 RowSetListeners.

Parameters:
index - the range index at which row is to be inserted.
row - the view row to insert.

removeCurrentRow

public void removeCurrentRow()
Removes the current row.

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 RowSetListeners.

See Also:
RowSetListener.rowDeleted(oracle.jbo.DeleteEvent)

getRangeIndexOf

public int getRangeIndexOf(Row row)
Returns the range index of a given row.

Parameters:
row - a row.
Returns:
the zero-based range index of the row, or -1 if the row is not within the range.

enumerateRowsInRange

public java.util.Enumeration enumerateRowsInRange()
Creates and returns an enumerator of the rows in the range.
Returns:
an enumerator.

getAllRowsInRange

public Row[] getAllRowsInRange()
Returns an array of all rows in the iterator's range.
Returns:
an array of view rows.

getViewObject

public ViewObject getViewObject()
Description copied from interface: RowSet
Gets the View Object that contains the row set.
Tags copied from interface: RowSet
Returns:
a ViewObject.

setMasterRowSetIterator

public boolean setMasterRowSetIterator(RowSetIterator masterRSI)
Sets the master row set iterator in a master-detail View Link. The previous iterator, if any, is replaced.

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.

Parameters:
masterRSI - a master row set iterator.
Returns:
true if successful.

removeMasterRowSetIterator

public boolean removeMasterRowSetIterator(RowSetIterator masterRSI)
Removes the master row set iterator (masterRSI) from a master-detail View Link.

If masterRSI is a master row set iterator for this row set, it is removed from the list of master row set iterators.

Parameters:
masterRSI - master row set iterator to be removed.
Returns:
true if successful.

getMasterRowSetIterators

public RowSetIterator[] getMasterRowSetIterators()
Returns an array of all master row set iterators for this row set.
Returns:
an array of all master row set iterators.

getDetailRowSets

public RowSet[] getDetailRowSets()
Returns an array of all detail row sets for this row set iterator.
Returns:
an array of all detail row sets.

createDetailRowSet

public RowSet createDetailRowSet(java.lang.String rsName,
                                 java.lang.String linkDefName)
Creates and returns an new detail row set for this row set iterator.

Parameters:
rsName - the name to be assigned to the new detail row set.
linkDefName - the name of the View Link definition that defines a master-detail relationship between this row set iterator, the master, and the newly created detail row set.
Returns:
the new detail row set.

addListener

public void addListener(java.lang.Object listener)
Registers an event listener with this View Object.

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.

Parameters:
listener - a RowSetListener instance.
See Also:
RowSetListener

removeListener

public void removeListener(java.lang.Object listener)
Removes an event listener.

Parameters:
listener - the listener to be removed.

createRowSet

public RowSet createRowSet(java.lang.String name)
Creates and returns a new (secondary) row set for this View Object.
Specified by:
createRowSet in interface ViewObject
Parameters:
name - the name of the new row set.
Returns:
the new row set.

createRowSetIterator

public RowSetIterator createRowSetIterator(java.lang.String name)
Creates and returns a new (secondary) row set iterator for this row set.

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);
 
Parameters:
name - the name of the new row set iterator.
Returns:
the new row set iterator.

getRowCountInRange

public int getRowCountInRange()
Counts the rows actually in the range.

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();
      }
   }
 
Returns:
the actual number of rows in the range.

findByKey

public Row[] findByKey(Key key,
                       int maxNumOfRows)
Creates an array of rows matching a given key.

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 number of rows returned may be unbounded. Use maxNumOfRows() to limit the number of rows and the size of the returning array.

This method retrieves rows first from the cache and then from the database, and does not populate the collection.

This method does not fire any navigation event, nor does it move the range or the current row.

Note that this method works only on View Objects that are based on Entity Objects. If the View Object was created with Expert Mode during Design Time, with no underlying Entity Object, then findByKey() will not work. This is because key information should be retrieved from the Entity defition. Expert mode View Objects with no underlying Entity Object will not have any attribute definitions for values that make up the Key. Thus the key is a "null" key and does not map to any row when you execute the View Object again.

Parameters:
key - the key to be matched.
maxNumOfRows - the maximum size of the array to return, or -1 to return all rows.
Returns:
the array of rows.
See Also:
getRow(oracle.jbo.Key)

createKey

public Key createKey(AttributeList nvp)
Given a set of attribute values (name-value pairs), creates a key object for this ViewObject. This method could be used to create the input for the findByPrimaryKey method. If the key cannot be created, this method returns null.
Returns:
the key with ordered attribute list values according to this definition; null if the key cannot be created.

findByEntity

public Row[] findByEntity(int eRowHandle,
                          int maxNumOfRows)
Description copied from interface: RowIterator
Finds and returns view rows that use the entity row, identified by the entity row handle, eRowHandle.

Tags copied from interface: RowIterator
Parameters:
eRowHandle - the entity row handle.
maxNumOfRows - the maximum size of the row array to return, or -1 to return all rows.
Returns:
an array of view rows that use the entity row.

setQueryChanged

protected void setQueryChanged(boolean isChanged)
Internal: Applications should not use this method.

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.

Parameters:
isChanged - the new change flag.

isQueryChanged

protected boolean isQueryChanged()
Internal: Applications should not use this method.

Indicates whether the query is marked changed or not.

Returns:
indicates whether the query is marked changed or not.

notifyRowUpdated

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. This method can be overridden to perform calculations in a subclass if a particular attribute changes. Also, if the sub-class wants to block event-propogation to some/all rowsets of this viewobject, this method could be used to perform such filtering
Parameters:
vrs - ViewRowSetImpl instance to be notified about the attribute(s) update
viewRows - A collection of View Row instances that have been modified.
attrIndices - A collection of attribute indices in the View Rows that have been modified.

getRowSetImpl

public ViewRowSetImpl getRowSetImpl(java.lang.String name,
                                    java.lang.Object accessKey)

isForeignKey

protected boolean isForeignKey(oracle.jbo.server.ViewAttributeDefImpl attr)
Checks if a view attribute is involved in a View Link in which this View Object is detail.
Parameters:
attr - a view attribute definition.
Returns:
true if attr is a foreign key.

getProxyClassName

public java.lang.String getProxyClassName()
Internal: Applications should not use this method.

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".

Overrides:
getProxyClassName in class ComponentObjectImpl
Returns:
the proxy class name.

getProxyClassName

protected java.lang.String getProxyClassName(java.lang.String platform)
Internal: Applications should not use this method.

Returns the name of this View Object's proxy class, given a platform name.

The platforms currently recognized are VB (Visibroker) and 8i (Oracle8i).

Overrides:
getProxyClassName in class ComponentObjectImpl
Parameters:
platform - name of the platform. Currently, can be either VB (Visibroker) or 8i (Oracle8i).
Returns:
the proxy class name.

setProxyClassName

protected void setProxyClassName(java.lang.String platform,
                                 java.lang.String proxyClassName)
Internal: Applications should not use this method.

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".

Overrides:
setProxyClassName in class ComponentObjectImpl
Parameters:
platform - name of the platform. Currently, can be either VB (Visibroker) or 8i (Oracle8i).
proxyClassName - a name for the proxy class.

getRowProxyClassName

public java.lang.String getRowProxyClassName()
Internal: Applications should not use this method.

Returns the name of this View Object's row proxy class.

Returns:
the proxy class name.

remove

public void remove()
Removes this View Object from its containing application module. This method can be used for View Objects created either at Design Time or at runtime.

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.

Overrides:
remove in class ComponentObjectImpl
Throws:
InvalidOperException - if the View Object is involved in a View Link. Remove View Links before removing the View Object.

setForwardOnly

public void setForwardOnly(boolean isForwardOnly)
Sets whether this row set will be forward-only or not.

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.

Parameters:
isForwardOnly - true if the row set should be forward-only.

isForwardOnly

public boolean isForwardOnly()
Indicates whether this row set is forward-only.

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.

Returns:
true if the row set is forward-only.

setAssociationConsistent

public void setAssociationConsistent(boolean isConsistent)
Sets the association-consistent flag for this row set.

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.

Parameters:
isConsistent - true if association-consistency is to be enabled.

isAssociationConsistent

public boolean isAssociationConsistent()
Returns the state of the association-consistent flag for this row set.

Returns:
the association-consistent flag for this row set.
See Also:
setAssociationConsistent(boolean)

showCursorUsage

public void showCursorUsage(java.io.Writer out)
Internal: Applications should not use this method.

Debug routine that prints the cursor usage for this View Object.

Parameters:
out - where to write the output.

beforeEntityRemove

protected void beforeEntityRemove(Entity entity)
Notification handler called before an entity row is removed.

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.

Parameters:
entity - entity about to be removed.

afterEntityRemove

protected void afterEntityRemove(Entity srow)
Notification handler called after an entity row is removed.

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.

Parameters:
entity - entity that was removed.

sourceChanged

public void sourceChanged(EntityEvent event)
Handles events reported to (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.

Specified by:
sourceChanged in interface EntityListener
Parameters:
event - the Entity Object event.
See Also:
EntityListener, EntityEvent

afterCommit

public void afterCommit(TransactionEvent event)
Handles events raised after a transaction has been committed. If the Application Module's "query-on-commit" flag is on, then all row sets that belong to this View Object are refreshed.

Override this method to perfom any subclass-specific behavior.

Specified by:
afterCommit in interface TransactionListener
Parameters:
event - the transaction event.
See Also:
TransactionListener

clearCache

public void clearCache()
Clears the View Object cache. This method can be called for resource conservation. Calling this method also forces an automatic reexecution of the query for all RowSets, which refreshes the cache from the database.
Specified by:
clearCache in interface ViewObject

afterRollback

public void afterRollback(TransactionEvent event)
Handles events raised after a transaction has been rolled back. All row sets that belong to this View Object are refreshed.
Specified by:
afterRollback in interface TransactionListener
Parameters:
event - the transaction event.
See Also:
TransactionListener

afterRemove

public void afterRemove(TransactionEvent event)
Handles events raised after rows have been removed.
Specified by:
afterRemove in interface TransactionListener
Parameters:
event - the transaction event.
See Also:
TransactionListener

beforeCommit

public void beforeCommit(TransactionEvent e)
Handles events raised before a transaction is committed.
Specified by:
beforeCommit in interface TransactionListener
Parameters:
e - the transaction event.
See Also:
TransactionListener

beforeRollback

public void beforeRollback(TransactionEvent e)
Handles events raised before a transaction is rolled back.
Specified by:
beforeRollback in interface TransactionListener
Parameters:
e - the transaction event.
See Also:
TransactionListener

isTransientTransactionListener

public boolean isTransientTransactionListener()
Tests whether this transaction listener is transient or permanent.

Transient listeners are automatically removed at the end of a transaction commit or rollback cycle; permanent listeners remain across these cycles.

Specified by:
isTransientTransactionListener in interface TransactionListener
Returns:
true if the listener is transient.

postChanges

public void postChanges(TransactionEvent e)
This method is not implemented in this class.
Specified by:
postChanges in interface TransactionPostListener
Parameters:
e - ignored.

getTransPostHandle

public int getTransPostHandle()
Internal: Applications should not use this method.

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.

Specified by:
getTransPostHandle in interface TransactionPostListener
Returns:
-1, which means no transaction post handle.

setTransPostHandle

public void setTransPostHandle(int hdl)
Internal: Applications should not use this method.

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.

Specified by:
setTransPostHandle in interface TransactionPostListener
Parameters:
hdl - the transaction post handle.
Returns:
-1, which means no transaction post handle.

isTransientTransactionPostListener

public boolean isTransientTransactionPostListener()
Reports that this view object is not a transient transaction post listener.

Transient listeners are automatically removed at the end of a transaction post cycle; permanent listeners remain across post cycles. This property does not change.

Specified by:
isTransientTransactionPostListener in interface TransactionPostListener
Returns:
false

setListenToEntityEvents

public void setListenToEntityEvents(boolean b)
Sets the listen-to-entity-events flag.

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.

Parameters:
b - the new listen-to-entity-events flag.

findViewLinkAccessor

public AttributeDef findViewLinkAccessor(ViewLink vl)
Finds the View Link accessor attribute.
Specified by:
findViewLinkAccessor in interface ViewObject
Parameters:
vl - the View Link whose accessor is sought.
Returns:
the attribute definition if it exists, or null.

getImplObject

public static ViewRowSetIteratorImpl getImplObject(java.lang.Object rsi)
Parameters:
rsi -  

createXMLDefinition

public final java.lang.String createXMLDefinition(int depthCount)
Creates a DTD defintion for the View Object and all its contents (including contained RowSets if bContainees is true)
Parameters:
bContainees - if true, the DTD definition includes contained RowSets; if false, it does not include contained RowSets. (including contained rowsets if bContainees is true)

writeXML

public org.w3c.dom.Node writeXML(int depthCount,
                                 long options,
                                 oracle.xml.parser.v2.XSLStylesheet xslt)
Writes the contents of this View Object by creating a new RowSet and rendering it in XML.
Parameters:
bContainees -  
bLimitToRange -  

writeXML

public final org.w3c.dom.Node writeXML(int depthCount,
                                       long options)
Writes the contents of this View Object by creating a new RowSet and rendering it in XML.
Parameters:
bContainees -  
bLimitToRange -  

printXMLDefinition

protected java.lang.String printXMLDefinition(oracle.jbo.server.RowSetImpl rs,
                                              java.util.Hashtable allDefs,
                                              java.io.PrintWriter pw,
                                              int depthCount)
Calls the RowImpl.printXMLDefintion to generate the definition for the rowset and all its contents (including contained rowsets if bContainees is true).
Parameters:
rs -  
allDefs -  
pw -  
bContainees -  
See Also:
rowset and all its contents (including contained rowsets if bContainees is true)

appendXMLElementNodes

protected void appendXMLElementNodes(oracle.jbo.server.RowSetImpl rs,
                                     org.w3c.dom.Document xmlDoc,
                                     org.w3c.dom.Node voNode,
                                     int depthCount,
                                     long options)
Calls RowImpl.getXMLElementNodes to append row nodes to the given parent View Object node (voNode).
Parameters:
rs -  
xmlDoc -  
voNode -  
bContainees -  
bLimitToRange -  

readXML

public final void readXML(org.w3c.dom.Element elem,
                          int depthCount,
                          oracle.xml.parser.v2.XSLStylesheet xslt)
Given the document interface, finds the rowset Element and invokes readFromXMLElementNode() 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's postChanges() to sync up all RowSets for this ViewObject.
Parameters:
elem -  
bContainees -  

readXML

public final void readXML(org.w3c.dom.Element elem,
                          int depthCount)
Given the document interface, finds the rowset Element and invokes readFromXMLElementNode() 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's postChanges() to sync up all RowSets for this ViewObject.
Parameters:
elem -  
bContainees -  

getXMLElementTag

protected java.lang.String getXMLElementTag()
Returns the XML element name for this View Object. If the custom property XML_ELEMENT is defined for this view definition, return that name. If it is not, return the name of the View Object.

updateRowSetFromXML

protected void updateRowSetFromXML(org.w3c.dom.Element node,
                                   int depthCount,
                                   oracle.jbo.server.RowSetImpl rs)
/* Creates a key from the given element's sub-elements to find out an existing row, and if found, updates the row with other attribute values, else creates a new row and sets the attribute values and inserts the row in the rowset.
Throws:
ReadXMLException - when the read operation fails while reading the rows for this rowset. This exception may contain one exception per Row in this rowset.

passivateState

protected void passivateState(ViewRowImpl currentRow,
                              org.w3c.dom.Document doc,
                              org.w3c.dom.Element parent)

activateState

protected void activateState(ViewRowImpl currentRow,
                             org.w3c.dom.Element parent)

Business Components