Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

oracle.jbo.server
Class ViewObjectImpl

java.lang.Object
  extended by oracle.jbo.server.NamedObjectImpl
      extended by oracle.jbo.server.ComponentObjectImpl
          extended by oracle.jbo.server.ViewObjectImpl
All Implemented Interfaces:
Formattable, ViewCriteriaManagerOwner, ComponentObject, NavigatableRowIterator, Properties, RowIterator, RowSet, RowSetIterator, EntityListener, TransactionListener, TransactionPostListener, StructureDef, VariableManagerOwner, VariableManagerOwnerBase, ViewCriteriaManager, ViewObject

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


Field Summary
static java.lang.Class CLASS_INSTANCE
           
static byte FETCH_ALL
          A fetch mode that causes all rows to be retrieved from a JDBC result set immediately, and then closes the result set.
static byte FETCH_AS_NEEDED
          A fetch mode that causes rows to be retrieved from a JDBC result set as the user navigates through the row set.
static byte FETCH_DEFAULT
          A fetch mode that indicates that the default mode to be used.
static int FULLSQL_MODE_AUGMENTATION
          A full SQL mode that indicates that ViewObject level query augmentation (where-clause, order-by-clause) will be added to the query specified through a call to setQuery().
static int FULLSQL_MODE_NO_AUGMENTATION
          A full SQL mode that indicates that no ViewObject level query augmentation (where-clause, order-by-clause) will be added to the query specified through a call to setQuery().
protected  java.lang.String mAssocClause
           
protected  java.lang.String mAssocFromClause
           
protected  ArrayList mAssocRefs
           
protected  ViewAttributeDefImpl[] mAttrDefs
           
protected  Hashtable mAttrDefsTab
           
protected  boolean mAutoPostChanges
           
protected  int[] mChangedAttrIndices
           
protected  int mChgAttrIndUseCount
           
static int mDefaultMaxActiveNodes
           
static int mDefaultMaxRowsPerNode
           
protected  Hashtable mDefaultRowSetMap
           
static int MIN_ACTIVE_NODES
           
static int MIN_ROWS_PER_NODE
           
protected  ViewAttributeDefImpl[] mKeyAttrRefs
           
protected  java.lang.String mOptimizerHint
           
protected  java.lang.String mOrderBy
           
static boolean mUsePersColl
           
protected  java.lang.String mUserDefinedQuery
           
protected  ViewDefImpl mViewDef
           
static java.lang.String PROPERTY_DEFERRED_ESTIMATED_ROWCOUNT
          A custom property name that indicates if this VO should defer calling estimatedRowCount in the 'getDeferredEstimatedRowCount' method.
 
Fields inherited from class oracle.jbo.server.NamedObjectImpl
mObjName, mParent, mProperties, mUserData, RES_ID_SUFFIX
 
Fields inherited from interface oracle.jbo.ViewObject
QUERY_MODE_SCAN_DATABASE_TABLES, QUERY_MODE_SCAN_ENTITY_ROWS, QUERY_MODE_SCAN_UNPOSTED_ENTITY_ROWS, QUERY_MODE_SCAN_VIEW_ROWS, QUERY_TIMEOUT_WAIT_FOREVER
 
Fields inherited from interface oracle.jbo.RowSet
COPY_OPT_ALL_ROWS, COPY_OPT_LIMIT_RANGE, FORWARD_ONLY, RANGE_PAGING, RANGE_PAGING_AUTO_POST, RANGE_PAGING_INCR, SCROLLABLE
 
Fields inherited from interface oracle.jbo.RowIterator
ITER_MODE_LAST_PAGE_FULL, ITER_MODE_LAST_PAGE_PARTIAL, SLOT_BEFORE_FIRST, SLOT_BEYOND_LAST, SLOT_DELETED, SLOT_VALID
 
Fields inherited from interface oracle.jbo.ViewCriteriaManager
DFLT_VIEW_CRITERIA_NAME, IMPLICIT_VIEW_CRITERIA_NAME, QUICKSEARCH_VIEW_CRITERIA_NAME
 
Constructor Summary
ViewObjectImpl()
           
ViewObjectImpl(java.lang.String name, ViewDefImpl def)
           
 
Method Summary
protected  ViewRowImpl activateCurrentRow(ViewRowSetIteratorImpl vrsi, ViewRowSetImpl vrs, Key key)
          Override this to provide custom current row lookup.
 void activateIteratorState(org.kxml2.io.KXmlParser node, boolean clearIteratorState)
          Internal: Applications should not use this method.
protected  void activateNewRowTracker(ViewRowSetImpl vrs, org.kxml2.io.KXmlParser parent)
          Advanced Internal method only.
protected  void activateState(org.kxml2.io.KXmlParser parent)
          Allows subclasses to retrieve custom data from an XML-node under the given parent element.
protected  void activateState(ViewRowImpl currentRow, org.kxml2.io.KXmlParser parent)
          Deprecated. since 9.0.3.3 use activateState(ViewRowSetImpl vrs...)
protected  void activateState(ViewRowSetImpl vrs, ViewRowImpl currentRow, org.kxml2.io.KXmlParser parent)
          Deprecated. since 9.0.3.3 use activateState(ViewRowSetImpl vrs...)
 AttributeDef addDynamicAttribute(java.lang.String attrName)
          Adds a dynamic attribute to this View Object.
 AttributeDef addDynamicAttributeWithType(java.lang.String attrName, java.lang.String javaTypeName, java.lang.String transientExpression)
           
 void addListener(java.lang.Object listener)
          Adds a subscriber (listener) to be notified of RowSetListener events generated by this row set iterator.
 void addManagementListener(RowSetManagementListener listener)
          Adds a subscriber (listener) to be notified of RowSetManagementListener events generated by this Row Set Iterator.
protected  void addRowSet(ViewRowSetImpl rs)
           
protected  void addViewLink(ViewLinkImpl viewLink, boolean isReversed)
           
 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.
 void applyViewCriteria(ViewCriteria criteria)
          Applies the view criteria to this View Object.
 void applyViewCriteria(ViewCriteria criteria, boolean bAppend)
          Apply the view crtieria passed as the argument.
 void beforeCommit(TransactionEvent e)
          Handles events raised before a transaction is committed.
protected  void beforeEntityRemove(Entity entity)
          Notification handler called before an entity row is removed.
 void beforeRollback(TransactionEvent e)
          Handles events raised before a transaction is rolled back.
protected  void bindParametersForCollection(QueryCollection qc, java.lang.Object[] params, PreparedStatement stmt)
           
protected  int buildEffectiveDateFromClauseFragment(java.lang.StringBuffer fromClause, int noUserParams)
          This method is invoked in a Join VO scenario and ANSI Join Syntax is being followed.
protected  int buildEffectiveDateWhereClauseFragment(java.lang.StringBuffer effDtClause, int noUserParams)
          Generates the Effective date filter clause fragment.
protected  java.lang.String buildFromClause()
           
protected  RowFilter buildNewCollection(java.lang.Object[] newParamValues)
           
protected  boolean buildOrderByClause(java.lang.StringBuffer sqlBuffer, java.lang.String defOrderByClause)
          Builds the order-by-clause part of the query and adds it into the string buffer.
protected  RowFilter[] buildQualifyingRowFilters(java.lang.Object[] newParamValues)
           
protected  java.lang.String buildQuery(int noUserParams, boolean forRowCount)
           
protected  java.lang.String buildQuery(int noUserParams, boolean forRowCount, java.lang.String selClause, java.lang.String whereClause)
           
protected  java.lang.String buildRangePagingQuery(java.lang.String qry, int noUserParams)
          Applications may use this method to wrap this ViewObject query with rownum query or other mechanism to fetch rows in the current range.
protected  RowFilter buildRowFilter(java.lang.Object[] paramValues)
           
protected  java.lang.String buildSelectClause()
           
 CriteriaClauses buildViewCriteriaClauses(ViewCriteria vc)
          This method is used by the framework to generate a query clause for a particular view criteria.
protected  boolean buildWhereClause(java.lang.StringBuffer sqlBuffer, int noUserParams)
          Builds the WHERE clause part of the query and adds it into the string buffer.
 boolean cancelQuery()
          Cancels a running query.
 void clearViewCriterias()
          Clear all view criteria, both applied and unapplied help by this manager
 void closeFreedStatements()
           
 void closeRowSet()
          Closes the row set.
 void closeRowSetIterator()
          Closes this row set iterator.
static boolean containsTableAlias(java.lang.String line, java.lang.String word)
           
 Row createAndInitRow(AttributeList initVals)
          Creates and initializes a new Row object, but does not insert it into the Row Set.
 RowSet createDetailRowSet(java.lang.String rsName, java.lang.String viewLinkDefName)
          Creates a detail Row Set.
protected  ViewObjectImpl createFinderVO(java.lang.String suffix)
           
 ViewRowImpl createInstance(ViewRowSetImpl viewRowSet, AttributeList attrValList)
          Creates a view row instance.
 ViewRowImpl createInstanceFromResultSet(QueryCollection qc, ResultSet resultSet)
          Internal: Applications should not use this method.
 Key createKey(AttributeList nvp)
          Given a list of name-value pairs, creates a Key object that matches the key structure for the ViewObject for this RowItertor.
 Row createRow()
          Creates a new Row object, but does not insert it into the Row Set.
protected  ViewRowImpl createRowFromResultSet(java.lang.Object qc, ResultSet resultSet)
           
 RowSet createRowSet(java.lang.String name)
          Creates and returns a new (secondary) row set for this View Object.
 RowSetIterator createRowSetIterator(java.lang.String name)
          Creates an iterator for the row set.
protected  VariableValueManager createVariableValueManagerForRS(RowSet owner, VariableManager[] varMgrParents)
          Internal: Applications should not use this method. Framework Subclasses may use this to creaet custom subclasses of VariableValueManagerImpl
protected  ViewRowSetImpl createViewAccessorRS(ViewAccessorDef accessorDef, Row masterRow, java.lang.Object[] valuse, boolean addRSToMasterRow)
           
 ViewCriteria createViewCriteria()
          Creates a new view criteria object for this View Object.
protected  ViewRowSetImpl createViewLinkAccessorRS(AssociationDefImpl assocDef, ViewObjectImpl accessorVO, Row masterRow, java.lang.Object[] values)
           
protected  ViewObjectImpl createViewLinkAccessorVO(AssociationDefImpl assocDef, java.lang.String voName, ViewDefImpl vDef, ViewLinkDefImpl vlDef)
           
protected  ViewRowSetImpl createViewLinkScanBaseRS(AssociationDefImpl assocDef, ViewObjectImpl accessorVO, Row masterRow)
           
 void criteriaChanged(ViewCriteria vc)
          The criteria manager can track changes to applied view criteria.
 void defineNamedWhereClauseParam(java.lang.String name, java.lang.Object defaultValue, int[] indices)
          Defines a named bind variable to use with the view object's where-clause.
 java.util.Enumeration enumerateRowsInRange()
          Gets an Enumeration of all rows in the Row Set.
 void executeEmptyRowSet()
           
 void executeQuery()
          Executes the query.
protected  void executeQueryForCollection(java.lang.Object qc, java.lang.Object[] params, int numUserParams)
           
 KeyDef findAltKeyDef(java.lang.String keyName)
           
 AttributeDef findAttributeDef(java.lang.String name)
          Gets an attribute definition, given its name.
 RowIterator findByAltKey(java.lang.String keyName, Key key, int maxNumOfRows, boolean skipWhere)
           
 Row[] findByEntity(int eRowHandle, int maxNumOfRows)
          Finds and returns View rows that use the Entity row, identified by the Entity row handle, eRowHandle.
 Row[] findByKey(Key key, int maxNumOfRows)
          Finds and returns View rows that match the specified key.
 RowIterator findByViewCriteria(ViewCriteria criteria, int maxNumOfRows, int queryMode)
          Finds and returns View rows that match the specified View Criteria.
protected  ViewObject findOrCreateLocalViewObject(java.lang.String usageName)
          Find or create the local view instance from the local view usage name.
protected  ViewObject findOrCreateLocalViewObject(java.lang.String usageName, java.lang.String voName)
          Find or create the local view instance from the local view usage name.
 RowSetIterator findRowSetIterator(java.lang.String rsiName)
          Gets the named row set iterator that was created at runtime for this row set.
 ViewAccessorDef findViewAccessorDef(java.lang.String name)
           
 ViewDefImpl findViewDefFromDiscrVals(ResultSet resultSet, AttributeList initValues)
           
 ViewDefImpl findViewDefFromDiscrVals(ResultSet resultSet, AttributeList initValues, EntityImpl[] entities)
           
protected  ViewObjectImpl findViewLinkAccessorVO(AssociationDefImpl assocDef, java.lang.String voName, ViewDefImpl vDef, ViewLinkDefImpl vlDef)
           
 Row first()
          Gets the first row in the iterator.
 java.lang.String formatForOutput(OutputFormatter formatter)
           
 byte getAccessMode()
           
protected  java.util.Enumeration getAllCachedQueryCollections()
           
 Row[] getAllRowsInRange()
          Extracts the rows in the range.
 java.lang.String[] getAllViewCriteriaNames()
          Returns a list of both applied and unapplied view criterias managed by this object.
 ViewCriteria[] getAllViewCriterias()
          Returns a list of both applied and unapplied view criterias managed by this object.
 AttributeDef[] getAltKeyAttrDefs(java.lang.String keyName)
           
 ApplicationModule getApplicationModule()
          Gets the Application Module.
protected  ApplicationModule getApplicationModuleForLocalViewObject()
           
 ViewCriteria[] getApplyAllViewCriterias(int criteriaMode, boolean getAllReqdVC)
           
 java.lang.String[] getApplyJoinedViewCriteriaNames()
           
 java.lang.String[] getApplyViewCriteriaNames()
           
 ViewCriteria[] getApplyViewCriterias(int criteriaMode)
          Return a list of applied view criteria that have the mode passed in the argument turned on.
protected  java.lang.String getAssociationClause(int noUserParams)
          Internal: Applications should not use this method.
 AttributeDef[] getAttrDefsForEntityAttr(java.lang.String eoName, java.lang.String eoAttrName)
          This method performs the same operation as getAttrIndicesForEntityAttr, except that it return an array of attribute definitions, not just indices.
 int getAttributeCount()
          Returns the number of defined attributes.
 AttributeDef getAttributeDef(int index)
          Gets an attribute definition, given its index.
 AttributeDef[] getAttributeDefs()
          Gets the defined attributes.
 int getAttributeIndexOf(java.lang.String name)
          Finds the index (0-based) of the named attribute.
 int[] getAttrIndicesForEntityAttr(java.lang.String eoName, java.lang.String eoAttrName)
          Returns an array of indices of view attributes that are mapped to the entity attribute identified by the entity name (the eoName parameter) and the entity attribute name (the eoAttrName).
 java.lang.String[] getAvailableViewCriteriaNames()
          Returns a list of view criteria names that are unapplied and managed by this object
 int getBindingStyle()
           
protected  QueryCollection getCachedQueryCollection(RowFilter rowFilter)
          Internal: Applications should not use this method.
 int getCalculatedAttributeCount()
          Counts the number of "calculated" attributes.
 long getCappedQueryHitCount(ViewRowSetImpl viewRowSet, Row[] masterRows, long oldCap, long cap)
           
 java.lang.String getColumnNameForQuery(int index)
           
 CriteriaAdapter getCriteriaAdapter()
          Return a custom CriteriaAdapter implementation to generate where clause for ViewCriteria.
 Row getCurrentRow()
          Accesses the current row.
 int getCurrentRowIndex()
          Gets the absolute index (not range index) of the current row.
 int getCurrentRowSlot()
          Gets the slot status of the current row.
 DBTransaction getDBTransaction()
          Gets the transaction within which this View Object operates.
 byte getDefaultAccessMode()
           
 int getDefaultRangePagingCacheFactor()
           
 int getDefaultRangeSize()
           
 ViewRowSetImpl getDefaultRowSet()
          Internal: Applications should not use this method.
