com.smartgwt.client.types

## Enum ClientUniquenessCheckCondition

- java.lang.Object
- - java.lang.Enum<ClientUniquenessCheckCondition>
  - - com.smartgwt.client.types.ClientUniquenessCheckCondition

- All Implemented Interfaces:
    ValueEnum, java.io.Serializable, java.lang.Comparable<ClientUniquenessCheckCondition>

      public enum ClientUniquenessCheckCondition
      extends java.lang.Enum<ClientUniquenessCheckCondition>
      implements ValueEnum

  For a validator of type `isUnique` in a component listing multiple records such as a ListGrid, can we use the component's fetched data set to check for uniqueness? Used by `Validator.checkComponentData`.

  It is possible to check for uniqueness against a ListGrid's data set and "shortcut" the validation process in a couple of cases:

  - If the grid has a complete data set from the DataSource, we can determine whether a record is unique or not by examining that data without ever querying the DataSource.
  - Even if the grid is only displaying a partial data set from the DataSource, if the user-entered value collides with another loaded record's value, we can assert that the value is not unique.
    However, if the data set is not complete we can only shortcut validation when we find a collision. If we don't find a loaded record with a matching value, the DataSource will still need to be queried to definitively determine whether the value is unique.
  Note that component data will only be consulted if the component is bound to a dataSource and has its data object set to a `ResultSet`. Additionally, with the exception of the special `"forceBoth"` setting, component data will only be used to determine uniqueness if the following conditions are met:
  - The default fetch operation was used (e.g listGrid.fetchOperation has not been set)
  - The data object was automatically created by the component `while fetching data`, as opposed to manually instantiated by the application developer. This is because with a hand-created ResultSet, you could provide any set of records you want, so we don't know if they are an exact match for the default fetch operation on the DataSource.
  Also note that, as with any validator understood by the server, uniqueness checking will always be enforced on the server as part of a save operation once data is committed.
  The `checkComponentData` setting simply allows developers to optimize performance by catching duplicate values on the client before the save operation is sent to the server, or avoid hitting the server at all during `validation without saving` in cases where this is possible.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `BOTH` If the component has a `complete data cache` that meets the conditions outlined above, uniqueness checking will be performed against this data set only rather than querying the dataSource to check for uniqueness.
    `EARLYFAILONLY` If the component has a partial or complete data cache that meets the conditions outlined above, check for another existing record in the cache with an identical field value.
    `FORCEBOTH` [Advanced Setting] As with `checkComponentData:"both"`, if a component has a `complete data cache`, uniqueness checking will be peformed against this data set instead of querying the dataSource.
    `NONE` Never consult cached component data.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getValue()`
    `static ClientUniquenessCheckCondition` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static ClientUniquenessCheckCondition[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

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

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### NONE

          public static final ClientUniquenessCheckCondition NONE

      Never consult cached component data. Uniqueness checking will be performed directly against the dataSource data set only.

      If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "none".

    - #### EARLYFAILONLY

          public static final ClientUniquenessCheckCondition EARLYFAILONLY

      If the component has a partial or complete data cache that meets the conditions outlined above, check for another existing record in the cache with an identical field value. If one is found, the validator will fail on the client. If no match is found, standard validation will proceed against the dataSource's full data set.

      If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "earlyFailOnly".

    - #### BOTH

          public static final ClientUniquenessCheckCondition BOTH

      If the component has a `complete data cache` that meets the conditions outlined above, uniqueness checking will be performed against this data set only rather than querying the dataSource to check for uniqueness.

      If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "both".

    - #### FORCEBOTH

          public static final ClientUniquenessCheckCondition FORCEBOTH

      [Advanced Setting] As with `checkComponentData:"both"`, if a component has a `complete data cache`, uniqueness checking will be peformed against this data set instead of querying the dataSource. However unlike `checkComponentData:"both"`, the `"forceBoth"` setting enables this behavior even if the component's data object has a custom fetch operation specified, or was created explicitly by application code instead of being automatically created as part of the standard `fetchData()` flow.

      If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "forceBoth".

  - ### Method Detail

    - #### values

          public static ClientUniquenessCheckCondition[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (ClientUniquenessCheckCondition c : ClientUniquenessCheckCondition.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static ClientUniquenessCheckCondition valueOf(java.lang.String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
        `java.lang.NullPointerException` - if the argument is null

    - #### getValue

          public java.lang.String getValue()

      Specified by:
        `getValue` in interface `ValueEnum`