Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.ld.filter
Class FilterXQuery

    java.lang.Object
      |
      +--com.bea.ld.filter.FilterXQuery

public class FilterXQuery
extends java.lang.Object
implements java.io.Serializable

This class enables client-side control of data service function results through filtering and ordering without having to use complex XQuery syntax. A filter object is passed to Liquid Data (along with the name of a function in a data service), which processes the filters/orderby list and generates the XQuery. This capability is helpful in cases where a data service returns results that contain nested objects and you want to get different views of the objects based on certain conditions.

For example, if the returned document is CUSTOMERS/CUSTOMER/ORDER, where:

- CUSTOMERS: the top-level document element.
- CUSTOMER: a repeatable sequence inside CUSTOMERS.
- ORDER: a repeatable sequence inside CUSTOMER.

There are four possible ways to view large orders (say CUSTOMER/ORDER/ORDER_AMOUNT > 1000)

1. All CUSTOMER objects but only large ORDER objects
2. Only CUSTOMER object which has at least one large order and view all ORDER objects for such CUSTOMER
3. Only CUSTOMER object which has at least one large order and view only Large ORDER objects (basically 1 & 2)
4. Only CUSTOMER object which has all the ORDER as large order (i.e., ORDER_AMOUNT > 1000)

Instead of writing XQuery for all these cases you just pass this object as parameter when executing the data service function.

1. All CUSTOMER objects but Only Large ORDER objects
`FilterXQuery filter = new FilterXQuery();
filter.addFilter("CUSTOMERS/CUSTOMER/ORDER","CUSTOMERS/CUSTOMER/ORDER/ORDER_AMOUNT",">","1000");
`

2. Only CUSTOMER object which has at least one large order and view All ORDER objects for such CUSTOMER

`FilterXQuery filter = new FilterXQuery();
filter.addFilter("CUSTOMERS/CUSTOMER","CUSTOMERS/CUSTOMER/ORDER/ORDER_AMOUNT",">","1000");
`

3. Only CUSTOMER object which has at least one large order and view only Large ORDER objects ( basically 1 & 2)

`FilterXQuery filter = new FilterXQuery();
filter.addFilter("CUSTOMERS/CUSTOMER","CUSTOMERS/CUSTOMER/ORDER/ORDER_AMOUNT",">","1000");
filter.addFilter("CUSTOMERS/CUSTOMER/ORDER","CUSTOMERS/CUSTOMER/ORDER/ORDER_AMOUNT",">","1000");
`

4. Only CUSTOMER object which has all the ORDER as large order (i.e. ORDER_AMOUNT > 1000)

`FilterXQuery filter = new FilterXQuery();
filter.addFilter("CUSTOMERS/CUSTOMER","CUSTOMERS/CUSTOMER/ORDER/ORDER_AMOUNT",">","1000",true);
`

See Also:
  `addFilter(String appliesTo, String field, String operator, String value)`, `createFilter(String field, String operator, String value, boolean everyChild)`, Serialized Form

Field Summary
`static java.lang.String` | `AND`
`static java.lang.String` | `ASCENDING`
`static java.lang.String` | `BEA_SQL_LIKE`
`static java.lang.String` | `DESCENDING`
`static java.lang.String` | `EQUAL`
`static java.lang.String` | `GREATER_THAN`
`static java.lang.String` | `GREATER_THAN_EQUAL`
`static java.lang.String` | `LESS_THAN`
`static java.lang.String` | `LESS_THAN_EQUAL`
`static java.lang.String` | `MATCHES`
`static java.lang.String` | `NOT`
`static java.lang.String` | `NOT_EQUAL`
`static java.lang.String` | `OR`

Constructor Summary
`FilterXQuery()`

Method Summary
`void` | `addFilter(java.lang.String appliesTo, Filter filter)`
`void` | `addFilter(java.lang.String appliesTo, Filter f1, Filter f2, java.lang.String op)`
`void` | `addFilter(java.lang.String appliesTo, java.lang.String field, java.lang.String operator, java.lang.String value)` Creates a filter and adds it to the list of filters.
`void` | `addFilter(java.lang.String appliesTo, java.lang.String field, java.lang.String operator, java.lang.String value, boolean everyChild)`
`void` | `addOrderBy(java.lang.String appliesTo, java.lang.String field, java.lang.String sort)` Adds the sort crieteria to the object specified by the appliesTo argument.
`Filter` | `createFilter(Filter f1, Filter f2, java.lang.String operator)` This method will create a compound filter.
`Filter` | `createFilter(java.lang.String field, java.lang.String operator, java.lang.String value)` Creates a filter that can be later applied to any of the objects in the hierarchy of the field path, e.g., either to CUSTOMER or ORDER if the field is CUSTOMER/ORDER/TOTAL_ORDER_AMOUNT.
`Filter` | `createFilter(java.lang.String field, java.lang.String operator, java.lang.String value, boolean everyChild)`
`ExternalVariables` | `getExternalVariables()` gets the ExternalVariables
`void` | `setExternalVariables(ExternalVariables v)` set the ExternalVariables containing the list of external variables which can be used in filter/limit.
`void` | `setLimit(java.lang.String appliesTo, java.lang.String max)` Associates the maximum number of entries to return of the element specified by the appliesTo argument.

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

