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'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 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 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  java.util.Vector mAttrRefs
           
protected  boolean mAutoPostChanges
           
static int mDefaultMaxActiveNodes
           
static int mDefaultMaxRowsPerNode
           
protected  AttributeDef[] 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.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
 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 before 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.
 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  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  boolean buildWhereClause(java.lang.StringBuffer sqlBuffer, int noUserParams)
          Builds the where-clause part of the query and adds it into the string buffer.
protected  void create()
          Framework invoked method, called when the View Object is created.
 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(oracle.jbo.server.QueryCollection qc, java.sql.ResultSet resultSet)
          Internal: Applications should not use this method.
 Row createRow()
          Creates a new view row.
 RowSet createRowSet(java.lang.String name)
          Creates and returns a new row set for this View Object.
 RowSetIterator createRowSetIterator(java.lang.String name)
          Creates and returns a new row set iterator for this row set.
 ViewCriteria createViewCriteria()
          Creates a new view criteria object.
 java.util.Enumeration enumerateRowsInRange()
          Creates and returns an enumerator of the rows in the range.
 void executeQuery()
          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()
          Could be used to perform meta-data initializations like "custom" Properties that are calculated using the current transaction.
 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.
 int getFetchSize()
          Gets the row pre-fetch size.
 AttributeDef[] getKeyAttributeDefs()
          Constructs an array of definitions of key attributes.
 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.
 java.lang.Object getProperty(java.lang.String propName)
          Retrieves the specified property.
 java.lang.String getProxyClassName()
          Returns the name of this View Object's proxy class.
protected  java.lang.String getProxyClassName(java.lang.String platform)
          Returns the name of this View Object's proxy class, given a platform name.
 java.lang.String getQuery()
          Returns the query statement.
 oracle.jbo.server.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.
 Row getRowFromHandle(java.lang.Object hdl)
          Internal: Applications should not use this method.
 java.lang.String getRowProxyClassName()
          Returns the name of this View Object's row proxy class.
 RowSet getRowSet()
          Gets the row set that this iterator belongs to.
 RowSetIterator getRowSetIterator()
          Gets the row set iterator interface of this 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.
 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.
 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.
 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.
 boolean isDynamicAttribute(int index)
          Indicates whether an attribute is dynamic.
 boolean isDynamicAttribute(java.lang.String name)
          Indicates whether the named attribute is dynamic.
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.
 void postChanges(TransactionEvent e)
          This method is not implemented in this class.
 Row previous()
          Navigates to the previous row in the row set.
 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 setForwardOnly(boolean isForwardOnly)
          Sets whether this row set will be forward-only or not.
 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 setOrderByClause(java.lang.String orderByClause)
          Sets the query's ORDER BY clause.
protected  void setProxyClassName(java.lang.String platform, java.lang.String proxyClassName)
          Sets the name of this View Object's proxy class, given a platform name.
 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 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.
 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.
 void validate()
          Validates all view rows within this View Object.
 
Methods inherited from class oracle.jbo.server.ComponentObjectImpl
addListener, createRef, getCompListeners, getRootApplicationModule, isRegWithPiggyMan
 
Methods inherited from class oracle.jbo.server.NamedObjectImpl
getFullName, getName, getParent, getPropertiesAsStrings, 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

mAttrRefs

protected java.util.Vector mAttrRefs

mKeyAttrRefs

protected AttributeDef[] mKeyAttrRefs

mAutoPostChanges

protected boolean mAutoPostChanges

mUsePersColl

public static boolean mUsePersColl

mDefaultMaxRowsPerNode

public static int mDefaultMaxRowsPerNode

mDefaultMaxActiveNodes

public static int mDefaultMaxActiveNodes
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

create

protected void create()
Framework invoked method, called when the View Object is created.

This method can be overridden to perform custom initialization of the View Object. For example, it may set up a custom query statement based on the current running environment.

If sub-classed, super.create() should be called before any operations are performed.


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

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.

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.

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
 

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.

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.

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

getQueryCollection

public oracle.jbo.server.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.

Returns:
the default row set.

getWhereClause

public java.lang.String getWhereClause()
Gets the query's WHERE clause.
Specified by:
getWhereClause in interface ViewObject
Returns:
the WHERE clause.

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.

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.

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.
Specified by:
getOrderByClause in interface ViewObject
Returns:
the SQL ORDER BY clause.

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.

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.

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.
Returns:
the array of bind values.