protected  ViewRowSetImpl getDefaultRowSetInternal()
           
protected  int[] getDeleteParticipants()
          Internal: Applications should not use this method.
 RowSet[] getDetailRowSets()
          Gets an array of detail Row Sets for which this Iterator is the master.
protected  int[] getDiscrColLoadIndices()
           
 int getDynamicAttributeCount()
          Internal: Applications should not use this method.
 int getDynamicAttributeOffset()
          Internal: Applications should not use this method.
protected  EntityDefImpl getEntityDef(int index)
          INTERNAL: Applications should not use this method.
protected  int getEntityDefCount()
          Internal: Applications should not use this method.
protected  EntityDefImpl[] getEntityDefs()
          Returns an array of entity definitions of the entity bases.
 int getEstimatedRangePageCount()
          Returns getEstimatedRowCount()/rangePageSize, if rangeSize > 0.
 long getEstimatedRowCount()
          Counts the number of rows in the collection defined by the view object's query.
 int getFetchedRowCount()
          Counts the number of rows fetched from database into the Row Set collection up to this point.
 byte getFetchMode()
          Gets the current fetch mode.
 short getFetchSize()
          Gets the row pre-fetch size.
 Row[] getFilteredRows(java.lang.String attrName, java.lang.Object attrValue)
          Returns all rows in this collection whose attribute value matches the value being passed in attrValue.
 Row[] getFilteredRowsInRange(java.lang.String attrName, java.lang.Object attrValue)
          Returns all rows in this range whose attribute value matches the value being passed in attrValue.
 java.lang.String getFromClause()
           
static ViewRowSetIteratorImpl getImplObject(java.lang.Object rsi)
          Internal: Applications should not use this method.
protected  int[] getInsertParticipants()
          Internal: Applications should not use this method.
 int getIterMode()
          Gets the current iteration mode.
 AttributeDef[] getKeyAttributeDefs()
          Returns the attribute definitions that make up the constituents of the key object for rows returned from this view object.
protected  int[] getLockParticipants()
          Internal: Applications should not use this method.
protected  ArrayList getMasterKeyValues(AssociationDefImpl assocDef)
          Gets a list of distinct key values from the rows in this master VO, by enumerating through its query collections.
 RowSetIterator[] getMasterRowSetIterators()
          Return all controlling masters of this row set.
 int getMaxFetchSize()
          Gets the maximum row fetch size.
 java.lang.Object getNamedWhereClauseParam(java.lang.String name)
          Gets the value of a named where-clause parameter for this row set.
 Row[] getNextRangeSet()
          Gets the next set of rows in the range.
 java.lang.String getOrderByClause()
          Returns the query's ORDER BY clause.
protected  PreparedStatement getPreparedStatement(int numUserParams)
           
protected  PreparedStatement getPreparedStatement(int noUserParams, boolean[] barr)
           
 Row[] getPreviousRangeSet()
          Gets the previous set of rows in the range.
protected  RowFilter[] getQualifyingRowFilters(java.lang.Object[] rowParamValues)
           
 java.lang.String getQuery()
          Returns the query statement.
 long getQueryHitCount(ViewRowSetImpl viewRowSet)
          Counts the number of rows that would be returned if the View Object were executed with the current query.
 long getQueryHitCount(ViewRowSetImpl viewRowSet, Row[] masterRows)
           
 int getQueryMode()
           
 int getQueryTimeOut()
           
 int getRangeIndexOf(Row row)
          Get the index of the given row relative to the beginning of the range.
 int getRangeSize()
          Gets the size of the Row Set Iterator range.
 int getRangeStart()
          Gets the absolute row index of the first row in the Row Set Iterator range.
 ViewCriteria getReqdVC()
           
 ViewCriteria getRequiredViewCriteria()
          This method returns a reference to the required view criteria if one exists on this View Object.
 Row getRow(int index)
           
 Row getRow(Key key)
          Locates and returns a row by its unique key.
 Row getRowAtRangeIndex(int index)
          Accesses a row through its range index.
 Comparator getRowComparator()
           
 int getRowCount()
          Counts the total number of rows in the Row Set.
 int getRowCountInRange()
          Gets the size of the Row Set Iterator range.
protected  java.util.Enumeration getRowFilters()
           
 RowMatch getRowMatch()
          Gets the in-memory filter (RowMatch) for the view object.
 RowMatch getRowMatchFromViewCriteria()
           
 RowSet getRowSet()
          Returns the View Object as a RowSet object.
 RowSetIterator getRowSetIterator()
           
 RowSetIterator[] getRowSetIterators()
          Gets all row set iterators that belong to this row set.
 RowSet[] getRowSets()
          Get all Row Sets that belong to this view object.
 AttributeDef[] getScanRowFilterAttributeDefs()
           
 java.lang.String getSelectClause()
           
 long getSignature()
          Internal: Applications should not use this method. Only for use in Object marshalling for remote tiers.
 java.lang.String getSortBy()
           
 SortCriteria[] getSortCriteria()
           
 java.lang.Object getSyncLock()
          Gets the locking object for this Row Set Iterator.
 int getTransPostHandle()
          Advanced: Applications should not use this method.
 ViewAttributeDefImpl[] getViewAttributeDefImpls()
           
 ViewCriteria getViewCriteria()
          Gets the view criteria for this View Object.
 ViewCriteria getViewCriteria(java.lang.String name)
          Returns a reference to the view criteria with a specific name if it is found.
 java.lang.String getViewCriteriaClause(boolean forQuery)
          Generates the WHERE clause expression from the applied view criterias.
 ViewCriteriaManager getViewCriteriaManager()
           
protected  ViewDefImpl getViewDef()
           
protected  ArrayList getViewLinkDestinationAttributes()
           
 ViewLink[] getViewLinks()
          Constructs an array of View Links that involve this View Object.
 ViewObject getViewObject()
          Gets the view object that owns this row set.
 java.lang.String getWhereClause()
          Gets the query's where-clause.
 java.lang.Object[] getWhereClauseParams()
          Gets the bind variable values to be used with the view object's where-clause.
 boolean hasDefaultRowSet()
           
 boolean hasNext()
          Tests for the existence of a row after the current row.
protected  boolean hasNextForCollection(java.lang.Object qc)
           
 boolean hasPrevious()
          Tests for the existence of a row before the current row.
protected  void initFromDef()
           
 void insertRow(Row row)
          Inserts a row into the row set.
 void insertRowAtRangeIndex(int index, Row row)
          Inserts a row to the Row Set at the given range index.
 boolean isAssociationConsistent()
          Returns the flag indicating whether association-consistent mode is on or not.
 boolean isAttributeKey(AttributeDef attrDef)
           
 boolean isAutoPostChanges()
          Indicates whether auto-post-changes is enabled or not.
protected  boolean isCollectionPresent(RowFilter rowFilter)
           
protected  boolean isDefaultAssocConsistent()
           
 boolean isExecuted()
          Returns true if the current ViewObject's query has been executed for this row set.
 boolean isFetchComplete()
          Tests if the query result set has been fetched to the end.
protected  boolean isForeignKey(ViewAttributeDefImpl attr)
          Checks if a view attribute is involved in a View Link in which this View Object is detail.
 boolean isForScan()
           
 boolean isForwardOnly()
          Tests if the row set is constrained to sequential access.
 boolean isInternal()
           
 boolean isManageRowsByKey()
          Returns a flag indicating whether this View Object "manages rows by key" or not.
 boolean isMaxFetchSizeExceeded()
          Tests if the query result has been fetched to the end and the end was reached due to hitting the maxFetchSize limit
 boolean isNameGenerated()
          Tests if the Iterator's name was generated by the system.
 boolean isPostedToDB()
           
protected  boolean isQueryChanged()
          Internal: Applications should not use this method.
 boolean isRangeAtBottom()
          Tests if the Row Set Iterator range is at the end of the result set.
 boolean isRangeAtTop()
          Tests if the Row Set Iterator range is at the beginning of the result set.
 boolean isReadOnly()
          Tests if the view object is read-only.
 boolean isRowValidation()
          Gets the validation flag on this iterator.
 boolean isRuntimeSQLGeneration()
           
 boolean isSelectAllAttributes()
           
 boolean isTransientTransactionListener()
          Tests whether this transaction listener is transient or permanent.
 boolean isTransientTransactionPostListener()
          Tests whether this transaction listener is transient or permanent.
 boolean isViewLinkAccessorRetained()
           
 Row last()
          Gets the last row in the iterator.
 AttributeDef lookupAttributeDef(java.lang.String name)
          Gets an attribute definition, given its name.
 ListBindingDef lookupListBindingDef(java.lang.String lbName)
          Return listbinding definition if defined in this ViewObject (or in the entity definitions for entities that this ViewObject constitutes of).
 ViewAccessorDef lookupViewAccessorDef(java.lang.String vaName)
           
protected  void markQueryCollectionDirty(QueryCollection qc, boolean isDirty)
          Given a query collection qc and a flag isDirty, explicitly sets the query collection's dirty status.
 Row next()
          Gets the next row in the iterator.
protected  void notifyRowDeleted(ViewRowSetImpl vrs, Row viewRow, int rowIndex)
          This method is invoked by the framework when a row is deleted from the given ViewRowSet for this ViewObject.
protected  void notifyRowInserted(ViewRowSetImpl vrs, Row viewRow, int rowIndex)
          This method is invoked by the framework when inserts are made to the given ViewRowSet for this ViewObject.
protected  void notifyRowUpdated(QueryCollection qc, Row row, int[] attrIndices, boolean markQCDirty)
           
protected  void notifyRowUpdated(QueryCollection qc, Row row, int[] attrIndices, UpdateEvent rowUpdateEvent)
           
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 notifyRowUpdated(ViewRowSetImpl vrs, Row[] viewRows, int[] attrIndices, UpdateEvent updateEvent)
          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)
          Notifies a listener to post any cached changes to the database.
 void preFetchRowsByKeys(AttributeDef[] keyAttrs, Key[] keys)
           
 void preFetchRowsByKeys(AttributeDef[] keyAttrs, Key[] keys, Row parentRow)
           
 Row previous()
          Gets the previous row in the iterator.
protected  void processNewSelectSet()
          Activate the attributes selected in calls to selectAttributeDefs, unselectAttributeDefs.
protected  void processSortCriteria()
           
 void putViewCriteria(java.lang.String name, ViewCriteria vc)
          Add a view criteria to be managed by this object
protected  void releaseUserDataForCollection(java.lang.Object qc, java.lang.Object data)
           
 void remove()
          Removes this View Object from its containing application module.
 boolean removeApplyViewCriteriaName(java.lang.String name)
          Unapplied the view criteria if it is applied.
 void removeCurrentRow()
          Removes the current Row object from the Row Set.
 Row removeCurrentRowAndRetain()
          Removes the current Row object from the collection and retain it for insertion into another location.
 void removeCurrentRowFromCollection()
          Removes the current Row object from the collection.
 void removeListener(java.lang.Object listener)
          Removes a subscriber (listener) for RowSetListener events generated by this row set iterator.
 void removeManagementListener(RowSetManagementListener listener)
          Removes a subscriber (listener) for RowSetManagementListener events generated by this row set iterator.
 boolean removeMasterRowSetIterator(RowSetIterator masterRSI)
          Removes a master row set iterator.
 void removeNamedWhereClauseParam(java.lang.String name)
          Removes a named where-clause parameter.
protected  void removeRowSet(ViewRowSetImpl rs)
           
 ViewCriteria removeViewCriteria(java.lang.String name)
          Removes the view criteria from this manager.
 void reset()
          Moves the currency to the slot before the first row.
 void resetSelectedAttributeDefs()
           
 void resetSelectedAttributeDefs(boolean forceSelectAllAttributes)
          Does not select or unselect any attributes, but clears the private member variable of ViewObjectImpl that holds the fields that should be selected.
protected  void resetSession()
          BC4J invokes this method when a ViewObject is being reset for potential reuse by another client session.
protected  Row[] retrieveByKey(ViewRowSetImpl rs, Key key, int maxNumOfRows)
           
protected  Row[] retrieveByKey(ViewRowSetImpl rs, Key key, int maxNumOfRows, boolean skipWhere)
           
protected  Row[] retrieveByKey(ViewRowSetImpl rs, java.lang.String keyName, Key key, int maxNumOfRows, boolean skipWhere)
           
protected  boolean rowQualifies(ViewRowImpl vr)
           
 int scrollRange(int amount)
          Moves the Row Set Iterator range up or down a given number of rows.
 int scrollRangeTo(Row row, int index)
          Scrolls the range to place a given row at a given range index.
 int scrollToRangePage(int pageIndex)
          Moves the row set range start to the given page index where every page consists of RangeSize number of rows.
 void selectAttributeDefs(java.lang.String[] attrNameArray)
          Does not select or unselect any attributes, but adds the attributes in attrNameArray to a private member variable of ViewObjectImpl.
 void setAccessMode(byte mode)
          Constrains the row access based on the following settings:
 void setApplyJoinedViewCriteriaNames(java.lang.String[] names)
           
 void setApplyViewCriteriaName(java.lang.String name)
          Apply the view criteria name passed as the argument.
 void setApplyViewCriteriaName(java.lang.String name, boolean bAppend)
          Apply the view crtieria name passed as the argument.
 void setApplyViewCriteriaNames(java.lang.String[] names)
          Apply a set of view criteria names passed as the argument.
 void setAssociationConsistent(boolean consistent)
          Sets the association-consistent flag for this row set.
 boolean setCurrentRow(Row row)
          Designates a given row as the current row.
 boolean setCurrentRowAtRangeIndex(int index)
          Designates a given index as the current row.
protected  void setDefaultAssocConsistent(boolean isEquiJoin)
           
 void setForwardOnly(boolean forwardOnly)
          Constrains the row set to sequential access.
 void setFromClause(java.lang.String fromClause)
           
 void setFullSqlMode(int fullSqlMode)
           
 void setIterMode(int mode)
          Sets the iteration mode for this Row Iterator.
 void setListenToEntityEvents(boolean b)
          Sets the listen-to-entity-events flag.
 boolean setMasterRowSetIterator(RowSetIterator masterRSI)
          Sets the master iterator.
 void setMaxFetchSize(int size)
          Maximum number of rows to fetch for this View Object.
 void setNamedWhereClauseParam(java.lang.String name, java.lang.Object value)
          Sets the value of a named where-clause parameter for this row set.
 void setOrderByClause(java.lang.String orderByClause)
          Sets the query's ORDER BY clause.
protected  void setPassivatableTransientAttribute(ViewAttributeDefImpl voAttr, boolean flag)
          Marks the given attribute def for this VO as passivatable.
 void setPostedToDB(boolean b)
           
 void setQuery(java.lang.String query)
          Sets the user-defined query.
protected  void setQueryAsChanged(boolean isChanged)
           
protected  void setQueryChanged(boolean isChanged)
          Internal: Applications should not use this method.
 void setQueryMode(int queryMode)
          Sets query mode for the view object.
 int setRangeSize(int size)
          Modifies the size of the Row Set Iterator range.
 int setRangeStart(int start)
          Moves the Row Set Iterator range.
 void setReqdVC(ViewCriteria reqdVc)
           
 void setRequiredViewCriteria(ViewCriteria vc)
          Setting a view criteria as required will enforce the criteria whenever the view object's query is executed.
protected  void setResultSetForCollection(java.lang.Object qc, ResultSet rs)
           
 void setRowMatch(RowMatch rowMatch)
          Sets an in-memory filter (RowMatch) for the view object.
