Class UserConfigurableValidator

All Implemented Interfaces:
Serializable, Validator

public class UserConfigurableValidator extends MultipleConditionsValidator
A user-configurable validator. Several aspects of this validator can be configured via properties in the configuration.properties file found in the GateIn configuration directory (${gatein.conf.dir}). The validator supports several configurations that can be activated when a validator instance is created by passing it the name of the configuration to be activated. A configuration is created by adding an entry in configuration.properties using the KEY_PREFIX prefix followed by the name of the configuration, a period '.' and the name of the validation aspect to modify.
Currently supported validation aspects, where {configuration} is a configuration's name:
  • KEY_PREFIX{configuration}.length.min: the minimal length of the validated field
  • KEY_PREFIX{configuration}.length.max: the maximal length of the validated field
  • KEY_PREFIX{configuration}.regexp: the regular expression to which the validated field must conform
  • KEY_PREFIX{configuration}.format.message: a message to display providing details about the format of values the regular expression allows in case the validated field doesn't conform to it
Currently used configurations in the code are defined by the USERNAME and GROUPMEMBERSHIP names.
Author:
Chris Laprun
See Also:
  • Field Details

  • Constructor Details

    • UserConfigurableValidator

      public UserConfigurableValidator()
    • UserConfigurableValidator

      public UserConfigurableValidator(String configurationName, String messageLocalizationKey)
    • UserConfigurableValidator

      public UserConfigurableValidator(String configurationName, String messageLocalizationKey, Boolean exceptionOnMissingMandatory)
    • UserConfigurableValidator

      public UserConfigurableValidator(String configurationName)
  • Method Details

    • validate

      public void validate(UIFormInput uiInput) throws Exception
      Specified by:
      validate in interface Validator
      Overrides:
      validate in class MultipleConditionsValidator
      Throws:
      Exception
    • validate

      protected void validate(String value, String label, org.exoplatform.web.application.CompoundApplicationMessage messages, UIFormInput uiInput)
      Specified by:
      validate in class MultipleConditionsValidator
    • getConfigurationNames

      public static final Set<String> getConfigurationNames()
      Provides a way to query what are the currently known policies from the configuration files. For instance, if an entry exists as gatein.validators.mycompanypasspolicy.regexp , then there's a configuration called "mycompanypasspolicy", and this will be returned by this method. Note: the built-in configurations are not returned by this method, only the custom-provided ones.
      Returns:
      a set containing all known configuration key names.