Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3) B16005-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.jbo
Class ViewCriteriaRow

`java.lang.Object
oracle.jbo.ViewCriteriaRow`

All Implemented Interfaces:
  AttributeList, Row, XMLInterface

public class ViewCriteriaRow
extends java.lang.Object
implements Row

An array containing criteria for the individual attributes of a View Object's WHERE clause.

A `ViewCriteriaRow` is owned by a `ViewCriteria`. For an example of a program that uses `ViewCriteriaRow` methods, see `ViewCriteria`.

ViewCriteriaRow is built as a Row. You get and set attributes through `getAttribute()` and `setAttribute()` method.

The attribute value of a ViewCriteriaRow represents a search criterion to be applied for the View Object's attribute. Each attribute criterion may optionally start with a comparison operator. Here are the operators recognized by ViewCriteriaRow: <, >, =, ~, !, LIKE, IS, IN, NOT, NULL, BETWEEN. If an operator is found, no interpretation of the attribute value occurs. I.e., the attribute value is used as is. This means that for a String attribute, one must put "'" around string constants.

If no operator is specified, for char attributes, the LIKE operator is assumed. For non-char attributes, = operator is assumed. The string constant for LIKE comparison may use "*". "*" is translated to "%".

If multiple attribute criteria are specified in this ViewCriteriaRow, i.e., `setAttribute()` was called on more than one attribute, the attribute criteria are AND'ed. For example, the following code snippet

        // Create and populate criteria rows to support query-by-example.
        ViewObject empView = appMod.createViewObject("Emp", "mypackage1.EmpView");
        ViewCriteria vc = empView.createViewCriteria();
        ViewCriteriaRow vcRow = vc.createViewCriteriaRow();

        vcRow.setAttribute("Job", "= 'MANAGER'");
        vcRow.setAttribute("Deptno", "= 10");
        vc.addElement(vcRow);

will result in the following WHERE clause: "( JOB = 'MANAGER' ) AND ( DEPTNO = 10 )".

Using `setUpperColumns(boolean)`, you can designate that this ViewCriteriaRow should apply UPPER to the database column before comparing it to the attribute criterion. Keep in mind though that the use of UPPER can have a performance consequences for a large data set, as the database engine may not be able to utilize indices for query optimization.

When multiple ViewCriteriaRow's are added to the ViewCriteria, you can specify whether the WHERE clause generated by this ViewCriteriaRow should AND or OR with the previous WHERE clause. You do this through the `setConjunction(int)` method. You use `VCROW_CONJ_` constants to specify the desired conjunction. Note that `VCROW_CONJ_NOT` can be combined with other `VCROW_CONJ_`'s through bit-wise OR operator. `VCROW_CONJ_NOT` negates the entire clause generated from this ViewCriteriaRow. For example,

        // Create and populate criteria rows to support query-by-example.
        ViewObject empView = appMod.createViewObject("Emp", "mypackage1.EmpView");
        ViewCriteria vc = empView.createViewCriteria();
        ViewCriteriaRow vcRow = vc.createViewCriteriaRow();

        vcRow.setAttribute("Job", "MANAGER");
        vc.addElement(vcRow);

        vcRow.setAttribute("Deptno", "= 10");
        vcRow.setConjunction(vcRow.VCROW_CONJ_NOT | vcRow.VCROW_CONJ_AND);
        vc.addElement(vcRow);

        empView.applyViewCriteria(vc);
        empView.executeQuery();

will result in a WHERE clause like the following: "( JOB LIKE 'MANAGER' ) AND ( NOT ( DEPTNO = 10 ) )."

Since:
  JDeveloper 3.0

Field Summary
`static int` | `VCROW_CONJ_AND` `VCROW_CONJ_...` constants are used to specify the conjuction for this ViewCriteriaRow.
`static int` | `VCROW_CONJ_NOT` `VCROW_CONJ_...` constants are used to specify the conjuction for this ViewCriteriaRow.
`static int` | `VCROW_CONJ_OR` `VCROW_CONJ_...` constants are used to specify the conjuction for this ViewCriteriaRow.

Fields inherited from interface oracle.jbo.Row
`REFRESH_CONTAINEES, REFRESH_FORGET_NEW_ROWS, REFRESH_REMOVE_NEW_ROWS, REFRESH_UNDO_CHANGES, REFRESH_WITH_DB_FORGET_CHANGES, REFRESH_WITH_DB_ONLY_IF_UNCHANGED, STATUS_INITIALIZED, STATUS_NEW`

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`

Constructor Summary
`ViewCriteriaRow(ViewCriteria viewCriteria, java.lang.Object[] data)` Creates a new view criteria row.

Method Summary
`java.lang.Object` | `getAttribute(int index)` Gets the criterion for a given attribute.
`java.lang.Object` | `getAttribute(java.lang.String name)` Gets the criterion for a given attribute.
`int` | `getAttributeCount()` Counts the attribute criteria in the row.
`int` | `getAttributeIndexOf(java.lang.String name)` Gets the attribute index associated with a given attribute name.
`java.lang.String[]` | `getAttributeNames()` Returns an array of attribute names in this list.
`java.lang.Object[]` | `getAttributeValues()` Returns an array of attribute values in this list.
`int` | `getConjunction()`
`Key` | `getKey()` Returns the row's key.
`StructureDef` | `getStructureDef()` Returns the structure of the row.
`boolean` | `hasData()`
`boolean` | `isAttributeUpdateable(int index)` Tests if an attribute is updateable.
`boolean` | `isDead()` An attempt to access a dead view row will lead to a DeadViewRowAccessException.
`boolean` | `isUpperColumns()` Returns the upper-columns flag for this `ViewCriteriaRow`.
`void` | `lock()` Locks the row(s) in the source database table.
`void` | `readXML(Element elem, int depthCount)`
`void` | `readXML(Element elem, int depthCount, XSLStylesheet xslt)`
`void` | `refresh(int refreshMode)` Refreshes the row's attributes with values from database.
`void` | `remove()` Removes the row from the source database.
`void` | `removeAndRetain()` Removes the row from the collection and then retain it for insertion into another location.
`void` | `removeFromCollection()` Removes the row from the collection.
`void` | `setAttribute(int index, java.lang.Object value)` Sets the criterion for a given attribute.
`void` | `setAttribute(java.lang.String name, java.lang.Object value)` Sets the criterion for a given attribute.
`void` | `setConjunction(int conjunction)`
`void` | `setNewRowState(byte state)` Sets a new unposted row, created in this transaction, to either STATUS_NEW or STATUS_INITIALIZED mode.
`void` | `setUpperColumns(boolean isUpper)` Sets the upper-columns flag for this `ViewCriteriaRow`.
`void` | `validate()` Invokes the validation methods defined for the row's Entity Object.
`Node` | `writeXML(int depthCount, long options)` Renders data in a canonical XML-format.
`Node` | `writeXML(int depthCount, long options, XSLStylesheet xslt)`
`Node` | `writeXML(long options, com.sun.java.util.collections.HashMap map)` Renders data in a canonical XML-format.
`Node` | `writeXML(long options, com.sun.java.util.collections.HashMap map, XSLStylesheet xslt)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### VCROW_CONJ_OR

    public static int VCROW_CONJ_OR

  `VCROW_CONJ_...` constants are used to specify the conjuction for this ViewCriteriaRow. See above for further explanation.

  `VCROW_CONJ_OR` will add the clause generated by this ViewCriterRow with an OR conjunction.

### VCROW_CONJ_AND

    public static int VCROW_CONJ_AND

  `VCROW_CONJ_...` constants are used to specify the conjuction for this ViewCriteriaRow. See above for further explanation.

  `VCROW_CONJ_AND` will add the clause generated by this ViewCriterRow with an AND conjunction.

### VCROW_CONJ_NOT

    public static int VCROW_CONJ_NOT

  `VCROW_CONJ_...` constants are used to specify the conjuction for this ViewCriteriaRow. See above for further explanation.

  `VCROW_CONJ_NOT` will negate the clause generated by this ViewCriterRow. `VCROW_CONJ_NOT` may be combined with other `VCROW_CONJ_...` constants through a bit-wise OR operator.

Constructor Detail

### ViewCriteriaRow

    public ViewCriteriaRow(ViewCriteria viewCriteria,
                           java.lang.Object[] data)

  Creates a new view criteria row.
Parameters:
  `viewCriteria` - the `ViewCriteria` that is to contain the `ViewCriteriaRow`
  `data` - an array of attribute criteria to be initially assigned to this `ViewCriteriaRow`.

Method Detail

### getConjunction

    public int getConjunction()

### setConjunction

    public void setConjunction(int conjunction)

### isUpperColumns

    public boolean isUpperColumns()

  Returns the upper-columns flag for this `ViewCriteriaRow`. If this flag is `true`, UPPER SQL operator will be applied to all CHAR/VARCHAR columns when the SQL WHERE clause is generated.

  The default is `false`.

### setUpperColumns

    public void setUpperColumns(boolean isUpper)

  Sets the upper-columns flag for this `ViewCriteriaRow`. If this flag is `true`, UPPER SQL operator will be applied to all CHAR/VARCHAR columns when the SQL WHERE clause is generated.
  Parameters:
    `isUpper` - a new flag value for upper'ing columns.

### getAttribute

    public java.lang.Object getAttribute(int index)

  Gets the criterion for a given attribute.
  Specified by:
    `getAttribute` in interface `AttributeList`
  Parameters:
    `index` - the attribute's index.
  Returns:
    the attribute's criterion.

### getAttribute

    public final java.lang.Object getAttribute(java.lang.String name)

  Gets the criterion for a given attribute.
  Specified by:
    `getAttribute` in interface `AttributeList`
  Parameters:
    `name` - the attribute's name.
  Returns:
    the attribute's criterion.

### setAttribute

    public void setAttribute(int index,
                             java.lang.Object value)

  Sets the criterion for a given attribute.
  Specified by:
    `setAttribute` in interface `AttributeList`
  Parameters:
    `index` - the attribute's index.
    `value` - a new criterion for the attribute.

### setAttribute

    public final void setAttribute(java.lang.String name,
                                   java.lang.Object value)

  Sets the criterion for a given attribute.
  Specified by:
    `setAttribute` in interface `AttributeList`
  Parameters:
    `name` - the attribute's name.
    `value` - a new criterion for the attribute.

### getAttributeCount

    public int getAttributeCount()

  Counts the attribute criteria in the row.
  Specified by:
    `getAttributeCount` in interface `AttributeList`
  Returns:
    the number of criteria.

### getAttributeIndexOf

    public int getAttributeIndexOf(java.lang.String name)

  Gets the attribute index associated with a given attribute name.
  Specified by:
    `getAttributeIndexOf` in interface `AttributeList`
  Parameters:
    `name` - the attribute name.
  Returns:
    the attribute index. Attribute indices start from 0.

### getAttributeNames

    public java.lang.String[] getAttributeNames()

  Description copied from interface: `AttributeList`
  Returns an array of attribute names in this list.
  Specified by:
    `getAttributeNames` in interface `AttributeList`
  Returns:
    an array of attribute names.

### getAttributeValues

    public java.lang.Object[] getAttributeValues()

  Description copied from interface: `AttributeList`
  Returns an array of attribute values in this list.
  Specified by:
    `getAttributeValues` in interface `AttributeList`
  Returns:
    an array of attribute values.

### getKey

    public Key getKey()

  Returns the row's key. ViewCriterRow does not have a key.
  Specified by:
    `getKey` in interface `Row`
  Returns:
    `null`.

### validate

    public void validate()

  Invokes the validation methods defined for the row's Entity Object.
  Specified by:
    `validate` in interface `Row`
  Throws:
    `JboException` - a runtime exception, if the recipient wishes the property change to be rolled back.
  See Also:
    `EntityImpl.validate()`, `ViewRowImpl.validate()`