protected  void setRowMatchFromViewCriteria(RowMatch rowMatch)
           
 void setRowValidation(boolean flag)
          Sets the validation flag on this iterator.
 void setSelectClause(java.lang.String selClause)
           
 void setSortBy(java.lang.String sortBy)
           
 void setTransPostHandle(int hdl)
          Advanced: 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)
          Specifies a single bind variable value to use with the view object's where-clause.
 void setWhereClauseParams(java.lang.Object[] values)
          Specifies the bind variable values to use with the view object's where-clause.
 boolean shouldPutJoinConstraintInWhereClause()
           
 void skipNamedWhereClauseParam(java.lang.String name)
          Skips the named where-clause parameter for this row set.
 void sortRows(Row[] rows)
           
 void sourceChanged(EntityEvent event)
          Handles events reported to (EntityListener)s.
protected  void validateRangeSizeForRangePaging(ViewRowSetImpl vrs, int rangeSize)
          Advanced Internal method only.
 
Methods inherited from class oracle.jbo.server.ComponentObjectImpl
addListener, applyPersonalization, create, createRef, ensureVariableManager, getAllProperties, getCompListeners, getCompListenersList, getDefFullName, getDefName, getMessageBundleClass, getResourceBundleDef, getRootApplicationModule, getVariableManager, hasVariables, isDead, resolvePropertyRaw
 
Methods inherited from class oracle.jbo.server.NamedObjectImpl
formatChildCollectionForOutput, formatChildCollectionForOutput, formatChildCollectionForOutput, formatForOutput, getFullName, getName, getParent, getProperties, getPropertiesAsStrings, getPropertiesMap, getProperty, getProperty, getResourcesFromBundle, getUserData, parseAttrArrayElements, refreshProperty, requiresNamePrefixedResId, setFullName, setName, setParent, setPropertiesMap, setProperty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.jbo.StructureDef
getDefFullName, getDefName, getFullName, getName
 
Methods inherited from interface oracle.jbo.ComponentObject
getDefFullName, getDefName, getFullName, getName
 
Methods inherited from interface oracle.jbo.RowSet
getName
 
Methods inherited from interface oracle.jbo.VariableManagerOwner
ensureVariableManager, getMessageBundleClass, getResourceBundleDef, getVariableManager, hasVariables
 
Methods inherited from interface oracle.jbo.Properties
getProperties, getProperty, getProperty, refreshProperty
 

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. The result set is closed when the user reaches the end of the row.

See Also:
#setFetchMode(byte), Constant Field Values

FETCH_ALL

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

See Also:
#setFetchMode(byte), Constant Field Values

FETCH_DEFAULT

public static final byte FETCH_DEFAULT
A fetch mode that indicates that the default mode to be used. Currently the default is FETCH_AS_NEEDED.

See Also:
#setFetchMode(byte), Constant Field Values

FULLSQL_MODE_NO_AUGMENTATION

public static final int FULLSQL_MODE_NO_AUGMENTATION
A full SQL mode that indicates that no ViewObject level query augmentation (where-clause, order-by-clause) will be added to the query specified through a call to setQuery().

See Also:
setFullSqlMode(int), setQuery(String), Constant Field Values

FULLSQL_MODE_AUGMENTATION

public static final int FULLSQL_MODE_AUGMENTATION
A full SQL mode that indicates that ViewObject level query augmentation (where-clause, order-by-clause) will be added to the query specified through a call to setQuery().

See Also:
setFullSqlMode(int), setQuery(String), Constant Field Values

MIN_ROWS_PER_NODE

public static final int MIN_ROWS_PER_NODE
See Also:
Constant Field Values

MIN_ACTIVE_NODES

public static final int MIN_ACTIVE_NODES
See Also:
Constant Field Values

PROPERTY_DEFERRED_ESTIMATED_ROWCOUNT

public static final java.lang.String PROPERTY_DEFERRED_ESTIMATED_ROWCOUNT
A custom property name that indicates if this VO should defer calling estimatedRowCount in the 'getDeferredEstimatedRowCount' method.

See Also:
Constant Field Values

CLASS_INSTANCE

public static final java.lang.Class CLASS_INSTANCE

mAssocFromClause

protected java.lang.String mAssocFromClause

mAssocRefs

protected ArrayList mAssocRefs

mUserDefinedQuery

protected java.lang.String mUserDefinedQuery

mAttrDefs

protected ViewAttributeDefImpl[] mAttrDefs

mAttrDefsTab

protected Hashtable mAttrDefsTab

mChangedAttrIndices

protected int[] mChangedAttrIndices

mViewDef

protected ViewDefImpl mViewDef

mDefaultRowSetMap

protected Hashtable mDefaultRowSetMap

mOptimizerHint

protected java.lang.String mOptimizerHint

mAssocClause

protected java.lang.String mAssocClause

mKeyAttrRefs

protected ViewAttributeDefImpl[] mKeyAttrRefs

mAutoPostChanges

protected boolean mAutoPostChanges

mOrderBy

protected java.lang.String mOrderBy

mDefaultMaxRowsPerNode

public static int mDefaultMaxRowsPerNode

mDefaultMaxActiveNodes

public static int mDefaultMaxActiveNodes

mUsePersColl

public static boolean mUsePersColl

mChgAttrIndUseCount

protected int mChgAttrIndUseCount
Constructor Detail

ViewObjectImpl

public ViewObjectImpl(java.lang.String name,
                      ViewDefImpl def)

ViewObjectImpl

public ViewObjectImpl()
Method Detail

setSortBy

public void setSortBy(java.lang.String sortBy)
Specified by:
setSortBy in interface ViewObject

getSortBy

public java.lang.String getSortBy()
Specified by:
getSortBy in interface ViewObject

getDefaultRowSet

public ViewRowSetImpl getDefaultRowSet()
Internal: Applications should not use this method.

Gets the default View Row Set.

This Row Set gets the same name as this View Object. This method should not be overridden.

Returns:
the default row set.

getViewDef

protected ViewDefImpl getViewDef()

getKeyAttributeDefs

public AttributeDef[] getKeyAttributeDefs()
Description copied from interface: ViewObject
Returns the attribute definitions that make up the constituents of the key object for rows returned from this view object.

This method is used to pass AttributeDef[] to the Key.Key(String, AttributeDef[]) constructor to parse the constituent-bytes and convert them into value-objects that make up the key.

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.

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.

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.

getQuery

public java.lang.String getQuery()
Description copied from interface: ViewObject
Returns the query statement. Unlike oracle.jbo.server.ViewObjectImpl#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.

getWhereClause

public java.lang.String getWhereClause()
Description copied from interface: ViewObject
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. In the middle tier, to get the complete where-clause built from the view object instance, the view definition, the view criteria, and the view links use buildWhereClause(java.lang.StringBuffer, int)

Specified by:
getWhereClause in interface ViewObject
Returns:
the where-clause, excluding the 'WHERE' keyword; null if no where-clause exists.

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.

isReadOnly

public boolean isReadOnly()
Description copied from interface: ViewObject
Tests if the view object is read-only.

A view is read-only if it does not have primary keys or if all its entity references are reference-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.

executeQuery

public void executeQuery()
Description copied from interface: RowSet
Executes the query.

Specified by:
executeQuery in interface RowSet

executeQueryForCollection

protected void executeQueryForCollection(java.lang.Object qc,
                                         java.lang.Object[] params,
                                         int numUserParams)

getPreparedStatement

protected PreparedStatement getPreparedStatement(int numUserParams)

bindParametersForCollection

protected void bindParametersForCollection(QueryCollection qc,
                                           java.lang.Object[] params,
                                           PreparedStatement stmt)

findRowSetIterator

public RowSetIterator findRowSetIterator(java.lang.String rsiName)
Description copied from interface: RowSet
Gets the named row set iterator that was created at runtime for this row set.

Specified by:
findRowSetIterator in interface RowSet
Parameters:
rsiName - a row set iterator name. If null, it returns the the row set.
Returns:
the row set iterator. null if the named row set iterator is not not found.

getApplicationModule

public ApplicationModule getApplicationModule()
Description copied from class: ComponentObjectImpl
Gets the Application Module.

Specified by:
getApplicationModule in interface RowSet
Overrides:
getApplicationModule in class ComponentObjectImpl
Returns:
ApplicationModule

createAndInitRow

public Row createAndInitRow(AttributeList initVals)
Description copied from interface: RowIterator
Creates and initializes a new Row object, but does not insert it into the Row Set. This method differs from createRow() mainly in that this method allows the user to pass in a list of name-value pairs with which row attributes are initialized.

nvp is a named value pair. When building an nvp from scratch, use NameValuePairs to build a new nvp. Here is an example:

 NameValuePairs nvp = new NameValuePairs();
 nvp.setAttribute("EmpTyp", "C");

 Row row = voEmp.createAndInitRow(nvp);
 
This method is particularly useful when creating a subclass View Row or Entity Row. You can include polymorphic discriminator attribute values in nvp and correct subclass row object will be created.

When this method is called, underlying entities are created. After the new entities are created, a new view row is created. After that ViewRowImpl.create(oracle.jbo.AttributeList) is called with this nvp. ViewRowImpl.create(AttributeList) walks thru the list of entities and calls EntityImpl.create(AttributeList) with the same nvp for each entity in the view row.

Specified by:
createAndInitRow in interface RowIterator
Parameters:
initVals - a list of name-value pairs.
Returns:
a new Row object.

createKey

public Key createKey(AttributeList nvp)
Description copied from interface: RowIterator
Given a list of name-value pairs, creates a Key object that matches the key structure for the ViewObject for this RowItertor. This Key object could be used as a valid argument to findByKey. This Key will have null values for attributes expected in the key structure for this ViewObject, but not found in the given set of name-value pairs.

Specified by:
createKey in interface RowIterator

createRow

public Row createRow()
Description copied from interface: RowIterator
Creates a new Row object, but does not insert it into the Row Set.

Specified by:
createRow in interface RowIterator
Returns:
a new Row object.

findByKey

public Row[] findByKey(Key key,
                       int maxNumOfRows)
Description copied from interface: RowIterator
Finds and returns View rows that match the specified key.

If this View Object has multiple Entity Object bases, the key need not be specified for all. However, if a key is specified for n-th Entity Object, and if this Entity Object's primary key consists of multiple parts, all parts of the key must be specified.

If not all Entity keys are included, multiple rows may match the partial key. The maxNumOfRows parameter is used to specify the maximum number of rows to return.

For example, suppose the View Object has Emp and DeptLocation as its Entity Object bases. Suppose further that Emp has a one part primary key (employee number) and DeptLocation has a two part primary key (dept name and location).

The user can make the following call to look for all employees working in ACCOUNTING's NEW YORK office:

 // The key will consist of 3 parts.  The first part is
 // for the employee number (which is null, meaning not
 // specified).  The second part is the department name.
 // The third is the location.
 Object[] keyValues = new Object[3];

 keyValues[0] = null; // All employees
 keyValues[1] = "ACCOUNTING";
 keyValues[4] = "NEW YORK"; // third Entity Object, key part 1

 Row[] rows = myAM.findViewObject(new Key(keyValues), -1);
 

In this example, if you were to include the key for DeptLocation, you must specify both key parts.

Note that the position of the key must patch the order of the Entity Object bases and their keys. In the above example, keyValues[0] is always the employee number. You cannot specify the employee number in keyValues[1] or keyValues[2].

This method works even on a View Object which has no Entity Object base. For this to work, however, the ViewObject's key attribute list must have been set up through a call to oracle.jbo.server.ViewObjectImpl#setKeyAttributeDefs(int[]). For example, suppose we have a View Object with 5 attributes where attribute 0 and 2 are to be its key attributes.

Then, the following code block will retrieve all rows whose attribute 0 is "PERM" and attribute 2 is 30.

 // First set up the key attributes
 myVO.setKeyAttributeDefs(new int[] { 0, 2 });

 // The key will consist of 2 parts.  The first part is
 // for attribtue 0 and the second is for attribute 2.
 Object[] keyValues = new Object[2];

 keyValues[0] = "PERM";
 keyValues[1] = new Integer(30);

 Row[] rows = myAM.findViewObject(new Key(keyValues), -1);
 

Internally, findByKey() works as follows for a View Object with Entity Object bases: It takes the first non-null entity key from key. It uses it to find the Entity row in the cache. If it finds it, then it looks at all View rows in the Row Set collection that uses that Entity row and apply the remaining keys to qualify them. It may or may not find as many rows as requested.

If the requested number of rows have been found, the array returns. Otherwise, a check is made to see if the View Object's fetch size is unlimited (which is -1, see oracle.jbo.ViewObject#setMaxFetchSize(int)) and the Row Set has fetched all the rows out of database into its collection. If this is the case, we return the array even if the requested number of rows have not been found. This is because these conditions imply that all rows have been brought into Row Set collection and no further search is necessary.

Otherwise (the requested number of rows not yet found and the Row Set has not yet fetched all rows or the fetch size is not -1), the search continues. We now use the key build a where-clause for an internal View Object. That where-clause is applied and qualifying rows are retrieved from it to find the requested number of rows.

For a View Object which has no Entity Object base, we simply skip the step of looking in the Entity Object cache. Other than that, the logic is applied.

As new rows are retrieved from database they are added to the Row Set collection. Thus, the user can work with these rows immediately, e.g., call RowIterator.setCurrentRow(Row) with one of them. Care is applied to make sure the same row is not added to the Row Set collection multiple times.

This method does not fire any navigation event, nor does it move the range or the current row. Also, as rows are added to the Row Set collection, no insertion event fires (as this is analogous to fetching rows).

See RowIterator.getRow(Key) for comparison between this method and getRow(Key).

Specified by:
findByKey in interface RowIterator
Parameters:
key - the key to match.
maxNumOfRows - the maximum size of the array to return, or -1 to return all rows.
Returns:
an array of rows matching the key.

findByAltKey

public RowIterator findByAltKey(java.lang.String keyName,
                                Key key,
                                int maxNumOfRows,
                                boolean skipWhere)

first

public Row first()
Description copied from interface: RowIterator
Gets the first row in the iterator. If first() is called on an iterator whose Row Set has not yet been RowSet.executeQuery()'ed, the Row Set's query is executed. Thus, the user does not need to call executeQuery() himself before calling first(). We refer to this as implicit query execution or implicit Row Set execution.

This method checks to see if the currency is not on the first row. If not, it resets the currency to the imaginary slot before the first row and then calls RowIterator.next(). Note that the act of resetting the currency may cause the range to scroll upward.

If the currency is on the slot before the first row, it simply calls next(). In this case, first() is equivalent to next().

If the currency is already on the first row, nothing happens.

If first() is called on an empty Row Set (a Row Set that has no row), the currency is set to the slot after the last row, and null is returned.

This method generates events to notify the changes to the iterator, e.g., ScrollEvent and/or NavigationEvent. See RowIterator.next() for details.

Specified by:
first in interface RowIterator
Returns:
the first Row object, or null if there is no first row. In that case (null return), the current slot status will be RowIterator.SLOT_BEYOND_LAST.

findAttributeDef

public AttributeDef findAttributeDef(java.lang.String name)
Description copied from interface: StructureDef
Gets an attribute definition, given its name.

Specified by:
findAttributeDef in interface StructureDef
Parameters:
name - the name of an AttributeDef.
Returns:
an attribute definition

getAttributeCount

public int getAttributeCount()
Description copied from interface: StructureDef
Returns the number of defined attributes.

Specified by:
getAttributeCount in interface StructureDef
Returns:
the number of attributes.

getAttributeDef

public AttributeDef getAttributeDef(int index)
Description copied from interface: StructureDef
Gets an attribute definition, given its index.

Specified by:
getAttributeDef in interface StructureDef
Parameters:
index - the index of an AttributeDef, where the leftmost attribute has index zero.
Returns:
an attribute definition.

getAttributeDefs

public AttributeDef[] getAttributeDefs()
Description copied from interface: StructureDef
Gets the defined attributes.

Specified by:
getAttributeDefs in interface StructureDef
Returns:
an array of attribute definitions.

getAttributeIndexOf

