|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1) E10653-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ViewObject
ViewObject
decribes how the application will view and update data. A view object may be entity based or non-entity based. In the former case, the view object consists of one or more entity bases. The first one of these is referred to as the primary entity base. The rest are called secondary entity bases. An entity based view object maps its attribute (view attributes) to attributes in the entities (entity attributes). An entity based view object may map all its entity attributes or only some of them. However, an entity based view object is required to map all primary key attributes of the entity bases. An entity based view object may additional include attributes that are not mapped to an entity attribute. Such an attribute is referred to View level attribute.
A non-entity based view object is one where it does not have any entity base. All its attributes are view level attributes.
view object is responsible for managing database query statement. Regardless of whether the view object is entity based or not, it may have a SQL statement from which it draws its data. As rows are read from this query, it will populate a
(of this view object) with view rows.RowSet
View object provides a number of APIs through which the client can modify and augment the query statement during runtime. For example, see
.setWhereClause(String)
A view level attribute (not mapped to an entity attribute) may map to a column or a SQL expression in the query statement. It may be a transient attribute (whose data is purely in memory and not mapped to any database column/expression. Or, it may be a dynamic attribute.
Row
, RowSet
, RowSetIterator
, AttributeDef
Field Summary | |
---|---|
static java.lang.String |
IMAGE_LOC The name of the (default) icon that can be used to represent a View Object instance. |
static int |
QUERY_MODE_SCAN_DATABASE_TABLES Specifies that rows should be produced from database query result. |
static int |
QUERY_MODE_SCAN_ENTITY_ROWS Specifies that rows should be produced from entity cache. |
static int |
QUERY_MODE_SCAN_UNPOSTED_ENTITY_ROWS Specifies that rows should be produced from the unposted rows in the entity cache. |
static int |
QUERY_MODE_SCAN_VIEW_ROWS These QUERY_MODE_SCAN_... constants are used to specify the query mode for the view object. |
static int |
QUERY_MODE_SKIP_WHERE Specifies that when going to db to look for matching rows for findByViewCriteria , the where-clauses from the original VO should not included in the finder VO. |
static int |
QUERY_TIMEOUT_WAIT_FOREVER Specifies that the view object does not time out when executing query. |
static java.lang.String |
XML_ELEM_PASSIVATE_TRANSIENT Internal Property on an attribute to indicate if this attribute value is to be passivated or not. |
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.XMLInterface |
---|
XML_IGNORE_DEPTH_COUNT, XML_OPT_ALL_ROWS, XML_OPT_ASSOC_CONSISTENT, XML_OPT_CHANGES_ONLY, XML_OPT_LIMIT_RANGE |
Method Summary | |
---|---|
AttributeDef |
addDynamicAttribute(java.lang.String attrName) Adds a dynamic attribute (an AttributeDefImpl) to this view object's row set. |
AttributeDef |
addDynamicAttributeWithType(java.lang.String attrName, java.lang.String javaTypeName, java.lang.String transientExpression) |
void |
addQueryMode(int queryMode) Adds query mode for the view object. |
void |
applyViewCriteria(ViewCriteria criteria) Applies the view criteria to this view object. |
void |
applyViewCriteria(ViewCriteria criteria, boolean bAppend) Applied 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. |
ListBindingDef |
findListBindingDef(java.lang.String lbName) Return listbinding definition if defined in this ViewObject (or in the entity definitions for entities that this ViewObject constitutes of). |
RowSet |
findRowSet(java.lang.String rsName) Gets the named row set that was created at runtime for this view object. |
AttributeDef |
findViewLinkAccessor(ViewLink vl) Finds the view link accessor attribute. |
AttributeDef[] |
getAttrDefsForEntityAttr(java.lang.String eoName, java.lang.String eoAttrName) Returns the definitions 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 ). |
SortCriteria[] |
getDBSortCriteria() |
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. |
int |
getQueryMode() Gets the current query mode of this view object. |
java.lang.String |
getQueryOptimizerHint() Returns query optimizer Hint set for this ViewObject or for its definition object. |
int |
getQueryTimeOut() Returns the current query time out value. |
ViewCriteria |
getRequiredViewCriteria() This method returns a reference to the required view criteria if one exists on this View Object. |
RowMatch |
getRowMatch() Gets the in-memory filter ( RowMatch ) for the view object. |
RowSet[] |
getRowSets() Gets all row sets that belong to this view object. |
java.lang.String |
getSortBy() |
java.lang.String[] |
getSubstitutedDefNames() Returns an array of fully qualified view definition names that are substituted by this view object's definition. |
ViewCriteria |
getViewCriteria() Gets the currently applied view criteria of this view object. |
ViewCriteriaManager |
getViewCriteriaManager() |
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 |
isInternal() Returns whether this view object was created internally by BC4J or by an explicit user request. |
boolean |
isReadOnly() Tests if the view object is read-only. |
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). |
void |
readRowXML(Element elem, int depthCount) Reads the data in XML form (in the format as generated by writeXML()) by finding a row that matches the key in the given XML and then reading in that row. |
void |
readRowXML(Element elem, int depthCount, XSLStylesheet xslt) |
void |
setDBSortCriteria(SortCriteria[] sortCriteria) Set declarative sort criteria for database queries. |
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 |
setQueryMode(int queryMode) Sets query mode for the view object. |
void |
setQueryOptimizerHint(java.lang.String hintText) If this ViewObject does not have an expert mode query, then this hint is added to the select clause of the SQL for this ViewObject before the columns are listed e.g., SELECT \/*+ <hintText> *\/ columns... |
void |
setQueryTimeOut(int timeOutMills) Sets the query time out value for the view object. |
void |
setRequiredViewCriteria(ViewCriteria vc) Setting a view criteria as required will enforce the criteria whenever the view object's query is executed. |
void |
setRowMatch(RowMatch rowMatch) Sets an in-memory filter ( RowMatch ) for the view object. |
void |
setSortBy(java.lang.String sortBy) Specify a clause to perform in-memory sorting. |
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, getAttributeIndexOf, getColumnNameForQuery, getDefFullName, getDefName, getFullName, getName, lookupAttributeDef |
Methods inherited from interface oracle.jbo.RowSetIterator |
---|
addManagementListener, closeRowSetIterator, createDetailRowSet, getDetailRowSets, getEstimatedRangePageCount, getFilteredRows, getFilteredRowsInRange, getNextRangeSet, getPreviousRangeSet, getRowSet, getSyncLock, isNameGenerated, removeManagementListener, scrollToRangePage |
Methods inherited from interface oracle.jbo.NavigatableRowIterator |
---|
addListener, removeListener |
Methods inherited from interface oracle.jbo.VariableManagerOwnerBase |
---|
ensureVariableManager, getMessageBundleClass, getResourceBundleDef, getVariableManager, hasVariables |
Methods inherited from interface oracle.jbo.XMLInterface |
---|
readXML, readXML, writeXML, writeXML, writeXML, writeXML |
Methods inherited from interface oracle.jbo.ComponentObject |
---|
getDefFullName, getDefName, getFullName, getName, remove |
Methods inherited from interface oracle.jbo.Properties |
---|
getProperties, getProperty, getProperty, refreshProperty |
Field Detail |
---|
static final int QUERY_MODE_SCAN_VIEW_ROWS
QUERY_MODE_SCAN_...
constants are used to specify the query mode for the view object. Query mode controls how qualifying formulated for each row set in the view object. These constants can be OR'ed together. If more than one query mode is specified in this manner, rows for the collection will be produced from more than one source.
If you call setQueryMode(int)
or addQueryMode(int)
to change the query mode, the new query mode does not go into effect until you call RowSet.executeQuery()
on the row set.
Rows can come from three different sources. If the row set currently has a collection of rows (View rows), QUERY_MODE_SCAN_VIEW_ROWS
will indicate that the row match (see setRowMatch(RowMatch)
) should be applied to further filter view rows. Unqualifying rows are removed from the collection.
If the query mode includes QUERY_MODE_SCAN_ENTITY_ROWS
, the entity cache is scanned to see if qualifying rows can be produced. If so, these rows are added to the collection.
If the query mode includes QUERY_MODE_SCAN_DATABASE_TABLES
, a database query is issued to produce rows from the query result. The default query mode is QUERY_MODE_SCAN_DATABASE_TABLES
.
If the query mode includes QUERY_MODE_SCAN_UNPOSTED_ENTITY_ROWS
, the list of unposted rows in the entity cache is scanned to see if qualifying rows can be produced. If so, these rows are added to the collection. Note that since QUERY_MODE_SCAN_UNPOSTED_ENTITY_ROWS
is a subset of QUERY_MODE_SCAN_ENTITY_ROWS
, it will be ignored if that is specified. This is a performance enhancing version of QUERY_MODE_SCAN_ENTITY_ROWS
when only the unposted rows need to be considered.
If the query mode specifies multiple sources, then care if taken to prevent duplicate rows from appearing.
static final int QUERY_MODE_SCAN_ENTITY_ROWS
static final int QUERY_MODE_SCAN_DATABASE_TABLES
static final int QUERY_MODE_SCAN_UNPOSTED_ENTITY_ROWS
static final int QUERY_MODE_SKIP_WHERE
findByViewCriteria
, the where-clauses from the original VO should not included in the finder VO. Only affects QUERY_MODE_SCAN_DATABASE_TABLES
static final int QUERY_TIMEOUT_WAIT_FOREVER
ViewObject.CancelQuery
and RowSet.CancelQuery
.
static final java.lang.String XML_ELEM_PASSIVATE_TRANSIENT
static final java.lang.String IMAGE_LOC
Method Detail |
---|
java.lang.String[] getSubstitutedDefNames()
This method finds substituted def names recursively. That is, If A is substituted by B, and B by C, calling this method on a view object of C returns B and A.
AttributeDef addDynamicAttribute(java.lang.String attrName)
Dynamic attributes are typeless, in that the application can set the attribute value to any object. You can use a dynamic attribute to store information created at runtime that you want to store with the row data. It is used only by the view object that created it. Attributes can be any serializable (java.io.Serializable
) object.
This method should not be overridden.
attrName
- the name of the dynamic attribute.NameClashException
- if an attribute of the same name already exists.AttributeDef addDynamicAttributeWithType(java.lang.String attrName, java.lang.String javaTypeName, java.lang.String transientExpression)
void setWhereClause(java.lang.String cond)
Bind variables can be specified using '?' as a place-holder for the value.
The new where-clause does not take effect until RowSet.executeQuery()
is called. If the where-clause contains where-clause parameters, RowSet.setWhereClauseParam(int, Object)
or RowSet.setWhereClauseParams(Object[])
needs to be called before executeQuery()
.
Note that calling setWhereClause() does not clear the previous settings of where-clause parameters. To reset where-clause parameters in the middle tier, call RowSet.setWhereClauseParams(Object[])
explicitly with a null value. For example:
vo.setWhereClauseParams(null);This method should not be overridden.
cond
- a where-clause, but excluding the 'WHERE' keyword.java.lang.String getWhereClause()
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 ViewObjectImpl.buildWhereClause(java.lang.StringBuffer, int)
void setOrderByClause(java.lang.String expr)
RowSet.executeQuery()
is called.
This method should not be overridden.
expr
- a ORDER BY clause, but excluding the 'ORDER BY' keywords.java.lang.String getOrderByClause()
This method should not be overridden.
java.lang.String getQuery()
ViewObjectImpl.getUserDefinedQuery()
this method will return a SQL statement regardless of whether the query was created in expert or non-expert Mode.void setRowMatch(RowMatch rowMatch)
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.rowMatch
- the new row match.RowMatch getRowMatch()
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.void setSortBy(java.lang.String sortBy)
sortBy
- in-memory sort clausejava.lang.String getSortBy()
setSortBy(String)
void setQueryMode(int queryMode)
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
.
queryMode
- the new query mode.void addQueryMode(int queryMode)
The queryMode
parameter may be an OR'ed flag of QUERY_MODE_SCAN_...
constants. This method OR'es in the incoming queryMode
to the view object's current query mode. 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.
queryMode
- the new query mode to be added (OR'ed).int getQueryMode()
The returning value may be an OR'ed flag of QUERY_MODE_SCAN_...
constants. See these constants for further details.
The default query mode is QUERY_MODE_SCAN_DATABASE_TABLES
.
boolean isReadOnly()
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.
true
if this view object is read-only; false if it is updateable.RowSet createRowSet(java.lang.String name)
name
- the name for the new RowSet
.RowSet[] getRowSets()
RowSet findRowSet(java.lang.String rsName)
rsName
- a row set name. If null
, it returns the the view object.null
if the named row set is not not found.java.lang.String[] getViewLinkNames()
A view link may use this view object as either its source or destination. This method should not be overridden.
AttributeDef findViewLinkAccessor(ViewLink vl)
vl
- the view link whose accessor is being sought.null
if not.AttributeDef[] getKeyAttributeDefs()
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.
AttributeDef[] getAttrDefsForEntityAttr(java.lang.String eoName, java.lang.String eoAttrName)
eoName
parameter) and the entity attribute name (the eoAttrName
).
Note that it returns an array because more than one view object attribute may be mapped to one entity attribute.
This method can be used to identify view attributes that map into a particular entity object attribute. In particular, if a validation error fails on an entity attribute, this method can be used to find view attributes that map into that entity attribute.
eoName
- fully qualified name of the entity object.eoAttrName
- entity object attribute name.void clearCache()
int getMaxFetchSize()
void setMaxFetchSize(int max)
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().
max
- 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.void setQueryOptimizerHint(java.lang.String hintText)
java.lang.String getQueryOptimizerHint()
boolean isInternal()
int getQueryTimeOut()
QUERY_TIMEOUT_WAIT_FOREVER
.void setQueryTimeOut(int timeOutMills)
QUERY_TIMEOUT_WAIT_FOREVER
(-1), which means that the query will not time out. The user will be able to cancel the long running query by calling cancelQuery()
If a positive timeout value is specified, the query is monitored by a global monitor thread. The monitor thread waits the specified amount of time (approximately) in milli-seconds, and cancels the query by calling JDBC's Statement.cancel()
.
timeOutMills
- if non-negative, number of milli-seconds before the query is timed out. Or, it can be the QUERY_TIMEOUT_WAIT_FOREVER
constants.void readRowXML(Element elem, int depthCount)
The depthcount parameter represents to what level the rendering should recurse. A depthcount of zero (0) means do not traverse any view links while rendering. One (1) means traverse the view links on this object but no view links thereafter, and so on.
void readRowXML(Element elem, int depthCount, XSLStylesheet xslt)
ListBindingDef lookupListBindingDef(java.lang.String lbName)
ListBindingDef findListBindingDef(java.lang.String lbName)
lookupListBindingDef(String)
throws an exception if a listbinding definition of name lbName
is not found.lbName
- listbinding namevoid setDBSortCriteria(SortCriteria[] sortCriteria)
sortCriteria
- an array of database sort criteria with an element for each attribute to sort withSortCriteria[] getDBSortCriteria()
setDBSortCriteria(SortCriteria[])
.ViewCriteriaManager getViewCriteriaManager()
ViewCriteria createViewCriteria()
A view criteria is a more structured way of creating a SQL query where-clause. After setting various conditions for the view criteria object, the application can call applyViewCriteria
This method should not be overridden.
ViewCriteria
, applyViewCriteria(ViewCriteria)
void applyViewCriteria(ViewCriteria criteria)
criteria
- view criteria to be appliedvoid applyViewCriteria(ViewCriteria criteria, boolean bAppend)
bAppend
is true
view criteria is appended to the list of already applied view criteria. If bAppend
is false
the applied view criteria list is cleared prior to applying the passed view criteria.criteria
- view criteria to be appliedbAppend
- flag to indicate if the applied view criteria list needs to be cleared before applying the view criteria.ViewCriteria getViewCriteria()
null
if none was applied.void setRequiredViewCriteria(ViewCriteria vc)
getViewCriteriaManager().clearViewCriterias
or getViewCriteriaManager().removeViewCriteria
API.vc
- Set the criteria as required view criteria for this view object instance.ViewCriteria getRequiredViewCriteria()
setRequiredViewCriteria(oracle.jbo.ViewCriteria)
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1) E10653-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |