com.isomorphic.datasource

## Class ValidationContext

- java.lang.Object
- - java.util.AbstractMap
  - - java.util.HashMap
    - - com.isomorphic.datasource.ValidationContext

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map

      public class ValidationContext
      extends java.util.HashMap

  Provides access to the context of validation process, which may vary depending on the circumstances where validation is performed.

  `DSRequest` and `RequestContext` availability notes:

  - Both DSRequest and RequestContext will be available for "validate", "add", "update" (and possible future types) dataSource operations and for BatchUploader requests if they are executed in a context of servlet request.
  - DSRequest without RequestContext will be available in same cases as above if executed manually on the server-side, for example from DMI.
  - Neither of these will be available in case of Component XML schema validation and mass import of records.

  Note that only documented APIs are supported.

  See Also:
    Serialized Form

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DSRequest` | `getDSRequest()` Returns `DSRequest` that issued this validation request.
    `RequestContext` | `getRequestContext()` Returns `RequestContext` if validation is performed in the context of a servlet request.
    `void` | `setResultingValue(java.lang.Object value)` Sets the resulting value for the validated field.

- - ### Method Detail

    - #### getDSRequest

          public DSRequest getDSRequest()

      Returns `DSRequest` that issued this validation request.
      Returns:
        `DSRequest` instance or `null`.

    - #### getRequestContext

          public RequestContext getRequestContext()

      Returns `RequestContext` if validation is performed in the context of a servlet request.
      Returns:
        `RequestContext` instance or `null`.

    - #### setResultingValue

          public void setResultingValue(java.lang.Object value)

      Sets the resulting value for the validated field. If validation is successful this value will replace original value in the record.

      If multiple validators are configured for the field, once you set the resulting value it will be passed as value for the next validator in chain. Note that `record` validation method parameter will hold the original value, but only until validation chain for this field is finished. When validation of the next field will start the original value will no longer be available.

      Parameters:
        `value` - New value to replace the original value.