public int getAttributeIndexOf(java.lang.String name)
Description copied from interface: StructureDef
Finds the index (0-based) of the named attribute.

Specified by:
getAttributeIndexOf in interface StructureDef
Parameters:
name - the attribute's name.
Returns:
an integer in the range 0 to getAttributeCount() - 1. If the named attribute is not found, it returns -1.

lookupAttributeDef

public AttributeDef lookupAttributeDef(java.lang.String name)
Description copied from interface: StructureDef
Gets an attribute definition, given its name.

Specified by:
lookupAttributeDef in interface StructureDef
Parameters:
name - the name of an AttributeDef.
Returns:
an attribute definition if found, null otherwise

lookupListBindingDef

public ListBindingDef lookupListBindingDef(java.lang.String lbName)
Description copied from interface: ViewObject
Return listbinding definition if defined in this ViewObject (or in the entity definitions for entities that this ViewObject constitutes of).

Specified by:
lookupListBindingDef in interface ViewObject

getViewAttributeDefImpls

public ViewAttributeDefImpl[] getViewAttributeDefImpls()

cancelQuery

public boolean cancelQuery()
Description copied from interface: RowSet
Cancels a running query.

Specified by:
cancelQuery in interface RowSet
Returns:
a flag indicating whether the request to cancel was honored or not. It will return false if the JDBC statement is not executing a query.

closeRowSet

public void closeRowSet()
Description copied from interface: RowSet
Closes the row set. It closes all row set iterators that belong to this row set. If this row set is a detail row set in a master-detail relationship, closeRowSet removes this row set from the master row set iterator.

Specified by:
closeRowSet in interface RowSet

createRowSetIterator

public RowSetIterator createRowSetIterator(java.lang.String name)
Description copied from interface: RowSet
Creates an iterator for the row set.

Specified by:
createRowSetIterator in interface RowSet
Parameters:
name - the name to be given to the iterator.
Returns:
an iterator for this.

defineNamedWhereClauseParam

public void defineNamedWhereClauseParam(java.lang.String name,
                                        java.lang.Object defaultValue,
                                        int[] indices)
Description copied from interface: RowSet
Defines a named bind variable to use with the view object's where-clause.

This named where-clause parameter will be defined as a variable on the view object. That is, if a named where-clause parameter is defined through one row set, all other row sets that belongs to the same parent view object will "see" that parameter.

Through the defaultValue, one can specify the default value for this where-clause parameter. If no default value is supplied, null will be used as the parameter value.

The indices parameter specifies where-clause parameter indices into which this named parameter will be bound. The same value can be bound into multiple indices. For example, if { 1, 2 } is specified for indices, the value will be bound for where-clause parameter indices of 1 and 2. I.e., this parameter will produce setWhereClauseParam(1, value) and setWhereClauseParam(2, value).

This method can be invoked to redefine an existing named where-clause paramter (to change the default value and the indices) only if the named parameter is found on the view object. If the named parameter/variable is found on one of the parent objects, a new where-clause parameter definition is still added to the view object.

When redefining, a check is made to ensure that the existing variable has no kind specification (null) or is of the "where" kind (which means that the existing variable is a where-clause parameter). If not, an InvalidParamException is thrown.

Defining a named where-clause parameter does not automatically execute the query. You must call RowSet.executeQuery() to apply the new bind value.

Specified by:
defineNamedWhereClauseParam in interface RowSet
Parameters:
name - the name of the where-clause parameter.
defaultValue - specifies the default value for this where-clause parameter. This default value can be overridden through a call to setNamedWhereClauseParam().
indices - where-clause indices into which this parameter value should be bound. See above.

getAccessMode

public byte getAccessMode()
Specified by:
getAccessMode in interface RowSet
Returns:
Returns the current access mode for this row set.
See Also:
RowSet.setAccessMode(byte)

getEstimatedRowCount

public long getEstimatedRowCount()
Description copied from interface: RowSet
Counts the number of rows in the collection defined by the view object's query.

This method uses a "SELECT COUNT(1) FROM (<query-statement>)" query to obtained the initial count. After that, changes to row count (such as insertion and deletion of rows) is kept up to date.

However, since the row counting query and the query to retrieve actual rows are issued at two different times, it is possible for the accurate count to change between these two points. This is why this method is named getEstimatedRowCount().

Specified by:
getEstimatedRowCount in interface RowSet
Returns:
an estimated number of rows.

getMasterRowSetIterators

public RowSetIterator[] getMasterRowSetIterators()
Description copied from interface: RowSet
Return all controlling masters of this row set.

Specified by:
getMasterRowSetIterators in interface RowSet
Returns:
An array of master iterators.

getNamedWhereClauseParam

public java.lang.Object getNamedWhereClauseParam(java.lang.String name)
Description copied from interface: RowSet
Gets the value of a named where-clause parameter for this row set.

If the view object owns multiple row sets, each row set may have its own (different) named where-clause parameter value.

Specified by:
getNamedWhereClauseParam in interface RowSet
Parameters:
name - the name of the where-clause parameter.

getRowSetIterator

public RowSetIterator getRowSetIterator()

getRowSetIterators

public RowSetIterator[] getRowSetIterators()
Description copied from interface: RowSet
Gets all row set iterators that belong to this row set.

Specified by:
getRowSetIterators in interface RowSet
Returns:
the array of row set iterators.

getViewObject

public ViewObject getViewObject()
Description copied from interface: RowSet
Gets the view object that owns this row set.

If this row set is the result of calling a view link accessor, the returned view object is an internal view object. ViewObject#isInternal() indicates whether the view object is internal or not. Even if a view link is defined between the master and detail view object, and even if an instance of them are included in the application module's data model, calling the view link by default uses a separate view object instance from the one in the AM's data model. To access the view link accessor's ViewObject, use the following code snippet (assuming that the detail side is called "MyDetail"):

 RowSet detailRS = (RowSet) masterViewRow.getMyDetail();
 ViewObject detailVO = detailRS.getViewObject();
 

Specified by:
getViewObject in interface RowSet
Returns:
the parent view object.

getWhereClauseParams

public java.lang.Object[] getWhereClauseParams()
Description copied from interface: RowSet
Gets the bind variable values to be used with the view object's where-clause.

Specified by:
getWhereClauseParams in interface RowSet
Returns:
an array of bind-variable values.

isAssociationConsistent

public boolean isAssociationConsistent()
Description copied from interface: RowSet
Returns the flag indicating whether association-consistent mode is on or not.

Specified by:
isAssociationConsistent in interface RowSet
Returns:
true if un-posted new rows are to appear, false otherwise. This flag has no effect if the view object is not entity based.
See Also:
RowSet.setAssociationConsistent(boolean)

isExecuted

public boolean isExecuted()
Description copied from interface: RowSet
Returns true if the current ViewObject's query has been executed for this row set.

Specified by:
isExecuted in interface RowSet
Returns:
true if query has been executed.

isFetchComplete

public boolean isFetchComplete()
Description copied from interface: RowSet
Tests if the query result set has been fetched to the end.

Specified by:
isFetchComplete in interface RowSet
Returns:
true if the result set has been fetched to the end.

isForwardOnly

public boolean isForwardOnly()
Description copied from interface: RowSet
Tests if the row set is constrained to sequential access.

Specified by:
isForwardOnly in interface RowSet
Returns:
true if the row set is restricted to forward-only processing.
See Also:
RowSet.setForwardOnly(boolean)

isMaxFetchSizeExceeded

public boolean isMaxFetchSizeExceeded()
Description copied from interface: RowSet
Tests if the query result has been fetched to the end and the end was reached due to hitting the maxFetchSize limit

Specified by:
isMaxFetchSizeExceeded in interface RowSet
Returns:
true if the result set has been fetched to the maxFetchSize limit and there are still more rows in the database.

removeMasterRowSetIterator

public boolean removeMasterRowSetIterator(RowSetIterator masterRSI)
Description copied from interface: RowSet
Removes a master row set iterator.

Specified by:
removeMasterRowSetIterator in interface RowSet
Parameters:
masterRSI - the iterator to be removed.
Returns:
true if masterRS was found, false otherwise.

removeNamedWhereClauseParam

public void removeNamedWhereClauseParam(java.lang.String name)
Description copied from interface: RowSet
Removes a named where-clause parameter.

This method removes previously defined named where-clause parameter. A check is made to ensure that the variable being removed is a where-clause parameter (variable kind = "where"). If not, an InvalidParamException is thrown.

If the named where-clause parameter is found but it does not belong to the view object that owns this row set, an InvalidOperException is thrown. This means one is disallowed from removing a named where-clause parameter that belongs to the View definition, for example.

Removing a named where-clause parameter does not automatically execute the query. You must call RowSet.executeQuery() for the removal to take effect.

Specified by:
removeNamedWhereClauseParam in interface RowSet
Parameters:
name - the name of the where-clause parameter to remove.

setAccessMode

public void setAccessMode(byte mode)
Description copied from interface: RowSet
Constrains the row access based on the following settings:

Switching access modes for a rowset will not take effect until the next explicit call to executeQuery. Switching accessmode back to SCROLLABLE from any other mode is not allowed.

Specified by:
setAccessMode in interface RowSet
Parameters:
mode - One of the four enumerated values RowSet.SCROLLABLE, RowSet.FORWARD_ONLY, RowSet.RANGE_PAGING, RowSet.RANGE_PAGING_AUTO_POST.

setAssociationConsistent

public void setAssociationConsistent(boolean consistent)
Description copied from interface: RowSet
Sets the association-consistent flag for this row set.

Association-consistent mode allows the user to see new rows created/inserted through another view object. Note that this mode is effective only for view objects that are entity based. If the view object has no entity base, this mode has no effect.

Suppose we have an entity named E. Suppose two view objects, V1 and V2 are based on E. (V1 and V2 do not have to come from the same view definition.) Suppose the user creates a new row through V1. This creates an instance of E as well. The new entity row is registered only when its primary key is attribute set. At this time, an event is sent out to all view objects based on E, i.e., V1 and V2.

When V2 receives this event, it enumerates through all its collections (essentially its row sets--strictly speaking its query collections) looking for those whose isAssociationConsistent() value is true. For each row set whose flag value is true (say R2), it checks to see if it has any view row mapped to the new entity row. If not, it create a new view row and maps it to the new entity row. A rowInserted event fires.

Thus, from the user's view point, R2 is "seeing" the new row, although the row has not yet been posted to database. Hence, setting this flag to true enables the user to see new rows before the row is posted/queried when the view object is entity based.

If flag is false or if the view object is not entity based, the user needs to post the new row through Transaction.postChanges() and requery the row set through RowSet.executeQuery() to see the new row.

The default value for this flag can be globally controlled through the jbo.viewlink.consistent property. Its value can be true, false, or DEFAULT. If the property is not specified, the default value is DEFAULT. A similar property jbo.assoc.consistent controls whether the new-row-appearing behavior should be supported for row sets returned from entity association accessor calls. For jbo.assoc.consistent, supported values are true or false.

If the property value is set to true, all row sets will have true for its initial isAssociationConsistent() value. If the property value is set to false, all row sets will have false for its initial value. If the property value is set to DEFAULT (which is the default), the view object will use the following logic to compute its initial isAssociationConsistent() value: if the view object has multiple entity bases that are updateable, then the initial value is false. If the view object has a where-clause, then the initial value is false. Otherwise, it is true.

Once this method is called to set the flag value manually, neither the property setting nor the view object's initial flag value has an effect.

Specified by:
setAssociationConsistent in interface RowSet
Parameters:
consistent - indicates whether association-consistency should be on or not.

setForwardOnly

public void setForwardOnly(boolean forwardOnly)
Description copied from interface: RowSet
Constrains the row set to sequential access.

When set to true, a row preceeding the current row cannot be designated as the new current row. This restriction allows performance to be optimized.

Specified by:
setForwardOnly in interface RowSet
Parameters:
forwardOnly - true restricts the row set to forward-only processing, false otherwise.

setMasterRowSetIterator

public boolean setMasterRowSetIterator(RowSetIterator masterRSI)
Description copied from interface: RowSet
Sets the master iterator.

Specified by:
setMasterRowSetIterator in interface RowSet
Parameters:
masterRSI - the new master row set iterator for this row set.
Returns:
true if the operation succeeded.

setNamedWhereClauseParam

public void setNamedWhereClauseParam(java.lang.String name,
                                     java.lang.Object value)
Description copied from interface: RowSet
Sets the value of a named where-clause parameter for this row set.

If the view object owns multiple row sets, each row set may have its own (different) named where-clause parameter value.

Setting a named where-clause parameter does not automatically execute the query. You must call RowSet.executeQuery() to apply the new bind value.

Specified by:
setNamedWhereClauseParam in interface RowSet
Parameters:
name - the name of the where-clause parameter.
value - the where-clause parameter value for this row set.

setWhereClauseParam

public void setWhereClauseParam(int index,
                                java.lang.Object value)
Description copied from interface: RowSet
Specifies a single bind variable value to use with the view object's where-clause.

Setting the where-clause bind values through this method does not automatically execute the query. You must call RowSet.executeQuery() to apply the new bind values.

Specified by:
setWhereClauseParam in interface RowSet
Parameters:
index - the index identifying the bind variable. If the view object is using the JDBC style bindings ("?" for bind variable), value is bound to the bind variable that appears in the index-th order (0 based indexing). If the view object is using the Oracle style bindings (":1", ":2", etc. for bind variable), value is bound to the bind variable :(index+1). If index is 0, value is bound to :1. If index is 1, value is bound to :2.
value - the bind variable value.

setWhereClauseParams

public void setWhereClauseParams(java.lang.Object[] values)
Description copied from interface: RowSet
Specifies the bind variable values to use with the view object's where-clause.

Setting the where-clause bind values through this method does not automatically execute the query. You must call RowSet.executeQuery() to apply the new bind values.

Specified by:
setWhereClauseParams in interface RowSet
Parameters:
values - an array of bind values. If the view object is using the JDBC style bindings ("?" for bind variable), values[n] is bound to the bind variable that appears in the n-th order (0 based indexing). If the view object is using the Oracle style bindings (":1", ":2", etc. for bind variable), values[n] is bound to the bind variable :(n+1), i.e., values[0] is bound to :1, values[1] is bound to :2, etc.

skipNamedWhereClauseParam

public void skipNamedWhereClauseParam(java.lang.String name)
Description copied from interface: RowSet
Skips the named where-clause parameter for this row set. This method does not remove the named where-clause parameter. However, it "masks out" the named where-clause parameter, so that the parameter is skipped when the query is executed.

Skipping a named where-clause parameter does not automatically execute the query. You must call RowSet.executeQuery() for the skip to take effect.

Specified by:
skipNamedWhereClauseParam in interface RowSet
Parameters:
name - the name of the where-clause parameter.

addManagementListener

public void addManagementListener(RowSetManagementListener listener)
Description copied from interface: RowSetIterator
Adds a subscriber (listener) to be notified of RowSetManagementListener events generated by this Row Set Iterator.

Specified by:
addManagementListener in interface RowSetIterator
Parameters:
listener - the subscriber to be added. It should implement RowSetManagementListener.

closeRowSetIterator

public void closeRowSetIterator()
Description copied from interface: RowSetIterator
Closes this row set iterator. If this row set iterator is a master in a master-detail relationship, closeRowSetIterator closes all detail row sets.

After that, it fires a RowSetManagementListener.iteratorClosed() event to its RowSetManagementListener's.

Then, it deregisters this row set iterator from the owning row set, and deregisters all its listeners.

Specified by:
closeRowSetIterator in interface RowSetIterator

createDetailRowSet

public RowSet createDetailRowSet(java.lang.String rsName,
                                 java.lang.String viewLinkDefName)
Description copied from interface: RowSetIterator
Creates a detail Row Set. See RowSetIterator.getDetailRowSets() for explanation of detail Row Sets.

