Business Components

Class ViewCriteria


public class ViewCriteria
extends java.util.Vector

A list of row criteria for a View Object's WHERE clause.

The lengths of the ViewCriteriaRows in the list must all match the number of attributes in the View Object.

The following example of a user-defined function, demoCriteria uses several methods in the ViewCriteria and ViewCriteriaRow classes to create and populate criteria rows and to demonstrate "query-by-example". The printViewObject is a helper function that executes the View Object query and prints the results to the screen.

     public static void demoCriteria(ApplicationModule appMod) {

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

     // ViewCriteriaRow attribute name is case-sensitive.
     // ViewCriteriaRow attribute value requires operator and value.
     // Note also single-quotes around string value.
       vcRow.setAttribute("Job", "= 'MANAGER'");

       vcRow = vc.createViewCriteriaRow();
       vcRow.setAttribute("Sal", "> 2500");


     // Multiple rows are OR-ed in WHERE clause.
       System.out.println("Demo View Criteria");

     //Should print employees that are MANAGER or have Sal > 2500

     public static void printViewObject(ViewObject vo)   {
       // Execute the query, print results to the screen.
       while (vo.hasNext()) {
          Row row =;\
          String rowDataStr = "";

        // How many attributes (columns) is the View Object using?
          int numAttrs = vo.getAttributeCount();

       // Column numbers start with 0, not 1.
          for (int columnNo = 0; columnNo < numAttrs; columnNo++) {

          // See also Row.getAttribute(String name).
            Object attrData = row.getAttribute(columnNo);
            rowDataStr += (attrData + "\t");

JDeveloper 3.0
See Also:
Serialized Form

Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
Fields inherited from class java.util.AbstractList
Constructor Summary
ViewCriteria(ViewObject viewObject)
          Creates an empty view criteria object.
Method Summary
 ViewCriteriaRow createViewCriteriaRow()
          Creates a new criteria row as a ViewCriteriaRow object.
 int getAttributeIndexOf(java.lang.String name)
          Finds the column associated with an attribute name.
 ViewObject getViewObject()
          Gets the View Object that owns the view criteria.
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail


public ViewCriteria(ViewObject viewObject)
Creates an empty view criteria object.
viewObject - the owner of the ViewCriteria.
Method Detail


public ViewObject getViewObject()
Gets the View Object that owns the view criteria.
the ViewObject that contains the ViewCriteria.


public int getAttributeIndexOf(java.lang.String name)
Finds the column associated with an attribute name.
name - the column name.
a column index.


public ViewCriteriaRow createViewCriteriaRow()
Creates a new criteria row as a ViewCriteriaRow object. A ViewCriteriaRow object is an array for WHERE clause criteria.
a ViewCriteriaRow, an array for WHERE clause criteria.
See Also:

Business Components