Field Detail

### LESS_THAN

    public static final java.lang.String LESS_THAN

### GREATER_THAN

    public static final java.lang.String GREATER_THAN

### LESS_THAN_EQUAL

    public static final java.lang.String LESS_THAN_EQUAL

### GREATER_THAN_EQUAL

    public static final java.lang.String GREATER_THAN_EQUAL

### EQUAL

    public static final java.lang.String EQUAL

### NOT_EQUAL

    public static final java.lang.String NOT_EQUAL

### AND

    public static final java.lang.String AND

### OR

    public static final java.lang.String OR

### NOT

    public static final java.lang.String NOT

### BEA_SQL_LIKE

    public static final java.lang.String BEA_SQL_LIKE

### MATCHES

    public static final java.lang.String MATCHES

### ASCENDING

    public static final java.lang.String ASCENDING

### DESCENDING

    public static final java.lang.String DESCENDING

Constructor Detail

### FilterXQuery

    public FilterXQuery()

Method Detail

### createFilter

    public Filter createFilter(java.lang.String field,
                               java.lang.String operator,
                               java.lang.String value)

  Creates a filter that can be later applied to any of the objects in the hierarchy of the field path, e.g., either to CUSTOMER or ORDER if the field is CUSTOMER/ORDER/TOTAL_ORDER_AMOUNT.

  Parameters:
    `field` - Path relative to document element.
    `operator` - This is an operator ( <,<=,>,>=,=,!=) supported by XQuery directly on field (XAPTH).
    `value` - Value against which the field will be compared. Provide necessary quotes if required.
  Returns:
    return the filter object. This filter can be applied to any of the object in the hierarchy of the field.

### createFilter

    public Filter createFilter(java.lang.String field,
                               java.lang.String operator,
                               java.lang.String value,
                               boolean everyChild)

  Parameters:
    `everyChild` - This flag is false by default. This is applicable only if the field belongs to one of the child objects in the hierarchy and this filter is applied to the parent object. If this flag is true it will return parent object only if the filter condition is satisfied by all the children of the parent object.
  See Also:
    `createFilter(String field, String operator, String value)`

### createFilter

    public Filter createFilter(Filter f1,
                               Filter f2,
                               java.lang.String operator)

  This method will create a compound filter.

  Parameters:
    `f1` - Filter object created by any of the createFilter Method.
    `f2` - Filter object created by any of the createFilter Method.
    `operator` - Logical operator (and, or, not). For not operator, f2 will not be used and can be set to null.
  Returns:
    - A Filter Object.

### addFilter

    public void addFilter(java.lang.String appliesTo,
                          java.lang.String field,
                          java.lang.String operator,
                          java.lang.String value)

  Creates a filter and adds it to the list of filters.

  Parameters:
    `appliesTo` - String XPath (relative to document element) to which the filter is applied.
  See Also:
    for details

### addFilter

    public void addFilter(java.lang.String appliesTo,
                          java.lang.String field,
                          java.lang.String operator,
                          java.lang.String value,
                          boolean everyChild)

  See Also:
    `addFilter(String appliesTo, String field, String operator, String value)`, `createFilter(String field, String operator, String value, boolean everyChild)`

### addFilter

    public void addFilter(java.lang.String appliesTo,
                          Filter f1,
                          Filter f2,
                          java.lang.String op)

  See Also:
    `addFilter(String appliesTo, String field, String operator, String value)`, `createFilter(Filter f1, Filter f2, String operator)`

### addFilter

    public void addFilter(java.lang.String appliesTo,
                          Filter filter)

  See Also:
    `addFilter(String appliesTo, String field, String operator, String value)`, `createFilter(Filter f1, Filter f2, String operator)`

### addOrderBy

    public void addOrderBy(java.lang.String appliesTo,
                           java.lang.String field,
                           java.lang.String sort)

  Adds the sort crieteria to the object specified by the appliesTo argument.

  Parameters:
    `appliesTo` - String XPath relative to document Element
    `field` - String fieldName (relative (not the full path) to 'appliesTo' object)
    `sort` - sort criteria (ascending/descending)

### setLimit

    public void setLimit(java.lang.String appliesTo,
                         java.lang.String max)

  Associates the maximum number of entries to return of the element specified by the appliesTo argument.

  Parameters:
    `appliesTo` - String XPath ( relative to document element) to which the filter is applied.
    `max` - $variable declared in ExternalVariables OR int value specified in string e.g. "2"

### setExternalVariables

    public void setExternalVariables(ExternalVariables v)

  set the ExternalVariables containing the list of external variables which can be used in filter/limit.

  Parameters:
    `v` - ExternalVariables

### getExternalVariables

    public ExternalVariables getExternalVariables()

  gets the ExternalVariables

  Returns:
    the ExternalVariables object

Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 Bea Systems Inc. All Rights Reserved.