Class ValidationContext

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap
com.isomorphic.datasource.ValidationContext
All Implemented Interfaces:
com.isomorphic.util.IDoNotAdapt, Serializable, Cloneable, Map

public class ValidationContext extends HashMap implements com.isomorphic.util.IDoNotAdapt
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:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns DSRequest that issued this validation request.
    Returns RequestContext if validation is performed in the context of a servlet request.
    void
    Sets the resulting value for the validated field.
  • Method Details

    • 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(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.