This method creates a new detail Row Set for this Iterator.

Specified by:
createDetailRowSet in interface RowSetIterator
Parameters:
rsName - the name of the new detail Row Set.
viewLinkDefName - the name of a View Link definition. This View Link chooses the relationship in which this Iterator is the master and the new Row Set is the detail. It must be a fully qualified name (including the package name).
Returns:
the new detail Row Set.

getDetailRowSets

public RowSet[] getDetailRowSets()
Description copied from interface: RowSetIterator
Gets an array of detail Row Sets for which this Iterator is the master.

In a master-detail relationship in an Application Module, the master in reality is a Row Set Iterator. (Though we often speak of master View Object, in reality, it is the Iterator behind the View Object which is playing the role of the master). Whenever the currency of this master Iterator moves, the detail Row Sets are re-executed to show related Rows.

Calling this method returns an array of Row Sets that are related to this Iterator as detail Row Sets.

Specified by:
getDetailRowSets in interface RowSetIterator
Returns:
an array of detail RowSet.

getEstimatedRangePageCount

public int getEstimatedRangePageCount()
Description copied from interface: RowSetIterator
Returns getEstimatedRowCount()/rangePageSize, if rangeSize > 0. For rangeSize <= 0, returns 1.

This number may fluxuate when the View Object is syncronized with its Entity Object.

Specified by:
getEstimatedRangePageCount in interface RowSetIterator
Returns:
the number of range-pages that this RowSet collection has.

getFilteredRows

public Row[] getFilteredRows(java.lang.String attrName,
                             java.lang.Object attrValue)
Description copied from interface: RowSetIterator
Returns all rows in this collection whose attribute value matches the value being passed in attrValue.

Note that this method does not affect the current RowSetIterator.

Specified by:
getFilteredRows in interface RowSetIterator
Parameters:
attrName - name of the attribute to be used for filtering.
attrValue - attribute value for filtering.
Returns:
an array of rows that match.

getFilteredRowsInRange

public Row[] getFilteredRowsInRange(java.lang.String attrName,
                                    java.lang.Object attrValue)
Description copied from interface: RowSetIterator
Returns all rows in this range whose attribute value matches the value being passed in attrValue.

This method uses getAllRowsInRange() to retrieve all rows and then match the rows.

Specified by:
getFilteredRowsInRange in interface RowSetIterator
Parameters:
attrName - name of the attribute to be used for filtering.
attrValue - attribute value for filtering.
Returns:
an array of rows in the current range that match.

getNextRangeSet

public Row[] getNextRangeSet()
Description copied from interface: RowSetIterator
Gets the next set of rows in the range. This method is good for processing rows in a range-ful fashion. Suppose the Row Set has 20 rows and the Iterator range size is 10. Suppose further that the Iterator is showing rows 0 through 9 (0-based indexing). Calling getNextRangeSet() will return rows 10 through 19.

If the next range set does not have enough rows to fill up the range, getNextRangeSet() returns a partially filled range. That is, this method operates as if the iteration mode is RowIterator.ITER_MODE_LAST_PAGE_PARTIAL.

If there is no more rows, this method returns an empty array (an array of length 0).

While obtaining the next range set, the range will be scrolled. This causes a ScrollEvent to be sent to RowSetListener.rangeScrolled(oracle.jbo.ScrollEvent). To pick up such an event, the listener object must implement the RowSetListener interface. Further, this listener must be registered through a call to NavigatableRowIterator.addListener(Object) (the listener object passed in as the parameter to addListener).

After the next range set is obtained, the method sets the first Row of the range as the current row. This may fire a NavigationEvent and sends it to RowSetListener.navigated(oracle.jbo.NavigationEvent).

Specified by:
getNextRangeSet in interface RowSetIterator
Returns:
an array of Rows in the next range set. An array of length 0 if there are no more rows.

getPreviousRangeSet

public Row[] getPreviousRangeSet()
Description copied from interface: RowSetIterator
Gets the previous set of rows in the range. This method is good for processing rows in a range-ful fashion. Suppose the Row Set has 20 rows and the Iterator range size is 10. Suppose further that the Iterator is showing rows 10 through 19 (0-based indexing). Calling getPreviousRangeSet() will return rows 0 through 9.

If there is no more rows, this method returns an empty array (an array of length 0).

While obtaining the previous range set, the range will be scrolled. This causes a ScrollEvent to be sent to RowSetListener.rangeScrolled(oracle.jbo.ScrollEvent). To pick up such an event, the listener object must implement the RowSetListener interface. Further, this listener must be registered through a call to NavigatableRowIterator.addListener(Object) (the listener object passed in as the parameter to addListener).

After the previous range set is obtained, the method sets the first Row of the range as the current row. This may fire a NavigationEvent and sends it to RowSetListener.navigated(oracle.jbo.NavigationEvent).

Specified by:
getPreviousRangeSet in interface RowSetIterator
Returns:
an array of Rows in the previous range set. An array of length 0 if there are no more rows.

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.

Specified by:
getRowSet in interface RowSetIterator
Returns:
the owning Row Set.
See Also:
RowSetIterator.getRowSet()

getSyncLock

public java.lang.Object getSyncLock()
Description copied from interface: RowSetIterator
Gets the locking object for this Row Set Iterator. Actually, this method locks the Application Module to which this Row Set Iterator belongs. See ApplicationModule.getSyncLock() for details.

Specified by:
getSyncLock in interface RowSetIterator
Returns:
the locking object.

isNameGenerated

public boolean isNameGenerated()
Description copied from interface: RowSetIterator
Tests if the Iterator's name was generated by the system.

Specified by:
isNameGenerated in interface RowSetIterator
Returns:
true if the name was generated by the system. false if the name was given by the user and not generated by the system.

removeManagementListener

public void removeManagementListener(RowSetManagementListener listener)
Description copied from interface: RowSetIterator
Removes a subscriber (listener) for RowSetManagementListener events generated by this row set iterator.

Specified by:
removeManagementListener in interface RowSetIterator
Parameters:
listener - the subscriber to be removed.

scrollToRangePage

public int scrollToRangePage(int pageIndex)
Description copied from interface: RowSetIterator
Moves the row set range start to the given page index where every page consists of RangeSize number of rows. PageIndex should start at page number 1. This method calculates the rowIndex that should start at that page and then scrolls the iterator to start at that row by using the following calculation:

(rangeSize * (pageSize-1)) - getRangeStart();

Specified by:
scrollToRangePage in interface RowSetIterator
Parameters:
pageIndex - the page number to go to in the result set.
Returns:
the number of rows actually scrolled.

addListener

public void addListener(java.lang.Object listener)
Description copied from interface: NavigatableRowIterator
Adds a subscriber (listener) to be notified of RowSetListener events generated by this row set iterator.

Specified by:
addListener in interface NavigatableRowIterator
Parameters:
listener - the subscriber to be added. It should implement RowSetListener.

removeListener

public void removeListener(java.lang.Object listener)
Description copied from interface: NavigatableRowIterator
Removes a subscriber (listener) for RowSetListener events generated by this row set iterator.

Specified by:
removeListener in interface NavigatableRowIterator
Parameters:
listener - the subscriber to be removed.

enumerateRowsInRange

public java.util.Enumeration enumerateRowsInRange()
Description copied from interface: RowIterator
Gets an Enumeration of all rows in the Row Set.

Specified by:
enumerateRowsInRange in interface RowIterator
Returns:
an Enumeration interface.

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.

Specified by:
findByEntity in 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.

findByViewCriteria

public RowIterator findByViewCriteria(ViewCriteria criteria,
                                      int maxNumOfRows,
                                      int queryMode)
Description copied from interface: RowIterator
Finds and returns View rows that match the specified View Criteria. See ViewCriteria for details on how to build and use a View Criteria.

The queryMode parameter controls the manner in which the qualifying View rows are searched. See the QUERY_MODE_... constants in ViewObject for different contants that can be specified (they can be OR'ed together).

If QUERY_MODE_SCAN_VIEW_ROWS is specified, the existing View rows in the current Row Set are scanned for matching rows.

If QUERY_MODE_SCAN_ENTITY_ROWS is specified, the Entity cache is searched for qualifying rows. If qualifying rows are found, they are added to the current Row Set. I.e., they become part of the current row collection. Internally, a finder View Object is created to search the Entity cache and to produce View rows from the Entity cache.

If QUERY_MODE_SCAN_DATABASE_TABLES is specified, a database query is issued to find matching rows. The View Criteria is converted into a where-clause. ViewObject.applyViewCriteria(ViewCriteria) on the finder View Object is invoked and the query executed.

Upon completion of this operation, the finder View Object is closed and removed.

Specified by:
findByViewCriteria in interface RowIterator
Parameters:
criteria - the View Criteria to be used to qualify View rows.
maxNumOfRows - the maximum size of the array to return, or -1 to return all rows. If a value other than -1 is specified and if the specified number of rows is reached, the method returns without performing any further operation.
queryMode - the mode in which qualify View rows are scanned. See above for further info.
Returns:
a RowSet (parented by the same View Object as this RowIterator) that contains qualifying rows. For convenience, this RowSet's range size is initialized to -1 (all rows).

getAllRowsInRange

public Row[] getAllRowsInRange()
Description copied from interface: RowIterator
Extracts the rows in the range.

Specified by:
getAllRowsInRange in interface RowIterator
Returns:
an array of Row objects. The size if the array is setViewSize().

getCurrentRow

public Row getCurrentRow()
Description copied from interface: RowIterator
Accesses the current row.

Specified by:
getCurrentRow in interface RowIterator
Returns:
the Row object designated as the current row.

getCurrentRowIndex

public int getCurrentRowIndex()
Description copied from interface: RowIterator
Gets the absolute index (not range index) of the current row.

Specified by:
getCurrentRowIndex in interface RowIterator
Returns:
a row index.

getCurrentRowSlot

public int getCurrentRowSlot()
Description copied from interface: RowIterator
Gets the slot status of the current row.

Specified by:
getCurrentRowSlot in interface RowIterator
Returns:
one of the class constants prefixed by SLOT_.

getFetchedRowCount

public int getFetchedRowCount()
Description copied from interface: RowIterator
Counts the number of rows fetched from database into the Row Set collection up to this point.

Specified by:
getFetchedRowCount in interface RowIterator
Returns:
the number of rows fetched.

getIterMode

public int getIterMode()
Description copied from interface: RowIterator
Gets the current iteration mode. See Iteration Modes above for details on iteration mode which controls how the range behaves when it reaches the end of the Row Set.

Specified by:
getIterMode in interface RowIterator
Returns:
ITER_MODE_LAST_PAGE_PARTIAL if the iteration mode is "partial-last-page", ITER_MODE_LAST_PAGE_FULL if it is "full-last-page".

getRangeIndexOf

public int getRangeIndexOf(Row row)
Description copied from interface: RowIterator
Get the index of the given row relative to the beginning of the range.

Specified by:
getRangeIndexOf in interface RowIterator
Parameters:
row - a Row object. or -1 if the row is not in range.
Returns:
the index of row,

getRangeSize

public int getRangeSize()
Description copied from interface: RowIterator
Gets the size of the Row Set Iterator range.

Specified by:
getRangeSize in interface RowIterator
Returns:
the number of rows in the range.

getRangeStart

public int getRangeStart()
Description copied from interface: RowIterator
Gets the absolute row index of the first row in the Row Set Iterator range.

The absolute index is 0-based, and is the row's index relative to the entire result set.

Specified by:
getRangeStart in interface RowIterator
Returns:
an index.

getRow

public Row getRow(Key key)
Description copied from interface: RowIterator
Locates and returns a row by its unique key.

If the key being passed in has the row handle, it uses the row handle to locate the row. This is a quick operation. (A key returned from a call to Row.getKey() contains the row handle.)

If the key does not have a row handle, or if the handle look up did not find the row in the View row cache, it performs a linear search through the Row Set collection looking for a match. Hence, this method could take quite a long time to complete.

This method is similar to RowIterator.findByKey(Key, int) in that both methods return Row(s) that match the given key. However, the user should understand the differences. First, findByKey() performs random search. getKey() only performs random search if the key has the row handle portion and if the row with that handle is currently in the Row Set collection. Otherwise, getKey() does a linear search. Hence, findByKey() is generally faster.

However, findByKey() may find the matching Row(s) out of sequence. When a row is not found in the View row cache, findByKey() issues a database query. Matching rows are retrieved and appended to the Row Set collection. For example, suppose the Row Set collection has 200 rows that qualify in the database. Suppose the user retrieved only 10 rows (190 not yet retrieved). Suppose, at this time, the user issues findByKey() that locates the 200-th row (the last row in database result set). That row is appended to the Row Set collection at the 11-th spot. Thus, when you use findByKey(), you may see rows out of sequence. In contrast, getRow() always retrieves rows in sequence.

If the Row Set collection is of any non-trivial size (say over 50), we would recommend findByKey().

findByKey() allows for partial key (only for View Objects that have multiple Entity bases). When a partial key is specified, multiple rows may return. getKey() returns one and only one row (exact match).

Specified by:
getRow in interface RowIterator
Parameters:
key - the key.
Returns:
the Row object matching the key.

getRow

public Row getRow(int index)

getRowAtRangeIndex

public Row getRowAtRangeIndex(int index)
Description copied from interface: RowIterator
Accesses a row through its range index.

Specified by:
getRowAtRangeIndex in interface RowIterator
Parameters:
index - an index in the range: 0 to getRangeSize() - 1.
Returns:
a Row object, or null if the index is out of range.

getRowCount

public int getRowCount()
Description copied from interface: RowIterator
Counts the total number of rows in the Row Set.

Note that this method retrieves all rows from the database then returns the number of rows in the Row Set collection.

Specified by:
getRowCount in interface RowIterator
Returns:
the number of rows.

getRowCountInRange

public int getRowCountInRange()
Description copied from interface: RowIterator
Gets the size of the Row Set Iterator range.

Specified by:
getRowCountInRange in interface RowIterator
Returns:
the number of rows in the range.

hasNext

public boolean hasNext()
Description copied from interface: RowIterator
Tests for the existence of a row after the current row.

Specified by:
hasNext in interface RowIterator
Returns:
true if there is a next row. Specifically, if the Row Set is empty or if the currency is on the last row or the slot after the last row (current slot status == RowIterator.SLOT_BEYOND_LAST), it returns false. Otherwise, true.

hasPrevious

public boolean hasPrevious()
Description copied from interface: RowIterator
Tests for the existence of a row before the current row.

If the Row Set is forward-only, it returns false.

Specified by:
hasPrevious in interface RowIterator
Returns:
true if there is a previous row. Specifically, if the Row Set is empty or forward-only or if the currency is on the first row or the slot before the first row (current slot status == RowIterator.SLOT_BEFORE_FIRST), it returns false. Otherwise, true.

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.

Specified by:
insertRow in interface RowIterator
Parameters:
row - the view row to insert.

insertRowAtRangeIndex

public void insertRowAtRangeIndex(int index,
                                  Row row)
Description copied from interface: RowIterator
Inserts a row to the Row Set at the given range index. The index is relative to the range, i.e., index of 0 would mean to insert before the first row of the range. Allowed values for index is 0 to range size. If index equals range size, the row is inserted right after the last row in the range. This method call does not alter the current position of the iterator, nor does it affect the range position.

Specified by:
insertRowAtRangeIndex in interface RowIterator
Parameters:
index - the point where row is to be added.
row - the Row object to be added.

isRangeAtBottom

public boolean isRangeAtBottom()
Description copied from interface: RowIterator
Tests if the Row Set Iterator range is at the end of the result set.

Specified by:
isRangeAtBottom in interface RowIterator
Returns:
true if the last row of the range is the last row of the result set.

isRangeAtTop

public boolean isRangeAtTop()
Description copied from interface: RowIterator
Tests if the Row Set Iterator range is at the beginning of the result set.

Specified by:
isRangeAtTop in interface RowIterator
Returns:
true if the first row of the range is the first row of the result set.

isRowValidation

public boolean isRowValidation()
Description copied from interface: RowIterator
Gets the validation flag on this iterator. By default a RowIterator validates the current row when navigating to another row. This method returns TRUE if this row-validation is turned off.

Specified by:
isRowValidation in interface RowIterator

last

public Row last()
Description copied from interface: RowIterator
Gets the last row in the iterator. If last() is called on an iterator whose Row Set has not yet been RowSet.executeQuery()'ed, the Row Set's query is executed. Thus, the user does not need to call executeQuery() himself before calling last(). We refer to this as implicit query execution or implicit Row Set execution.

Before moving to the last row, last() validates the current row (if the iterator has a current row) through a call to Row.validate().

This method retrieves all rows from the Row Set and scrolls (if necessary) to the last row. If some of these rows have not yet been fetched from database, it fetches them. The View Object's fetch mode affects how rows are fetched from database into the collection. See getFetchMode() for details.

If successful, this method designates the last row as the current row.

If last() is called on an empty Row Set, the currency moves to the slot beyond the last row. The current slot status is set to RowIterator.SLOT_BEYOND_LAST.

The caller of this method should be aware that it may take a long time to complete as all rows from the Row Set are fetched.

The number of rows in the range at the completion of this method is affected by the "iteration mode". See Iteration Modes above for details.

This method generates events to notify the changes to the iterator. If scrolling occurs because of conditions described above, a ScrollEvent will be sent to RowSetListener.rangeScrolled(oracle.jbo.ScrollEvent). To pick up such an event, the listener object must implement the RowSetListener interface. Further, this listener must be registered through a call to NavigatableRowIterator.addListener(Object) (the listener object passed in as the parameter to addListener).

If the currency is changed, it generates a NavigationEvent and sends it to RowSetListener.navigated(oracle.jbo.NavigationEvent).

Specified by:
last in interface RowIterator
Returns:
the last Row object, or null if there is no last row.

next

public Row next()
Description copied from interface: RowIterator
Gets the next row in the iterator. If next() is called on an iterator whose Row Set has not yet been RowSet.executeQuery()'ed, the Row Set's query is executed. Thus, the user does not need to call executeQuery() himself before calling next(). We refer to this as implicit query execution or implicit Row Set execution.

Before moving to the next row, next() validates the current row (if the iterator has a current row) through a call to Row.validate().

If the currency is on the last row of the range and next() is called, the range is scolled down by one row to bring the next row into the visible range. In particular, if the range size is 1, next() scrolls the range down by 1 row.

When this method is called, the current row of the iterator may be outside the range. (Note that the current row does not have to be within the range.) If so, next() will scroll the range, so that the row that will be the current row at the conclusion of this method will be positioned in the middle of the range.

If the iterator is just opened or reset (see RowIterator.reset()), next() will return the first row if one exists. In this situation, next() is functionally equivalent to RowIterator.first().

If the iterator is at the last row of the Row Set, next() push the currency into the imaginary slot after the last row. This will set the current slot status to SLOT_BEYOND_LAST.

When the next row is required, a check is made to see if the row has already been brought into the collection. If not, the row is fetched from database. Note that the View Object's fetch mode affects how rows are fetched from database into the collection. See getFetchMode() for details.

If successful, this method designates the next row as the current row (the currency finally moves).

This method generates events to notify the changes to the iterator. If scrolling occurs because of conditions described above, a ScrollEvent will be sent to RowSetListener.rangeScrolled(oracle.jbo.ScrollEvent). To pick up such an event, the listener object must implement the RowSetListener interface. Further, this listener must be registered through a call to NavigatableRowIterator.addListener(Object) (the listener object passed in as the parameter to addListener).

If the currency is changed, it generates a NavigationEvent and sends it to RowSetListener.navigated(oracle.jbo.NavigationEvent).

Specified by:
next in interface RowIterator
Returns:
the next Row object, or null if there is no next row.

previous

public Row previous()
Description copied from interface: RowIterator
Gets the previous row in the iterator. If previous() is called on an iterator whose Row Set has not yet been RowSet.executeQuery()'ed, the Row Set's query is executed. Thus, the user does not need to call executeQuery() himself before calling previous(). We refer to this as implicit query execution or implicit Row Set execution.

Before moving to the previous row, previous() validates the current row (if the iterator has a current row) through a call to Row.validate().

If the currency is on the first row of the range and previous() is called, the range is scolled up by one row to bring the previous row into the visible range. In particular, if the range size is 1, previous() scrolls the range up by 1 row.

When this method is called, the current row of the iterator may be outside the range. (Note that the current row does not have to be within the range.) If so, previous() will scroll the range, so that the row that will be the current row at the conclusion of this method will be positioned in the middle of the range.

If the iterator is just opened or reset (see RowIterator.reset()), previous() will null as the currency is already on the imaginary slot before the first row.

If the iterator is at the first row of the Row Set, previous() push the currency into the imaginary slot before the first row. This will set the current slot status to SLOT_BEFORE_FIRST.

If successful, this method designates the previous row as the current row (the currency finally moves).

This method generates events to notify the changes to the iterator. If scrolling occurs because of conditions described above, a ScrollEvent will be sent to RowSetListener.rangeScrolled(oracle.jbo.ScrollEvent). To pick up such an event, the listener object must implement the RowSetListener interface. Further, this listener must be registered through a call to NavigatableRowIterator.addListener(Object) (the listener object passed in as the parameter to addListener).

If the currency is changed, it generates a NavigationEvent and sends it to RowSetListener.navigated(oracle.jbo.NavigationEvent).

Specified by:
previous in interface RowIterator
Returns:
the previous Row object, or null if there is no previous row.

removeCurrentRow

public void removeCurrentRow()
Description copied from interface: RowIterator
Removes the current Row object from the Row Set.

Specified by:
removeCurrentRow in interface RowIterator

removeCurrentRowAndRetain

public Row removeCurrentRowAndRetain()
Description copied from interface: RowIterator
Removes the current Row object from the collection and retain it for insertion into another location.

It does not cause the row to be deleted from the database table. It just removes the row from the row collection.

This method differs from RowIterator.removeCurrentRowFromCollection() in that after the current row is removed from the collection, it can be inserted back into the collection at another location.

To do so, call RowIterator.removeCurrentRowAndRetain(), and get the returning row. Then, change currency to the desired location, and call RowIterator.insertRow(oracle.jbo.Row) with that row.

Specified by:
removeCurrentRowAndRetain in interface RowIterator
Returns:
the current row which was just removed from collection.

removeCurrentRowFromCollection

public void removeCurrentRowFromCollection()
Description copied from interface: RowIterator
Removes the current Row object from the collection.

It does not cause the row to be deleted from the database table. It just removes the row from the row collection. However, once the row is removed, it cannot be used any more. If you want to remove the current row from collection and insert it elsewhere, call RowIterator.removeCurrentRowAndRetain(), change currency to the desired location, and then call RowIterator.insertRow(oracle.jbo.Row) with that row.

Specified by:
removeCurrentRowFromCollection in interface RowIterator

reset

public void reset()
Description copied from interface: RowIterator
Moves the currency to the slot before the first row.

After this method, the current slot status will be RowIterator.SLOT_BEFORE_FIRST. A subsequent invocation of RowIterator.next() will cause the first row to become the current row.

It sends a ScrollEvent to RowSetListener.rangeScrolled(oracle.jbo.ScrollEvent) if the currency was not on the first row or on the slot before the first row. To pick up such an event, the listener object must implement the RowSetListener interface. Further, this listener must be registered through a call to NavigatableRowIterator.addListener(Object) (the listener object passed in as the parameter to addListener).

Specified by:
reset in interface RowIterator

scrollRange

public int scrollRange(int amount)
Description copied from interface: RowIterator
Moves the Row Set Iterator range up or down a given number of rows.

Specified by:
scrollRange in interface RowIterator
Parameters:
amount - the number of rows to scroll. A negative value scrolls upward.
Returns:
the number of rows actually scrolled.

scrollRangeTo

public int scrollRangeTo(Row row,
                         int index)
Description copied from interface: RowIterator
Scrolls the range to place a given row at a given range index.

Specified by:
scrollRangeTo in interface RowIterator
Parameters:
row - the row.
index - the range index at which the row is to be found.
Returns:
the actual number of rows scrolled. A negative number indicates that the scroll was scrolled upward.

setCurrentRow

public boolean setCurrentRow(Row row)
Description copied from interface: RowIterator
Designates a given row as the current row.

Specified by:
setCurrentRow in interface RowIterator
Parameters:
row - the new current row.
Returns:
true if the operation succeeded.

setCurrentRowAtRangeIndex

public boolean setCurrentRowAtRangeIndex(int index)
Description copied from interface: RowIterator
Designates a given index as the current row.

Specified by:
setCurrentRowAtRangeIndex in interface RowIterator
Parameters:
index - the index of the new current row.
Returns:
true if the operation succeeded.

setIterMode

public void setIterMode(int mode)
Description copied from interface: RowIterator
Sets the iteration mode for this Row Iterator. See Iteration Modes above for details on iteration mode which controls how the range behaves when it reaches the end of the Row Set.

Specified by:
setIterMode in interface RowIterator
Parameters:
mode - should be ITER_MODE_LAST_PAGE_PARTIAL if the iteration mode is to be "partial-last-page", ITER_MODE_LAST_PAGE_FULL if it is to be "full-last-page".

setRangeSize

public int setRangeSize(int size)
Description copied from interface: RowIterator
Modifies the size of the Row Set Iterator range.

This method takes effect when the next set of data is fetched. For an example usage of setRangeSize, see setRangeStart.

Specified by:
setRangeSize in interface RowIterator
Parameters:
size - the new number of rows in the iterator range. Size of 0 is treated same as 1. Size < -1 is treated same as -1.
Returns:
the new size of the range.
See Also:
RowIterator.setRangeStart(int)

setRangeStart

public int setRangeStart(int start)
Description copied from interface: RowIterator
Moves the Row Set Iterator range.

Note that the index is 0-based. When you call setRangeStart(1), the range start will be positioned at the second table row.

Another behavior of setRangeStart (and also setRangeSize) is that it tries to position the range, so as to fill up the range as much as possible. For example, assume you have View Object vo focused on a table with four rows (A, B, C, D), and you execute the following code:

 vo.setRangeStart(4);
 vo.setRangeSize(3);
 Row[] rows = vo.getAllRowsInRange();
 

In this case, rows contains the last 3 rows (B, C, D). When you call setRangeStart(4), it will try to position you at row 4. Since the index is 0-based, it finds that there is no row. Since the default range size is 1, it will position you to the last row (row index 3).

Then, when you call getRangeSize(3), it tries to fill up the range from the bottom. This is why you get (B, C, D).

Specified by:
setRangeStart in interface RowIterator
Parameters:
start - the absolute index of the new first row in the Row Set Iterator range.

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.

Specified by:
setRowValidation in interface RowIterator
Parameters:
flag - Whether to turn row validation off or not.

getBindingStyle

public int getBindingStyle()

createViewLinkAccessorVO

protected ViewObjectImpl createViewLinkAccessorVO(AssociationDefImpl assocDef,
                                                  java.lang.String voName,
                                                  ViewDefImpl vDef,
                                                  ViewLinkDefImpl vlDef)

isInternal

public final boolean isInternal()

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.

getDBTransaction

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

This method should not be overridden.

Returns:
the database transaction.

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.

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

setDefaultAssocConsistent

protected void setDefaultAssocConsistent(boolean isEquiJoin)

isDefaultAssocConsistent

protected boolean isDefaultAssocConsistent()

getEntityDefCount

protected int getEntityDefCount()
Internal: Applications should not use this method.

Returns the number of entity bases.

Returns:
the number of entity bases.

containsTableAlias

public static boolean containsTableAlias(java.lang.String line,
                                         java.lang.String word)

buildEffectiveDateFromClauseFragment

protected int buildEffectiveDateFromClauseFragment(java.lang.StringBuffer fromClause,
                                                   int noUserParams)
This method is invoked in a Join VO scenario and ANSI Join Syntax is being followed. The Effective Date fragment must be inserted into the FROM clause instead of the WHERE clause due to ANSI standards.

Parameters:
fromClause - The original from clause
noUserParams - The parameter counter that is used up so far for generating the oracle style bind parameter
Returns:
updates the fromClause in the buffer in-place and returned the new bind index that should be used for future bind parameters.

buildFromClause

protected java.lang.String buildFromClause()

getFromClause

public java.lang.String getFromClause()

setFromClause

public void setFromClause(java.lang.String fromClause)

shouldPutJoinConstraintInWhereClause

public boolean shouldPutJoinConstraintInWhereClause()
Specified by:
shouldPutJoinConstraintInWhereClause in interface ViewCriteriaManagerOwner

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)

getViewCriteriaManager

public ViewCriteriaManager getViewCriteriaManager()
Specified by:
getViewCriteriaManager in interface ViewObject

criteriaChanged

public void criteriaChanged(ViewCriteria vc)
Description copied from interface: ViewCriteriaManager
The criteria manager can track changes to applied view criteria. If the structure of an applied view criteria changes or a view criteria item in an applied view criteria has a new value then this method is invoked by the framework so that the manager can initiate a fresh clause generation when required.

Specified by:
criteriaChanged in interface ViewCriteriaManagerOwner
Specified by:
criteriaChanged in interface ViewCriteriaManager
Parameters:
vc - the view criteria that has changed

setQueryAsChanged

protected void setQueryAsChanged(boolean isChanged)

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.

isRuntimeSQLGeneration

public boolean isRuntimeSQLGeneration()
Specified by:
isRuntimeSQLGeneration in interface ViewCriteriaManagerOwner

getCriteriaAdapter

public CriteriaAdapter getCriteriaAdapter()
Return a custom CriteriaAdapter implementation to generate where clause for ViewCriteria. The default implementation here returns null, and leave it to the ViewCriteriaManager implementation class to determine which CriteriaAdapter class to use. Subclasses can override this method to provide a custom CriteriaAdapter implementation.

Returns:
Custom CriteriaAdapter implementation if desired, or null.

getColumnNameForQuery

public java.lang.String getColumnNameForQuery(int index)
Specified by:
getColumnNameForQuery in interface StructureDef

getMasterKeyValues

protected ArrayList getMasterKeyValues(AssociationDefImpl assocDef)
Gets a list of distinct key values from the rows in this master VO, by enumerating through its query collections.

Parameters:
assocDef - the association definition between this master VO and the scan (detail) VO
Returns:
a list of master row keys.

getAllCachedQueryCollections

protected java.util.Enumeration getAllCachedQueryCollections()

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.

createViewLinkScanBaseRS

protected ViewRowSetImpl createViewLinkScanBaseRS(AssociationDefImpl assocDef,
                                                  ViewObjectImpl accessorVO,
                                                  Row masterRow)

findViewLinkAccessorVO

protected ViewObjectImpl findViewLinkAccessorVO(AssociationDefImpl assocDef,
                                                java.lang.String voName,
                                                ViewDefImpl vDef,
                                                ViewLinkDefImpl vlDef)

getDynamicAttributeCount

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

Returns the number of dynamic attributes.

Returns:
the number of dynamic attributes.

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.

If this attribute is to be passivated for failover/saveForLater/undo, the attribute-value should be able to recreate itself from its string representations. Types like Hashtables, Vectors etc. will not be handled automatically. For these one may create a domain and implement oracle.jbo.domain.XMLDomainWriter interface and then the domain can render itself as it feels fit. For a usage see source for oracle.jbo.domain.Array

This method should not be overridden.

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.

isSelectAllAttributes

public boolean isSelectAllAttributes()

preFetchRowsByKeys

public void preFetchRowsByKeys(AttributeDef[] keyAttrs,
                               Key[] keys)

preFetchRowsByKeys