### lock

    public void lock()

  Locks the row(s) in the source database table.
  Specified by:
    `lock` in interface `Row`
  Throws:
    `JboException` - a runtime exception, if an exception occurs during access.

### remove

    public void remove()

  Removes the row from the source database.
  Specified by:
    `remove` in interface `Row`
  Throws:
    `JboException` - a runtime exception, if an exception occurs during access.

### removeFromCollection

    public void removeFromCollection()

  Description copied from interface: `Row`
  Removes the row from the collection.

  This method differs from ``Row.remove()`` in that it just removes the row from the collection. It does not remove the underlying Entity row(s) or database row(s). However, once the row is removed, it cannot be used any more. If you want to remove the row from the collection and insert it elsewhere, call ``Row.removeAndRetain()``.

  Specified by:
    `removeFromCollection` in interface `Row`

### removeAndRetain

    public void removeAndRetain()

  Description copied from interface: `Row`
  Removes the row from the collection and then retain it for insertion into another location.

  This method differs from ``Row.remove()`` in that it just removes the row from the collection. It does not remove the underlying Entity row(s) or database row(s).

  This method also differs from ``Row.removeFromCollection()`` in that after the row is removed from the collection, it can be inserted back into the collection at another location.

  Specified by:
    `removeAndRetain` in interface `Row`

### refresh

    public void refresh(int refreshMode)

  Description copied from interface: `Row`
  Refreshes the row's attributes with values from database. `refreshMode` should be a combination of `REFRESH_...`. See `REFRESH_...` constants for further information.
  Specified by:
    `refresh` in interface `Row`
  Parameters:
    `refreshMode` - the refresh mode.

### isAttributeUpdateable

    public boolean isAttributeUpdateable(int index)

  Tests if an attribute is updateable.
  Specified by:
    `isAttributeUpdateable` in interface `Row`
  Parameters:
    `index` - the index of the attribute.
  Returns:
    `true` if the row is marked `UPDATEABLE`, or if the row is marked `UPDATEABLE_WHILE_NEW` and the current row is new.

### getStructureDef

    public StructureDef getStructureDef()

  Description copied from interface: `Row`
  Returns the structure of the row.
  Specified by:
    `getStructureDef` in interface `Row`
  Returns:
    `StructureDef` that describes the structure of the row.

### writeXML

    public Node writeXML(long options,
                         com.sun.java.util.collections.HashMap map)

  Description copied from interface: `XMLInterface`
  Renders data in a canonical XML-format. The classes `ViewObjectImpl` and `ViewRowImpl` implement this method to render data in XML.

  Use this method whenever data is required in XML format, either to present a UI (after converting XML data into some HTTP format using a stylesheet) or to pass the data as payload for messages via JMS.

  The `options` parameter represents a set of bit flags that will control the `writeXML` behavior. The following bit flags have been defined:

  - `public static long XML_OPT_LIMIT_RANGE = 0x00000001` - Controls whether `writeXML` will only write rows in the range. If this flag is off, all rows in the row set will be written. If this flag is on, only rows in the current range will be written.
  - `public static long XML_OPT_CHANGES_ONLY = 0x00000002` - Controls whether only changed attribute values of an entity row is written. If this is on, only the attributes whose value has been marked as "changed" will be written. If this is off, all attributes (regardless of whether the attribute value has been changed or not) will be written. This flag is relevant only when writing `EntityImpl`.

  The `voAttrMap` parameter represents in a hashmap, the mapping between a given ViewObject's definition type and the corresponding Attributes/accessors to render. A null entry in the hashmap means, render all attributes and accessors of that viewobject type.

  Specified by:
    `writeXML` in interface `XMLInterface`
  Parameters:
    `options` - a set of bit flags that will control the `writeXML`
    `map` - HashMap containing Definition names of ViewObjects and an array of AttributeDef to render for a ViewObject of that definition type.

### writeXML

    public Node writeXML(long options,
                         com.sun.java.util.collections.HashMap map,
                         XSLStylesheet xslt)

  Specified by:
    `writeXML` in interface `XMLInterface`

### writeXML

    public Node writeXML(int depthCount,
                         long options)

  Description copied from interface: `XMLInterface`
  Renders data in a canonical XML-format. The classes `ViewObjectImpl` and `ViewRowImpl` implement this method to render data in XML.

  Use this method whenever data is required in XML format, either to present a UI (after converting XML data into some HTTP format using a stylesheet) or to pass the data as payload for messages via JMS.

  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.

  The `options` parameter represents a set of bit flags that will control the `writeXML` behavior. The following bit flags have been defined:

  - `public static long XML_OPT_LIMIT_RANGE = 0x00000001` - Controls whether `writeXML` will only write rows in the range. If this flag is off, all rows in the row set will be written. If this flag is on, only rows in the current range will be written.
  - `public static long XML_OPT_CHANGES_ONLY = 0x00000002` - Controls whether only changed attribute values of an entity row is written. If this is on, only the attributes whose value has been marked as "changed" will be written. If this is off, all attributes (regardless of whether the attribute value has been changed or not) will be written. This flag is relevant only when writing `EntityImpl`.
  Specified by:
    `writeXML` in interface `XMLInterface`
  Parameters:
    `depthCount` - represents to what level the rendering should recurse.
    `options` - a set of bit flags that will control the `writeXML` behavior.

### writeXML

    public Node writeXML(int depthCount,
                         long options,
                         XSLStylesheet xslt)

  Specified by:
    `writeXML` in interface `XMLInterface`

### readXML

    public void readXML(Element elem,
                        int depthCount)

  Specified by:
    `readXML` in interface `XMLInterface`

### readXML

    public void readXML(Element elem,
                        int depthCount,
                        XSLStylesheet xslt)

  Specified by:
    `readXML` in interface `XMLInterface`

### hasData

    public final boolean hasData()

### setNewRowState

    public void setNewRowState(byte state)

  Description copied from interface: `Row`
  Sets a new unposted row, created in this transaction, to either STATUS_NEW or STATUS_INITIALIZED mode. Calling this method on a row in any other state will be a no-op.

  This method should be used to create a row and then to mark it temporary (STATUS_INITIALIZED) so that an app can use the created Row to fill UIs like Table UIs with valid default values for rows. Then when the Row values are updated, UIs should once again call this method to turn the Row into new (STATUS_NEW) state before any setAttribute calls on the Row, so that the changes are validated and posted.

  When a created row is in STATUS_NEW (by default) state and this method is called to turn the row in to STATUS_INITIALIZED, all updateable entities that this row comprises of, de=registers themselves from their respective transaction and validation managers. Assocation and ViewLink finders will not find/include these rows. Only the collection into which this row was inserted into will contain a reference to this row and when that collection is re-executed this row cannot be reached via the framework. To include this row again an app should call this method again with STATUS_NEW as the method-argument

  When this row is in STATUS_INITIALIZED state and this method is called with STATUS_NEW state then, this new row is added back into it's relevant transaction and validation manager and will then participate in validation, transaction cycles.

  Note that incase of composition if a master/detail hierarchy is being created with the intention of making them temporary (STATUS_INITIALIZED) then the logic should be: Create Master row, insert Master row into a collection, create Detail row insert detail row into a relevant collection, make detail row initialized, create/insert/change-to-initialized more detail rows and at the end set the master row as initialized.

  Specified by:
    `setNewRowState` in interface `Row`
  Parameters:
    `state` - This could be STATUS_NEW or STATUS_INITIALIZED.

### isDead

    public boolean isDead()

  Description copied from interface: `Row`
  An attempt to access a dead view row will lead to a DeadViewRowAccessException. Using this API method, client code can test the row state.
  Specified by:
    `isDead` in interface `Row`
  Returns:
    `true` if the row is dead.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3) B16005-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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