Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.7.0)

E10653-08

oracle.jbo
Class RowMatch

java.lang.Object
  extended by oracle.jbo.ExprEval
      extended by oracle.jbo.RowMatch
All Implemented Interfaces:
java.io.Serializable, JIReservedVarNames, JboReservedVarNames
Direct Known Subclasses:
RowQualifier

public class RowMatch
extends ExprEval
implements java.io.Serializable

RowMatch is used to apply in-memory a qualifying expression to rows in memory. The user specifies a SQL expression.

A RowMatch may be used stand-alone or used a qualifying RowMatch for a ViewObject. To use it stand-alone, one would create a RowMatch. Then, to see if a Row qualifies, one would invoke rowQualifies(Row). Here is an example:

    RowMatch rowMatch = new RowMatch("Deptno = 30");

    if (rowMatch.rowQualifies(row))
    {
       System.out.println("We have a row whose Deptno is 30");
    }
 
To use a RowMatch for a ViewObject, invoke ViewObject.setRowMatch(RowMatch). Rows will be qualified in-memory.

RowMatch differs from the where-clause of a database query statement mainly in that one should use row's attribute names as opposed to the database column names. Note that database column names are by default case-insensitive, while attribute names are case-sensitive.

Hence, to qualify for EmpView rows whose Deptno attribute value is 30, one can use the following where-clause in his query statement:

    DEPTNO = 30
 
To use the same qualification in-memory, one would create a RowMatch with

    Deptno = 30
 
Where-clause qualfication only applies to rows already exsiting in the database table. RowMatch will apply to rows as they are read from database query as well. Additionally, RowMatch is applied to rows that are created because of view link consistency.

View link consistency allows a RowSet to see new rows (unposted) created by another RowSet. Internally, when a new row is created by the other RowSet and the row's primary key is set, the original RowSet (if view link cosnsistency is on) receives an event indicating a new row has been created. This RowSet creates a row and inserts it in its collection. Before this copy row is inserted, it is tested against the view object's RowMatch. Only if the row qualifies will it be inserted.

If a qualification can be expressed in a query's where-clause, one should use the where-clause, because database will skip unqualifying rows. If one relies solely on the RowMatch for in-memory qualification, he may incur unnecessary performance overhead, because rows will be read from database query and formed in memory.

Unlike a where-clause, a RowMatch can evaluate expression involving transient attributes and not-yet-posted attribute values.

RowMatch is able to handle where-clause parameters in its expression. Assuming oracle number binding style for example, one can specify the following RowMatch:

    RowMatch rowMatch = new RowMatch("Deptno = :1");
    ViewObject vo;
    Row row;

    ...
    vo.setRowMatch(rowMatch);
    vo.executeQuery();

    // When evaluating each row for qualification, the where-clause
    // parameter of index 0 (where-clause param indices are 0 based)
    // will be used to see if it equals the Deptno attr value.
    while ((row = vo.next()) != null)
    {
       System.out.println("This row's Deptno is " + vo.getWhereClauseParam(0));
    }
 
RowMatch is also able to access variable values. To do so, one would use ":" in the expression. For example:

    RowMatch rowMatch = new RowMatch("Deptno = :myVariable");
 
When the RowMatch is used for a ViewObject, the ViewObject's variable manager will be asked to return the value of the variable. If the RowMatch is being used stand-alone, the row's owner (through the getStructureDef() call on the Row interface) is asked for the variable value. In this case, the owner object must implement the oracle.jbo.RowMatchBindValueSupplier interface.

Since:
JDeveloper 10.1.3
See Also:
Row, RowMatchBindValueSupplier, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class oracle.jbo.ExprEval
ExprEval.GlobalGroovyBinding, ExprEval.Privilege, ExprEval.TrustMode
 
Field Summary
 
Fields inherited from class oracle.jbo.ExprEval
EXPR_KEY_ADF, EXPR_KEY_ADFBCSESSION, EXPR_KEY_ADFCONTEXT, EXPR_KEY_ADFCRITERIAROW, EXPR_KEY_ADFCURRENT_DATE, EXPR_KEY_ADFCURRENT_DATETIME, EXPR_KEY_ADFCURRENT_DBDATE, EXPR_KEY_ADFCURRENT_DBDATETIME, EXPR_KEY_ADFDBTRANSACTION, EXPR_KEY_ADFERROR, EXPR_KEY_ADFSELF, EXPR_KEY_ADFSOURCE, EXPR_KEY_ADFUTIL, EXPR_KEY_ADFVIEWOBJECT, EXPR_KEY_GROOVY_OUT, EXPR_KEY_WEBSERVICES, EXPR_STYLE_GROOVY, EXPR_STYLE_JAVA, EXPR_STYLE_SQL, INTERNAL_MARKER_METHOD, INTERNAL_MARKER_METHOD_NAME, INTERNAL_UNTRUSTED_SCRIPT_PREAMBLE, INTERNAL_UNTRUSTED_SCRIPT_PREAMBLE_LINES, NAMEPOSTFIX, NAMEPREFIX, RESERVED_EXPR_KEY_ADFBCSESSION, RESERVED_EXPR_KEY_ADFCUSTOMGROOVY, RESERVED_EXPR_KEY_ADFGLOBALUTILITY, TRUSTEDSCRIPTLOG, UNTRUSTEDSCRIPTLOG
 
Fields inherited from interface oracle.jbo.JboReservedVarNames
RESERVED_VAR_AGG_AVG, RESERVED_VAR_AGG_COUNT, RESERVED_VAR_AGG_MAX, RESERVED_VAR_AGG_MIN, RESERVED_VAR_AGG_SUM, RESERVED_VAR_AGGVAL_PREFIX, RESERVED_VAR_STRUCTURE_DEF
 
Fields inherited from interface oracle.jbo.expr.JIReservedVarNames
RESERVED_VAR_VALUE
 
Constructor Summary
RowMatch()
           
RowMatch(java.lang.String whereClause)
           
RowMatch(java.lang.String whereClause, JIParserHelper ph)
           
 
Method Summary
 java.lang.String getWhereClause()
           
 boolean objQualifies(ExprValueSupplier valSupplier)
           
 boolean rowQualifies(Row row)
           
 void setWhereClause(java.lang.String whereClause)
           
 
Methods inherited from class oracle.jbo.ExprEval
createRowValueSupplier, equals, evaluate, evaluate, evaluate, evaluateForRow, evaluateForRow, getExprIdentifier, getExprMethodVal, getExprStr, getExprStyle, getMethodKind, getParsedExpr, getParsedScript, getRowVal, internalInvokeMethodOnGroovyScript, invokeMethodForRow, setExprStr, setParsedExpr, setRowVal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RowMatch

public RowMatch()

RowMatch

public RowMatch(java.lang.String whereClause)

RowMatch

public RowMatch(java.lang.String whereClause,
                JIParserHelper ph)
Method Detail

getWhereClause

public java.lang.String getWhereClause()

setWhereClause

public void setWhereClause(java.lang.String whereClause)

rowQualifies

public boolean rowQualifies(Row row)

objQualifies

public boolean objQualifies(ExprValueSupplier valSupplier)

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.7.0)

E10653-08

Copyright © 1997, 2013, Oracle. All rights reserved.