public void preFetchRowsByKeys(AttributeDef[] keyAttrs,
                               Key[] keys,
                               Row parentRow)

addDynamicAttributeWithType

public AttributeDef addDynamicAttributeWithType(java.lang.String attrName,
                                                java.lang.String javaTypeName,
                                                java.lang.String transientExpression)

hasDefaultRowSet

public boolean hasDefaultRowSet()

getDefaultRowSetInternal

protected ViewRowSetImpl getDefaultRowSetInternal()

buildQuery

protected java.lang.String buildQuery(int noUserParams,
                                      boolean forRowCount)

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. Returns true if marked changed; false otherwise.

processNewSelectSet

protected void processNewSelectSet()
Activate the attributes selected in calls to selectAttributeDefs, unselectAttributeDefs. In other words, activate the attributes in the private member variable of ViewObjectImpl that holds the fields that should be selected.

Derived classes may override this method to select additional attributes. But remember to call the superclass function.

See Also:
resetSelectedAttributeDefs(), selectAttributeDefs(String[]), #unselectAttributeDefs(String[])

getReqdVC

public ViewCriteria getReqdVC()

getApplyAllViewCriterias

public ViewCriteria[] getApplyAllViewCriterias(int criteriaMode,
                                               boolean getAllReqdVC)

getSelectClause

public java.lang.String getSelectClause()

setSelectClause

public void setSelectClause(java.lang.String selClause)

buildSelectClause

protected java.lang.String buildSelectClause()

buildQuery

protected java.lang.String buildQuery(int noUserParams,
                                      boolean forRowCount,
                                      java.lang.String selClause,
                                      java.lang.String whereClause)

getViewCriteriaClause

public java.lang.String getViewCriteriaClause(boolean forQuery)
Generates the WHERE clause expression from the applied view criterias. This method is responsible for converting the applied view criterias into a WHERE clause expression.

Specified by:
getViewCriteriaClause in interface ViewCriteriaManager
Parameters:
forQuery - indicates whether the WHERE clause returned will be used in a database query or in-memory filtering. If true, the clause is for database query.
Returns:
the WHERE clause to be used for either database query or in-memory filtering.

getApplyViewCriteriaNames

public java.lang.String[] getApplyViewCriteriaNames()
Specified by:
getApplyViewCriteriaNames in interface ViewCriteriaManager
Returns:
An array of view criteria names that are currently in the applied state.

buildEffectiveDateWhereClauseFragment

protected int buildEffectiveDateWhereClauseFragment(java.lang.StringBuffer effDtClause,
                                                    int noUserParams)
Generates the Effective date filter clause fragment. For example when the binding style is set to Oracle Named Parameter binding style the clause would look like :SysEffectiveDate between effectiveStartDate and effectiveEndDate

Parameters:
effDtClause - The buffer that would contain the generated clause
noUserParams - The parameter counter that is used up so far for generating the oracle style bind parameter
Returns:
the new parameter counter

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.
noUserParams - the number of bind variables in the WHERE clause. Typically, this number is getWhereClauseParams().length.
Returns:
true if a WHERE clause was appended.

setRowMatchFromViewCriteria

protected void setRowMatchFromViewCriteria(RowMatch rowMatch)

getApplyViewCriterias

public ViewCriteria[] getApplyViewCriterias(int criteriaMode)
Description copied from interface: ViewCriteriaManager
Return a list of applied view criteria that have the mode passed in the argument turned on. Refer to ViewCriteria.CRITERIA_MODE_CACHE and ViewCriteria.CRITERIA_MODE_QUERY for more information. View criterias that have both modes turned on are also qualified.

Specified by:
getApplyViewCriterias in interface ViewCriteriaManager
Parameters:
criteriaMode - the mode to match the criteria.
Returns:
An array of matching applied view criterias.

getAllViewCriteriaNames

public java.lang.String[] getAllViewCriteriaNames()
Description copied from interface: ViewCriteriaManager
Returns a list of both applied and unapplied view criterias managed by this object.

Specified by:
getAllViewCriteriaNames in interface ViewCriteriaManager
Returns:
an array of view criteria names

getAvailableViewCriteriaNames

public java.lang.String[] getAvailableViewCriteriaNames()
Description copied from interface: ViewCriteriaManager
Returns a list of view criteria names that are unapplied and managed by this object

Specified by:
getAvailableViewCriteriaNames in interface ViewCriteriaManager
Returns:
the names of the criteria that can still be applied

getAllViewCriterias

public ViewCriteria[] getAllViewCriterias()
Description copied from interface: ViewCriteriaManager
Returns a list of both applied and unapplied view criterias managed by this object.

Specified by:
getAllViewCriterias in interface ViewCriteriaManager
Returns:
an array of view criteria

buildViewCriteriaClauses

public CriteriaClauses buildViewCriteriaClauses(ViewCriteria vc)
Description copied from interface: ViewCriteriaManager
This method is used by the framework to generate a query clause for a particular view criteria. Used by ViewCriteriaManager.getViewCriteriaClause(boolean)

Specified by:
buildViewCriteriaClauses in interface ViewCriteriaManager
Parameters:
vc - the view criteria whose criteria needs to be generated
Returns:
a reference to an object that store clauses for both database and in-memory filtering

getAssociationClause

protected java.lang.String getAssociationClause(int noUserParams)
Internal: Applications should not use this method.

Returns the where-clause expression generated from View Links.

Returns:
the where-clause expression generated from View Links.

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.

processSortCriteria

protected void processSortCriteria()

buildRangePagingQuery

protected java.lang.String buildRangePagingQuery(java.lang.String qry,
                                                 int noUserParams)
Applications may use this method to wrap this ViewObject query with rownum query or other mechanism to fetch rows in the current range. Note that bindRangePagingParameters() method will be called to fill in the range values when after other parameters for this query are bound.


setApplyJoinedViewCriteriaNames

public void setApplyJoinedViewCriteriaNames(java.lang.String[] names)

getApplyJoinedViewCriteriaNames

public java.lang.String[] getApplyJoinedViewCriteriaNames()

isViewLinkAccessorRetained

public boolean isViewLinkAccessorRetained()

setPassivatableTransientAttribute

protected final void setPassivatableTransientAttribute(ViewAttributeDefImpl voAttr,
                                                       boolean flag)
Marks the given attribute def for this VO as passivatable. If the attribute definition does not belong to this ViewObject, then this method is a no-op.


isForScan

public boolean isForScan()

buildRowFilter

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

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. A value of 0 indicates all rows will be fetched.

Returns:
the maximum row fetch size.

getQueryMode

public int getQueryMode()

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.

getCachedQueryCollection

protected QueryCollection getCachedQueryCollection(RowFilter rowFilter)
Internal: Applications should not use this method.

Returns the QueryCollection associated with the key

Parameters:
rowFilter - the row filter for the query collection.
Returns:
the query collection if one is found. null otherwise.

getDefaultAccessMode

public byte getDefaultAccessMode()

getRowSets

public RowSet[] getRowSets()
Get all Row Sets that belong to this view object.

Specified by:
getRowSets in interface ViewObject
Returns:
the array of Row Sets.

getDefaultRangePagingCacheFactor

public int getDefaultRangePagingCacheFactor()

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.

addRowSet

protected void addRowSet(ViewRowSetImpl rs)

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

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

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

getTransPostHandle

public int getTransPostHandle()
Description copied from interface: TransactionPostListener
Advanced: Applications should not use this method.

Gets a handle to a transaction post event.

Specified by:
getTransPostHandle in interface TransactionPostListener
Returns:
a handle to a transaction post event.

isPostedToDB

public boolean isPostedToDB()
Specified by:
isPostedToDB in interface TransactionPostListener

isTransientTransactionPostListener

public boolean isTransientTransactionPostListener()
Description copied from interface: TransactionPostListener
Tests whether this transaction listener is transient or permanent.

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:
true if the listener is transient.

postChanges

public void postChanges(TransactionEvent e)
Description copied from interface: TransactionPostListener
Notifies a listener to post any cached changes to the database.

This method is useful for Entity Objects that perform data manipulation operations such as UPDATE, INSERT or DELETE.

Specified by:
postChanges in interface TransactionPostListener
Parameters:
e - a transaction event.

setPostedToDB

public void setPostedToDB(boolean b)
Specified by:
setPostedToDB in interface TransactionPostListener

setTransPostHandle

public void setTransPostHandle(int hdl)
Description copied from interface: TransactionPostListener
Advanced: Applications should not use this method.

Specifies a handel to a transaction post event.

Specified by:
setTransPostHandle in interface TransactionPostListener
Parameters:
hdl - a handle to a transaction post event.

closeFreedStatements

public void closeFreedStatements()

createViewLinkAccessorRS

protected ViewRowSetImpl createViewLinkAccessorRS(AssociationDefImpl assocDef,
                                                  ViewObjectImpl accessorVO,
                                                  Row masterRow,
                                                  java.lang.Object[] values)

removeRowSet

protected void removeRowSet(ViewRowSetImpl rs)

clearViewCriterias

public void clearViewCriterias()
Description copied from interface: ViewCriteriaManager
Clear all view criteria, both applied and unapplied help by this manager

Specified by:
clearViewCriterias in interface ViewCriteriaManager

initFromDef

protected void initFromDef()

setQueryMode

public void setQueryMode(int queryMode)
Description copied from interface: ViewObject
Sets query mode for the view object. Query mode controls how qualifying rows are formulated for each row set in the view object.

The queryMode parameter may be an OR'ed flag of QUERY_MODE_SCAN_... constants. See these constants for further details.

Calling this method does not cause automatically cause the new query mode to go into effect. Call RowSet.executeQuery() to apply the new query mode.

The default query mode is QUERY_MODE_SCAN_DATABASE_TABLES.

Specified by:
setQueryMode in interface ViewObject
Parameters:
queryMode - the new query mode.

formatForOutput

public java.lang.String formatForOutput(OutputFormatter formatter)
Specified by:
formatForOutput in interface Formattable
Overrides:
formatForOutput in class NamedObjectImpl

getDynamicAttributeOffset

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

Returns the attribute index of the first dynamic attribute.

Returns:
the attribute index of the first dynamic attribute. -1 if this View Object has no dynamic attribute.

getViewLinkDestinationAttributes

protected ArrayList getViewLinkDestinationAttributes()

rowQualifies

protected boolean rowQualifies(ViewRowImpl vr)

getRowMatch

public RowMatch getRowMatch()
Gets the in-memory filter (RowMatch) for the view object. While the where-clause is used when a database query is issued, the row match is used for qualifying rows in memory.

Returns:
the current row match.

getRowMatchFromViewCriteria

public RowMatch getRowMatchFromViewCriteria()

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

findViewDefFromDiscrVals

public ViewDefImpl findViewDefFromDiscrVals(ResultSet resultSet,
                                            AttributeList initValues)

findViewDefFromDiscrVals

public ViewDefImpl findViewDefFromDiscrVals(ResultSet resultSet,
                                            AttributeList initValues,
                                            EntityImpl[] entities)

getDiscrColLoadIndices

protected int[] getDiscrColLoadIndices()

isTransientTransactionListener

public boolean isTransientTransactionListener()
Description copied from interface: TransactionListener
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.

getEntityDef

protected EntityDefImpl getEntityDef(int index)
INTERNAL: Applications should not use this method.

Returns the definition of an entity base at the specified index.

Parameters:
index - entity base index.
Returns:
definition of the entity base.

isManageRowsByKey

public boolean isManageRowsByKey()
Returns a flag indicating whether this View Object "manages rows by key" or not. This flag is meaningful only for a View Object which is not based on any Entity Object.

If a View Object has an Entity base, then View row cache manages View rows by the Entity rows on which each View row is based. For example, if you call findByKey on an Entity-based View Object, BC4J first locates the Entity row with the given primary key, then goes to this View row cache to find View rows that are based on this Entity row.

