com.smartgwt.client.data

## Class AdvancedCriteria

- java.lang.Object
- - com.smartgwt.client.core.JsObject
  - - com.smartgwt.client.core.DataClass
    - - com.smartgwt.client.data.Criteria
      - - com.smartgwt.client.data.Criterion
        - - com.smartgwt.client.data.AdvancedCriteria

-     public class AdvancedCriteria
      extends Criterion

  AdvancedCriteria is a format for representing search criteria which may include operators on field values such as "less than", or may include sub-clauses such as several criteria applied to fields joined by an "OR" operator.

  Smart GWT DataSources can use AdvancedCriteria to search a list of `Record`s, and the Smart GWT Java Server can translate AdvancedCriteria to either SQL or Hibernate queries (Note: The server-side AdvancedCriteria handling feature is only available with the Power and Enterprise Editions of Smart GWT; the Pro Edition is limited to ordinary criteria handling on the server side).

  If the entire dataset is cached locally, Smart GWT can perform AdvancedCriteria filtering on the client, avoiding a server call.

  AdvancedCriteria objects can be created directly in java. For example:

        AdvancedCriteria criteria = new AdvancedCriteria(OperatorId.AND, new Criterion[]{
            new Criterion("salary", OperatorId.LESS_THAN, 8000),
            new AdvancedCriteria(OperatorId.OR, new Criterion[]{
                new Criterion("title", OperatorId.ICONTAINS, "Manager"),
                new Criterion("reports", OperatorId.NOT_NULL)
            })
        });

  In addition to building a raw AdvancedCriteria object as described above, the `DataSource.convertCriteria` and `DataSource.combineCriteria` methods may be used to create and modify criteria based on simple fieldName / value mappings.

  When passed to the Smart GWT Server, a server-side AdvancedCriteria instance (in the package com.isomorphic.criteria) can be retrieved from a DSRequest via com.isomorphic.datasource.DSRequest.getAdvancedCriteria(). These same AdvancedCriteria objects can be directly created server side, and applied to a DSRequest via setAdvancedCriteria().

  `RestDataSource`, the recommended way of integration with servers that are not running the Smart GWT Server Framework, defines a standard XML and JSON serialization of `AdvancedCriteria`.

  For other servers, you can translate `AdvancedCriteria` into whatever format is expected by the server, typically by implementing `DataSource.transformRequest`.

  The internal representation of AdvancedCriteria is a simple JavaScript structure, available via AdvancedCriteria.getJsObj():

        // an AdvancedCriteria
        {
            _constructor:"AdvancedCriteria",
            operator:"and",
            criteria:[
                // this is a Criterion
                { fieldName:"salary", operator:"lessThan", value:"80000" },
                { operator:"or", criteria:[
                    { fieldName:"title", operator:"iContains", value:"Manager" },
                    { fieldName:"reports", operator:"notNull" }
                  ]
                }
            ]
        }

  And an AdvancedCriteria can also be created from a JavaScriptObject. This makes AdvancedCriteria very easy to store and retrieve as JSON strings, using `JSONEncoder`. See `Criteria Editing` for information about editing AdvancedCriteria in a DynamicForm.

- - ### Field Summary

    - ### Fields inherited from class com.smartgwt.client.core.JsObject

      `jsObj`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AdvancedCriteria()`
    `AdvancedCriteria(Criterion c)`
    `AdvancedCriteria(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `AdvancedCriteria(OperatorId operator)`
    `AdvancedCriteria(OperatorId operator, Criterion[] criterias)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.Boolean value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.Boolean[] value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.util.Date value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.util.Date[] value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.util.Date start, java.util.Date end)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.Float value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.Float[] value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.Float start, java.lang.Float end)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.Integer value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.Integer[] value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.Integer start, java.lang.Integer end)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.Long value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.Long[] value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.Long start, java.lang.Long end)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.String value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.String[] value)`
    `AdvancedCriteria(java.lang.String fieldName, OperatorId operator, java.lang.String start, java.lang.String end)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static AdvancedCriteria` | `fromJSObject(com.google.gwt.core.client.JavaScriptObject jsObj)` Creates an AdvancedCriteria from a JavaScriptObject with the format described in `AdvancedCriteria`
    `static AdvancedCriteria` | `fromJSON(java.lang.String json)` Creates an AdvancedCriteria from a JSON String in the format described in `AdvancedCriteria`
    `static AdvancedCriteria` | `getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `void` | `setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `java.lang.String` | `toJSON()` Gets a JSON encoding of an AdvancedCriteria object

    - ### Methods inherited from class com.smartgwt.client.data.Criterion

      `addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, addCriteria, appendToCriterionList, buildCriterionFromList, getCriteria, getFieldName, getOperator, getValueAsBoolean, getValueAsDate, getValueAsFloat, getValueAsInt, getValueAsIntArray, getValueAsInteger, getValueAsString, getValueAsStringArray, markAdvancedCriteria, setFieldName, setOperator, unmarkAdvancedCriteria`

    - ### Methods inherited from class com.smartgwt.client.data.Criteria

      `addCriteria, addCriteria, addCriteria, addCriteria, asAdvancedCriteria, convertToCriteriaArray, getValues, isAdvanced`

    - ### Methods inherited from class com.smartgwt.client.core.DataClass

      `doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, getJsObj, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject`

    - ### Methods inherited from class com.smartgwt.client.core.JsObject

      `equals, hashCode, isCreated, setJsObj`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AdvancedCriteria

          public AdvancedCriteria()

    - #### AdvancedCriteria

          public AdvancedCriteria(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### AdvancedCriteria

          public AdvancedCriteria(Criterion c)

    - #### AdvancedCriteria

          public AdvancedCriteria(OperatorId operator,
                          Criterion[] criterias)

    - #### AdvancedCriteria

          public AdvancedCriteria(OperatorId operator)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.Integer value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.String value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.Float value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.util.Date value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.Boolean value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.Integer[] value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.String[] value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.Float[] value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.util.Date[] value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.Boolean[] value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.util.Date start,
                          java.util.Date end)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.Float start,
                          java.lang.Float end)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.Integer start,
                          java.lang.Integer end)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.Long value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.Long[] value)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.Long start,
                          java.lang.Long end)

    - #### AdvancedCriteria

          public AdvancedCriteria(java.lang.String fieldName,
                          OperatorId operator,
                          java.lang.String start,
                          java.lang.String end)

  - ### Method Detail

    - #### getOrCreateRef

          public static AdvancedCriteria getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### setJavaScriptObject

          public void setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)

      Overrides:
        `setJavaScriptObject` in class `Criterion`

    - #### fromJSObject

          public static AdvancedCriteria fromJSObject(com.google.gwt.core.client.JavaScriptObject jsObj)

      Creates an AdvancedCriteria from a JavaScriptObject with the format described in `AdvancedCriteria`
      Parameters:
        `jsObj` - the passed JavaScriptObject object
      Returns:
        AdvancedCriteria

    - #### fromJSON

          public static AdvancedCriteria fromJSON(java.lang.String json)

      Creates an AdvancedCriteria from a JSON String in the format described in `AdvancedCriteria`
      Parameters:
        `json` - the passed JSON string
      Returns:
        AdvancedCriteria

    - #### toJSON

          public java.lang.String toJSON()

      Gets a JSON encoding of an AdvancedCriteria object
      Returns:
        String A JSON string of this AdvancedCriteria object