Business Components

oracle.jbo
Interface ViewObject

All Known Implementing Classes:
ViewObjectImpl

public interface ViewObject
extends StructureDef, RowSet, ComponentObject

Defines the presentation of the Entity Objects selected by an SQL statement.

Since:
JDeveloper 3.0

Fields inherited from interface oracle.jbo.XMLInterface
XML_OPT_ALL_ROWS, XML_OPT_ASSOC_CONSISTENT, XML_OPT_CHANGES_ONLY, XML_OPT_LIMIT_RANGE
 
Fields inherited from interface oracle.jbo.RowIterator
SLOT_BEFORE_FIRST, SLOT_BEYOND_LAST, SLOT_DELETED, SLOT_VALID
 
Method Summary
 AttributeDef addDynamicAttribute(java.lang.String attrName)
          Adds a dynamic attribute (an AttributeDefImpl) to this View Object's row set.
 void applyViewCriteria(ViewCriteria criteria)
          Applies the view criteria to this View Object.
 void clearCache()
          Clears the View Object cache.
 RowSet createRowSet(java.lang.String name)
          Creates and returns a new (secondary) row set for this View Object.
 ViewCriteria createViewCriteria()
          Creates a new view criteria (that is, "Query by Example") object for this View Object.
 AttributeDef findViewLinkAccessor(ViewLink vl)
          Finds the view link accessor attribute.
 AttributeDef[] getKeyAttributeDefs()
          Returns the attribute definitions that make up the constituents of the Key object for Rows returned from this View Object.
 int getMaxFetchSize()
          Maximum number of rows to fetch for this view object.
 java.lang.String getOrderByClause()
          Returns the query's ORDER BY clause.
 java.lang.String getQuery()
          Returns the query statement.
 ViewCriteria getViewCriteria()
          Gets the view criteria for this View Object.
 java.lang.String[] getViewLinkNames()
          Constructs an array of names of View Links that involve this View Object.
 java.lang.String getWhereClause()
          Gets the query's WHERE clause.
 boolean isReadOnly()
          Tests if the View Object is read-only.
 void setMaxFetchSize(int max)
          Maximum number of rows to fetch for this View Object.
 void setOrderByClause(java.lang.String expr)
          Sets the ORDER BY clause of the View Object's query statement.
 void setWhereClause(java.lang.String cond)
          Sets a WHERE clause bind value of the View Object's query statement.
 
Methods inherited from interface oracle.jbo.StructureDef
findAttributeDef, getAttributeCount, getAttributeDef, getAttributeDefs
 
Methods inherited from interface oracle.jbo.RowSet
createRowSetIterator, executeQuery, getApplicationModule, getEstimatedRowCount, getMasterRowSetIterators, getName, getViewObject, getWhereClauseParams, isAssociationConsistent, isExecuted, isForwardOnly, removeMasterRowSetIterator, setAssociationConsistent, setForwardOnly, setMasterRowSetIterator, setWhereClauseParam, setWhereClauseParams
 
Methods inherited from interface oracle.jbo.ComponentObject
getDefFullName, getDefName, getFullName, remove
 
Methods inherited from interface oracle.jbo.RowSetIterator
addListener, createDetailRowSet, getDetailRowSets, getRowSet, removeListener
 
Methods inherited from interface oracle.jbo.XMLInterface
readXML, readXML, writeXML, writeXML
 
Methods inherited from interface oracle.jbo.RowIterator
createKey, createRow, enumerateRowsInRange, findByEntity, findByKey, first, getAllRowsInRange, getCurrentRow, getCurrentRowIndex, getCurrentRowSlot, getFetchedRowCount, getRangeIndexOf, getRangeSize, getRangeStart, getRow, getRowAtRangeIndex, getRowCount, getRowCountInRange, hasNext, hasPrevious, insertRow, insertRowAtRangeIndex, isRangeAtBottom, isRangeAtTop, last, next, previous, removeCurrentRow, reset, scrollRange, scrollRangeTo, setCurrentRow, setCurrentRowAtRangeIndex, setRangeSize, setRangeStart, setRowValidation
 

Method Detail

addDynamicAttribute

public AttributeDef addDynamicAttribute(java.lang.String attrName)
Adds a dynamic attribute (an AttributeDefImpl) to this View Object's row set.

Dynamic attributes are typeless, in that the application can set the attribute value to any object. You can use a dynamic attribute to store information created at runtime that you want to store with the row data. It is used only by the View Object that created it. Attributes can be any Serializable object.

This method should not be overridden.

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.

setWhereClause

public void setWhereClause(java.lang.String cond)
Sets a WHERE clause bind value of the View Object's query statement.

Bind variables can be specified using '?' as a place-holder for the value.

The new WHERE clause does not take effect until ViewObjectImpl.executeQuery() is called. For an example usage of this method, see ViewObjectImpl.setWhereClauseParam(int, Object).

Note that calling setWhereClause() does not clear the previous settings of WHERE clause parameters. To reset WHERE clause parameters in the middle tier, call ViewObjectImpl.setWhereClauseParams(Object[]) explicitly with a null value. For example:

 vo.setWhereClauseParams(null);
 
This method should not be overridden.
Parameters:
cond - a WHERE clause, but excluding the 'WHERE' keyword.

getWhereClause

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

This WHERE clause is obtained from the View Object instance. In the middle tier, to get the WHERE clauses built from the View Object instance, the View definition, and the detail View Objects, use ViewObjectImpl.buildWhereClause(java.lang.StringBuffer, int)

Returns:
the WHERE clause, excluding the WHERE keyword; null if no WHERE clause exists.

setOrderByClause

public void setOrderByClause(java.lang.String expr)
Sets the ORDER BY clause of the View Object's query statement. Bind variables can be specified using '?' as a place-holder for the value. The new ORDER BY clause does not take effect until ViewObjectImpl.executeQuery() is called.

This method should not be overridden.

Parameters:
cond - a ORDER BY clause, but excluding the 'ORDER BY' keywords.

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.

Returns:
a ORDER BY clause, but excluding the 'ORDER BY' keyword. null if the SQL statement has no ORDER BY clause.

getQuery

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

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

isReadOnly

public boolean isReadOnly()
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.

Returns:
true if this View Object is read-only; false if it is updateable.

createRowSet

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

getViewLinkNames

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

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

Returns:
the array of View Link names.

createViewCriteria

public ViewCriteria createViewCriteria()
Creates a new view criteria (that is, "Query by Example") 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.

Returns:
the new view criteria object.
See Also:
ViewCriteria, applyViewCriteria(ViewCriteria)

applyViewCriteria

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

View criteria rows are ORed together, while entries in the same row are ANDed together.

This method should not be overridden.

Parameters:
criteria - a view criteria object.

getViewCriteria

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

This method should not be overridden.

Returns:
the view criteria, or null if none is specified.

findViewLinkAccessor

public AttributeDef findViewLinkAccessor(ViewLink vl)
Finds the view link accessor attribute.
Parameters:
vl - the view link whose accessor is being sought.
Returns:
the attribute definition if one is found. null if not.

getKeyAttributeDefs

public AttributeDef[] getKeyAttributeDefs()
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.

Returns:
the array of attribute definitions.

clearCache

public void clearCache()
Clears the View Object cache. This method can be called for resource conservation. Calling this method marks the View Object and all its Row Sets as "needing to refresh its data". If another method that requires the result set is called (e.g., executeQuery(), next(), previous()) after this method, the query will be executed and the View Object/Row Set's cache refreshed from the database.

getMaxFetchSize

public int getMaxFetchSize()
Maximum number of rows to fetch for this view object. This number takes effect in when the query for this ViewObject is executed the next time.

setMaxFetchSize

public void setMaxFetchSize(int max)
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. 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:
int - 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.

Business Components