A View Object which is not based on any Entity Object does not have an Entity Object by which its rows can be organized. For such a View Object, you have an option to organize its rows by its keys. (For an EO-less View Object, its keys can be specified by #setKeyAttributeDefs). This flag indicates whether the rows should be organized by its keys or not. The default is false.

When this flag is true, a small additional overhead will be added in View row management because of the bookkeeping associated with row management by key. However, findByKey will run faster because rows with match key can be found faster. Further, when this flag is true, findByKey can avoid returning duplicate rows in that the system can check to see if the row with the given key is already in the View row cache or not. If this flag is false, findByKey may cause duplicate rows to show up in the View row cache.

Note that for an EO based View Object, this flag is meaningless as rows are already organized and managed by its constituent Entity rows.

Returns:
a flag indicating whether rows are managed by its keys or not.

findAltKeyDef

public KeyDef findAltKeyDef(java.lang.String keyName)

getScanRowFilterAttributeDefs

public AttributeDef[] getScanRowFilterAttributeDefs()

getQualifyingRowFilters

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

getRowFilters

protected java.util.Enumeration getRowFilters()

isCollectionPresent

protected boolean isCollectionPresent(RowFilter rowFilter)

buildQualifyingRowFilters

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

buildNewCollection

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

hasNextForCollection

protected boolean hasNextForCollection(java.lang.Object qc)

markQueryCollectionDirty

protected void markQueryCollectionDirty(QueryCollection qc,
                                        boolean isDirty)
Given a query collection qc and a flag isDirty, explicitly sets the query collection's dirty status.

This method may be used to set or unset the dirty status of a query collection. Its recommended use is during activation, in conjunction with custom passivation of the QC dirty flag.

The method setDirty should not be used, as it updates only a subset of the necessary internal data structures.

Parameters:
qc - the query collection in question. If qc is null, the method does nothing.
isDirty - if true, the QC is marked dirty. If false, the QC is marked clean.
See Also:
QueryCollection.setDirty(boolean)

getImplObject

public static ViewRowSetIteratorImpl getImplObject(java.lang.Object rsi)
Internal: Applications should not use this method.

Given a RowSetIterator interface, this routine returns the inner ViewRowSetIteratorImpl object.

Parameters:
rsi - the outer object that implements the RowSetIterator interface.
Returns:
the inner ViewRowSetIteratorImpl.

notifyRowDeleted

protected void notifyRowDeleted(ViewRowSetImpl vrs,
                                Row viewRow,
                                int rowIndex)
This method is invoked by the framework when a row is deleted from the given ViewRowSet for this ViewObject. This method can be overridden to perform calculations in a subclass or to cache a list of deleted rows for some other reason.

Parameters:
vrs - ViewRowSetImpl instance to be notified about the deleted row.
viewRow - View Row instance that have been deleted.
rowIndex - Index in the RowSet where the row is deleted.

createInstanceFromResultSet

public ViewRowImpl createInstanceFromResultSet(QueryCollection qc,
                                               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.

createRowFromResultSet

protected ViewRowImpl createRowFromResultSet(java.lang.Object qc,
                                             ResultSet resultSet)

getPreparedStatement

protected PreparedStatement getPreparedStatement(int noUserParams,
                                                 boolean[] barr)

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.

For each View Object, this method is customizable. Deciding what value to use could be made at runtime based on how many rows are expected for a particular View Object.

Returns:
the row pre-fetch size.

getQueryTimeOut

public int getQueryTimeOut()

setResultSetForCollection

protected void setResultSetForCollection(java.lang.Object qc,
                                         ResultSet rs)

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)

releaseUserDataForCollection

protected void releaseUserDataForCollection(java.lang.Object qc,
                                            java.lang.Object data)

getDefaultRangeSize

public int getDefaultRangeSize()

getSortCriteria

public SortCriteria[] getSortCriteria()

sortRows

public void sortRows(Row[] rows)

getRowComparator

public Comparator getRowComparator()

notifyRowInserted

protected void notifyRowInserted(ViewRowSetImpl vrs,
                                 Row viewRow,
                                 int rowIndex)
This method is invoked by the framework when inserts are made to the given ViewRowSet for this ViewObject. This method can be overridden to perform calculations in a subclass or to cache a list of new rows for some other reason.

Parameters:
vrs - ViewRowSetImpl instance to be notified about the new row.
viewRow - View Row instance that have been inserted.
rowIndex - Index in the RowSet where the new row is inserted

findViewAccessorDef

public ViewAccessorDef findViewAccessorDef(java.lang.String name)

lookupViewAccessorDef

public ViewAccessorDef lookupViewAccessorDef(java.lang.String vaName)

createViewAccessorRS

protected ViewRowSetImpl createViewAccessorRS(ViewAccessorDef accessorDef,
                                              Row masterRow,
                                              java.lang.Object[] valuse,
                                              boolean addRSToMasterRow)

setApplyViewCriteriaNames

public void setApplyViewCriteriaNames(java.lang.String[] names)
Description copied from interface: ViewCriteriaManager
Apply a set of view criteria names passed as the argument. The applied criteria name list will first be cleared out and then the view criterias passed as argument are applied.

Specified by:
setApplyViewCriteriaNames in interface ViewCriteriaManager
Parameters:
names - the criterias to be applied.

setApplyViewCriteriaName

public void setApplyViewCriteriaName(java.lang.String name)
Description copied from interface: ViewCriteriaManager
Apply the view criteria name passed as the argument. The applied criteria name list will first be cleared out and then the view criteria passed as argument is applied. If null is passed as the argument there will be no applied view criteria.

Specified by:
setApplyViewCriteriaName in interface ViewCriteriaManager
Parameters:
name - the criteria to be applied.

setApplyViewCriteriaName

public void setApplyViewCriteriaName(java.lang.String name,
                                     boolean bAppend)
Description copied from interface: ViewCriteriaManager
Apply the view crtieria name passed as the argument. If bAppend is true the passed view criteria will be applied in addition to the existing ones. If bAppend is false this method is identical to ViewCriteriaManager.setApplyViewCriteriaName(String)

Specified by:
setApplyViewCriteriaName in interface ViewCriteriaManager
Parameters:
name - the criteria to be applied
bAppend - pass true if the view criteria needs to be appended to the applied list otherwise the list is cleared out.

setReqdVC

public void setReqdVC(ViewCriteria reqdVc)

findOrCreateLocalViewObject

protected ViewObject findOrCreateLocalViewObject(java.lang.String usageName)
Find or create the local view instance from the local view usage name.

Parameters:
usageName - The local view usage name.
Returns:
The local view object.

findOrCreateLocalViewObject

protected ViewObject findOrCreateLocalViewObject(java.lang.String usageName,
                                                 java.lang.String voName)
Find or create the local view instance from the local view usage name.

Parameters:
usageName - The local view usage name.
voName - Full name the VO to find or create
Returns:
The local view object.

getApplicationModuleForLocalViewObject

protected ApplicationModule getApplicationModuleForLocalViewObject()

notifyRowUpdated

protected void notifyRowUpdated(QueryCollection qc,
                                Row row,
                                int[] attrIndices,
                                boolean markQCDirty)

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.

isAttributeKey

public boolean isAttributeKey(AttributeDef attrDef)

getSignature

public long getSignature()
Internal: Applications should not use this method. Only for use in Object marshalling for remote tiers.


activateIteratorState

public void activateIteratorState(org.kxml2.io.KXmlParser node,
                                  boolean clearIteratorState)
Internal: Applications should not use this method.

Used by the framework to force an iterator activation. Applications should extend #activateIteratorState(Element, boolean).


activateCurrentRow

protected ViewRowImpl activateCurrentRow(ViewRowSetIteratorImpl vrsi,
                                         ViewRowSetImpl vrs,
                                         Key key)
Override this to provide custom current row lookup. Apps may need to implement this method in cases where expert mode query or full-query is used for a VO and the query has where-clause with bindparameters built into it and this VO is not executed but has inserted rows. In this case, since the VO is not passivated, there are no bind params passivated and on activation findByKey will fail to find the current row as the VO does not have bind parameters.

Override this method and use another VO to fetch an equivalent row and add it to the given ViewRowSet. The caller activation routine will set the row as current.


getAltKeyAttrDefs

public AttributeDef[] getAltKeyAttrDefs(java.lang.String keyName)

retrieveByKey

protected Row[] retrieveByKey(ViewRowSetImpl rs,
                              Key key,
                              int maxNumOfRows)

retrieveByKey

protected Row[] retrieveByKey(ViewRowSetImpl rs,
                              Key key,
                              int maxNumOfRows,
                              boolean skipWhere)

retrieveByKey

protected Row[] retrieveByKey(ViewRowSetImpl rs,
                              java.lang.String keyName,
                              Key key,
                              int maxNumOfRows,
                              boolean skipWhere)

createFinderVO

protected ViewObjectImpl createFinderVO(java.lang.String suffix)

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.

setFullSqlMode

public void setFullSqlMode(int fullSqlMode)

setRowMatch

public void setRowMatch(RowMatch rowMatch)
Sets an in-memory filter (RowMatch) for the view object. While the where-clause is used when a database query is issued, the row match is used for qualifying rows in memory. Calling this method does not cause filtering of rows by the row match. To filter, RowSet.executeQuery() must be called.

Specified by:
setRowMatch in interface ViewObject
Parameters:
rowMatch - the new row match.

resetSelectedAttributeDefs

public void resetSelectedAttributeDefs()

resetSelectedAttributeDefs

public void resetSelectedAttributeDefs(boolean forceSelectAllAttributes)
Does not select or unselect any attributes, but clears the private member variable of ViewObjectImpl that holds the fields that should be selected.

See Also:
selectAttributeDefs(String[])

selectAttributeDefs

public void selectAttributeDefs(java.lang.String[] attrNameArray)
Does not select or unselect any attributes, but adds the attributes in attrNameArray to a private member variable of ViewObjectImpl. A call to isExecuted or execute will transfer the attributes in the private member variable to the actual select list. The query will be rebuilt if the view's primary key changes.

See Also:
resetSelectedAttributeDefs(), #unselectAttributeDefs(String[])

setMaxFetchSize

public void setMaxFetchSize(int size)
Maximum number of rows to fetch for this View Object. This number takes effect the next time the query for this View Object is executed.

Passing -1 to this method will retrieve an unlimited number of rows. In other words, all the row returned by this ViewObject's query result set may be retrieved. This is the default.

Passing 0 to this method will cause the database query not to be executed. The View Object will initially work with an empty row set. If you want to execute query later, call setMaxFetchSize again with a non-zero argument, then call executeQuery().

Parameters:
size - the maximum number of rows to fetch. The default, -1, retrieves an unlimited number of rows. 0 causes the query not to be executed, and row set is empty.

getInsertParticipants

protected int[] getInsertParticipants()
Internal: Applications should not use this method.

Returns an array of indices of entity bases that participate in processing the insert operation of the view row.

Returns:
an array of int indices of the entity bases.

activateNewRowTracker

protected void activateNewRowTracker(ViewRowSetImpl vrs,
                                     org.kxml2.io.KXmlParser parent)
Advanced Internal method only. ReStores the newRowTracker array


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 ViewCriteriaManager
Specified by:
applyViewCriteria in interface ViewObject
Parameters:
criteria - the view criteria to apply.

applyViewCriteria

public void applyViewCriteria(ViewCriteria criteria,
                              boolean bAppend)
Description copied from interface: ViewCriteriaManager
Apply the view crtieria passed as the argument. If the passed view criteria is not managed by this object it will be added to managed list. If bAppend is true the passed view criteria will be applied in addition to the existing ones. If bAppend is false this method is identical to ViewCriteriaManager.applyViewCriteria(ViewCriteria)

Specified by:
applyViewCriteria in interface ViewCriteriaManager
Parameters:
criteria - the criteria to be applied
bAppend - pass true if the view criteria needs to be appended to the applied list otherwise the list is cleared out.

getViewCriteria

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

This method should not be overridden.

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

getViewCriteria

public ViewCriteria getViewCriteria(java.lang.String name)
Description copied from interface: ViewCriteriaManager
Returns a reference to the view criteria with a specific name if it is found.

Specified by:
getViewCriteria in interface ViewCriteriaManager
Parameters:
name - view criteria name
Returns:
a view criteria reference or null

getRequiredViewCriteria

public ViewCriteria getRequiredViewCriteria()
Description copied from interface: ViewObject
This method returns a reference to the required view criteria if one exists on this View Object. See ViewObject.setRequiredViewCriteria(oracle.jbo.ViewCriteria)

Specified by:
getRequiredViewCriteria in interface ViewObject

setRequiredViewCriteria

public void setRequiredViewCriteria(ViewCriteria vc)
Description copied from interface: ViewObject
Setting a view criteria as required will enforce the criteria whenever the view object's query is executed. This criteria cannot be removed by using getViewCriteriaManager().clearViewCriterias or getViewCriteriaManager().removeViewCriteria API.

Specified by:
setRequiredViewCriteria in interface ViewObject
Parameters:
vc - Set the criteria as required view criteria for this view object instance.

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.

validateRangeSizeForRangePaging

protected void validateRangeSizeForRangePaging(ViewRowSetImpl vrs,
                                               int rangeSize)
Advanced Internal method only. For programmatic VOs to allow any rangeSize if they can handle it. By default, this method throws an InvalidOperException if rangeSize < 1


getAttrDefsForEntityAttr

public AttributeDef[] getAttrDefsForEntityAttr(java.lang.String eoName,
                                               java.lang.String eoAttrName)
This method performs the same operation as getAttrIndicesForEntityAttr, except that it return an array of attribute definitions, not just indices.

Parameters:
eoName - fully qualified name of the entity object.
eoAttrName - entity object attribute name.
Returns:
the array of attribute definitions ov VO attrs that are mapped to the entity attribute. If no view attribute is mapped to the entity attribute, an empty array (of length 0) is returned.
See Also:
getAttrIndicesForEntityAttr(String, String)

getAttrIndicesForEntityAttr

public int[] getAttrIndicesForEntityAttr(java.lang.String eoName,
                                         java.lang.String eoAttrName)
Returns an array of indices of view attributes that are mapped to the entity attribute identified by the entity name (the eoName parameter) and the entity attribute name (the eoAttrName).

Note that it returns an array because more than one view object attribute may be mapped to one entity attribute.

This method can be used to identify view attributes that map into a particular entity object attribute. In particular, if a validation error fails on an entity attribute, this method can be used to find view attributes that map into that entity attribute.

Parameters:
eoName - fully qualified name of the entity object.
eoAttrName - entity object attribute name.
Returns:
the array of indices of view attributes that are mapped to the entity attribute. If no view attribute is mapped to the entity attribute, an empty array (of length 0) is returned.

getDeleteParticipants

protected int[] getDeleteParticipants()
Internal: Applications should not use this method.

Returns an array of indices of entity bases that participate in processing the delete (remove) operation of the view row.

Returns:
an array of int indices of the entity bases.

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

activateState

protected void activateState(org.kxml2.io.KXmlParser parent)
Allows subclasses to retrieve custom data from an XML-node under the given parent element. This method differs from #activateState(ViewRowImpl, Element) in that the ViewObject RowSet and Iterator state are not restored when this method is invoked. Applications that define persistent, custom data which is dependent upon RowSet and/or Iterator state should extend #passivateState(ViewRowImpl, Document, Element) and #activateState(ViewRowImpl, Element) instead.

Parameters:
parent - element which could be null if nothing was passivated in it in passivateState

activateState

protected void activateState(ViewRowImpl currentRow,
                             org.kxml2.io.KXmlParser parent)
Deprecated. since 9.0.3.3 use activateState(ViewRowSetImpl vrs...)

Allows subclasses to retrieve custom data from an XML-node under the given parent element. Specifies the current row for which the key has been passivated.

Parameters:
currentRow - the View Row for which the key has been passivated. This could be null if there is no current row or current row could not be activated.
parent - the name of the parent element under which the custom data resides. This could be null if there was no custom data stored for this VO in passivateState.

activateState

protected void activateState(ViewRowSetImpl vrs,
                             ViewRowImpl currentRow,
                             org.kxml2.io.KXmlParser parent)
Deprecated. since 9.0.3.3 use activateState(ViewRowSetImpl vrs...)

Allows subclasses to retrieve custom data from an XML-node under the given parent element. Specifies the ViewRowSetImpl being activated along with current row for which the key has been passivated.

Parameters:
vrs - ViewRowSetImpl being activated.
currentRow - the View Row for which the key has been passivated. This could be null if there is no current row or current row could not be activated.
parent - the name of the parent element under which the custom data resides. This could be null if there was no custom data stored for this VO in passivateState.

notifyRowUpdated

protected void notifyRowUpdated(QueryCollection qc,
                                Row row,
                                int[] attrIndices,
                                UpdateEvent rowUpdateEvent)

notifyRowUpdated

protected void notifyRowUpdated(ViewRowSetImpl vrs,
                                Row[] viewRows,
                                int[] attrIndices,
                                UpdateEvent updateEvent)
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.
entityEVent - that is causing this view object level event.

isForeignKey

protected boolean isForeignKey(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.

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:
srow - entity that was removed.

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 ESTCOUNT
 
Based on the value returned, you might want to adjust the JDBC row prefetch size.

Returns:
the number of rows.

getQueryHitCount

public long getQueryHitCount(ViewRowSetImpl viewRowSet,
                             Row[] masterRows)

getCappedQueryHitCount

public long getCappedQueryHitCount(ViewRowSetImpl viewRowSet,
                                   Row[] masterRows,
                                   long oldCap,
                                   long cap)

putViewCriteria

public void putViewCriteria(java.lang.String name,
                            ViewCriteria vc)
Description copied from interface: ViewCriteriaManager
Add a view criteria to be managed by this object

Specified by:
putViewCriteria in interface ViewCriteriaManager
Parameters:
name - Name of the view criteria
vc - view criteria reference

removeViewCriteria

public ViewCriteria removeViewCriteria(java.lang.String name)
Description copied from interface: ViewCriteriaManager
Removes the view criteria from this manager. If it is applied it is first unapplied and then removed. If the intent is to simply unapply use removeApplyViewCriteriaName API.

Specified by:
removeViewCriteria in interface ViewCriteriaManager
Parameters:
name - The view criteria name that needs to be removed
Returns:
reference to the removed view criteria if found.

removeApplyViewCriteriaName

public boolean removeApplyViewCriteriaName(java.lang.String name)
Description copied from interface: ViewCriteriaManager
Unapplied the view criteria if it is applied. The view criteria will continue to be managed by this manager.

Specified by:
removeApplyViewCriteriaName in interface ViewCriteriaManager
Parameters:
name - The view criteria name that need to be unapplied.
Returns:
true if the view criteria was found to be applied, false otherwise.

createVariableValueManagerForRS

protected VariableValueManager createVariableValueManagerForRS(RowSet owner,
                                                               VariableManager[] varMgrParents)
Internal: Applications should not use this method. Framework Subclasses may use this to creaet custom subclasses of VariableValueManagerImpl


getLockParticipants

protected int[] getLockParticipants()
Internal: Applications should not use this method.

Returns an array of indices of entity bases that participate in processing the lock operation of the view row.

Returns:
an array of int indices of the entity bases.

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.

Specified by:
remove in interface ComponentObject
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.

executeEmptyRowSet

public void executeEmptyRowSet()

addViewLink

protected void addViewLink(ViewLinkImpl viewLink,
                           boolean isReversed)

resetSession

protected void resetSession()
BC4J invokes this method when a ViewObject is being reset for potential reuse by another client session. Custom applications may extend this method to clean up custom ViewObject state that was specific to the last session to use this ViewObject. Examples of custom session state may be a ViewObject where clause, order by clause, etc. public void resetSession() { super.resetSession(); if (getWhereClause() != null) { setWhereClause(null); } }

See Also:
ApplicationModuleImpl.resetState(boolean)

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.