setWhereClauseParams

public void setWhereClauseParams(java.lang.Object[] values)
Sets the query's bind values.

The new WHERE clause parameter values do not take effect until executeQuery() is invoked.

Parameters:
values - an array of bind values.

setWhereClauseParam

public void setWhereClauseParam(int index,
                                java.lang.Object value)
Sets a specified the bind value.

The new WHERE clause parameter value does not take effect until executeQuery() is invoked.

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.
Returns:
the database transaction.

getUserDefinedQuery

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

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

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

getQuery

public java.lang.String getQuery()
Returns the query statement.

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;
 

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.
Returns:
a Java class.

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.

createInstanceFromResultSet

public ViewRowImpl createInstanceFromResultSet(oracle.jbo.server.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()
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.

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

Returns:
an array of attribute definitions.

getKeyAttributeDefs

public AttributeDef[] getKeyAttributeDefs()
Constructs an array of definitions of key attributes.

The View Object's key is a composite key, consisting of view attributes mapped to the primary keys of its Entity Objects.

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.

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 constrast to getKeyAttributeDefs(), which returns an array of view attribute definitions.

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(), last(), this method is implicitly called.

Upon successful execution of query, this method fires a RangeRefreshEvent event to RowSetListener's registered with this object, by calling RowSetListener.rangeRefreshed().

See Also:
setFetchMode(byte)

getAttributeCount

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

This number includes dynamic attributes created through addDynamicAttribute().

Returns:
the number of attributes.

findAttributeDef

public AttributeDef findAttributeDef(java.lang.String name)
Finds a named attribute definition.
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.
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.

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.
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.
Parameters:
index - the attribute's position.
Returns:
true if the attribute is dynamic, or false otherwise.

isDynamicAttribute

public boolean isDynamicAttribute(java.lang.String name)
Indicates whether the named attribute is dynamic.
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.

If enabled, 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.

getFetchMode

public byte getFetchMode()
Gets the current fetch mode.

Returns:
the fetch mode.
See Also:
setFetchMode().

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.

Parameters:
fetchMode - the new fetch mode.

getBindingStyle

public int getBindingStyle()
Returns the binding style.
Returns:
the binding style.

setBindingStyle

public void setBindingStyle(int bindingStyle)
Sets the binding style.
Parameters:
bindingStyle - the binding style.

getFetchSize

public int getFetchSize()
Gets the row pre-fetch size.

This value is used to set the JDBC row pre-fetch 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.

Returns:
the maximum row fetch size.

createViewCriteria

public ViewCriteria createViewCriteria()
Creates a new view criteria object.
Specified by:
createViewCriteria in interface ViewObject
Returns:
the new view criteria object.

applyViewCriteria

public void applyViewCriteria(ViewCriteria criteria)
Applies the view criteria to this View Object.
Specified by:
applyViewCriteria in interface ViewObject
Parameters:
criteria - the view criteria to apply.

getViewCriteria

public ViewCriteria getViewCriteria()
Gets the view criteria.
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.
Returns:
the SQL statements WHERE clause.

getRowSet

public RowSet getRowSet()
Description copied from interface: RowSetIterator
Gets the row set that this iterator belongs to.
Tags copied from interface: RowSetIterator
Returns:
a row set.

getRowSetIterator

public RowSetIterator getRowSetIterator()
Gets the row set iterator interface of this object.
Returns:
a row set interface.

next

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

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 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 next row, or null if no next row.
Throws:
ValidationException - if the prevously current row fails validation.
See Also:
NavigationEvent, RowSetListener, ViewRowImpl.validate()

previous

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

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, ViewRowImpl.validate()

first

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

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

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

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.

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.

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.

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.

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.

Returns:
the number of rows fetched so far.

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.

Returns:
an estimate of the number of rows in the row set.
See Also:
getQueryHitCount(ViewRowSetImpl)

setRangeSize

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

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.

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.

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.

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

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.

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.

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.

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:

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

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

Parameters:
row - the view row to insert.

insertRowAtRangeIndex

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

The row is inserted at the given range index, 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.

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.

Parameters:
listener - a RowSetListener instance.

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 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 row set iterator for this row set.
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.

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.

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)

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.

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

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 before an entity row is 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 all row sets that belong to this View Object are refreshed.
Specified by:
afterCommit in interface TransactionListener
Parameters:
event - the transaction event.
See Also:
TransactionListener

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

Business Components