Class FieldValidation


  • public class FieldValidation
    extends java.lang.Object
    Common field validation and evaluation
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.regex.Pattern DECIMAL_PATTERN
      Decimal pattern
      static java.util.regex.Pattern INTEGER_PATTERN
      Integer pattern
    • Constructor Summary

      Constructors 
      Constructor Description
      FieldValidation()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String eval​(ObjectField f, ObjectDB obj, int context, java.lang.String[] row)
      Calculated field evaluation
      static java.util.List<java.lang.String> validate​(ObjectField f, ObjectDB obj, Processus process, Grant g)
      Field common validation, return errors such as:
      - ERR_REQUIRED: mandatory
      - ERR_NUMBER: not numeric
      - ERR_DATE: invalid date
      - ERR_TIME: invalid time
      - ERR_DATETIME: invalid datetime
      - ERR_FLOAT: not a decimal
      - ERR_REGEXP: not match expression
      - ERR_ENUM: code not exists in list of values/states model
      static java.util.List<java.lang.String> validateFilter​(ObjectField f, ObjectDB obj, Processus process, Grant g)
      Field common validation, return errors such as :
      - ERR_SEARCHREQUIRED: mandatory
      static java.util.List<java.lang.String> validateType​(ObjectField f, java.lang.String val, ObjectDB obj, Processus process)
      Field type validation, return errors such as:
      - ERR_NUMBER: not numeric
      - ERR_DATE: invalid date
      - ERR_TIME: invalid time
      - ERR_DATETIME: invalid datetime
      - ERR_FLOAT: not a decimal
      - ERR_REGEXP: not match expression
      - ERR_ENUM: code not exists in list of values/states model
      static java.util.List<java.lang.String> validateType​(ObjectField f, java.lang.String val, ObjectDB obj, Processus process, Grant g)
      Field type validation, return errors such as:
      - ERR_NUMBER: not numeric
      - ERR_DATE: invalid date
      - ERR_TIME: invalid time
      - ERR_DATETIME: invalid datetime
      - ERR_FLOAT: not a decimal
      - ERR_REGEXP: not match expression
      - ERR_ENUM: code not exists in list of values/states model
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INTEGER_PATTERN

        public static final java.util.regex.Pattern INTEGER_PATTERN
        Integer pattern
      • DECIMAL_PATTERN

        public static final java.util.regex.Pattern DECIMAL_PATTERN
        Decimal pattern
    • Constructor Detail

      • FieldValidation

        public FieldValidation()
    • Method Detail

      • validate

        public static java.util.List<java.lang.String> validate​(ObjectField f,
                                                                ObjectDB obj,
                                                                Processus process,
                                                                Grant g)
        Field common validation, return errors such as:
        - ERR_REQUIRED: mandatory
        - ERR_NUMBER: not numeric
        - ERR_DATE: invalid date
        - ERR_TIME: invalid time
        - ERR_DATETIME: invalid datetime
        - ERR_FLOAT: not a decimal
        - ERR_REGEXP: not match expression
        - ERR_ENUM: code not exists in list of values/states model
        Parameters:
        f - field definition and current value
        obj - optional object
        process - optional process
        g - user rights
        Returns:
        error list or null
      • validateType

        public static java.util.List<java.lang.String> validateType​(ObjectField f,
                                                                    java.lang.String val,
                                                                    ObjectDB obj,
                                                                    Processus process)
        Field type validation, return errors such as:
        - ERR_NUMBER: not numeric
        - ERR_DATE: invalid date
        - ERR_TIME: invalid time
        - ERR_DATETIME: invalid datetime
        - ERR_FLOAT: not a decimal
        - ERR_REGEXP: not match expression
        - ERR_ENUM: code not exists in list of values/states model
        Parameters:
        f - field definition
        val - value to test
        obj - optional object (implements the validation method of external type)
        process - optional processus (implements the validation method of external type)
        Returns:
        error list or null
      • validateType

        public static java.util.List<java.lang.String> validateType​(ObjectField f,
                                                                    java.lang.String val,
                                                                    ObjectDB obj,
                                                                    Processus process,
                                                                    Grant g)
        Field type validation, return errors such as:
        - ERR_NUMBER: not numeric
        - ERR_DATE: invalid date
        - ERR_TIME: invalid time
        - ERR_DATETIME: invalid datetime
        - ERR_FLOAT: not a decimal
        - ERR_REGEXP: not match expression
        - ERR_ENUM: code not exists in list of values/states model
        Parameters:
        f - field definition
        val - value to test
        obj - optional object (implements the validation method of external type)
        process - optional processus (implements the validation method of external type)
        g - user rights
        Returns:
        error list or null
      • validateFilter

        public static java.util.List<java.lang.String> validateFilter​(ObjectField f,
                                                                      ObjectDB obj,
                                                                      Processus process,
                                                                      Grant g)
        Field common validation, return errors such as :
        - ERR_SEARCHREQUIRED: mandatory
        Parameters:
        f - field definition with current filter
        obj - optional object
        process - optional processus
        g - user rights
        Returns:
        error list or null
      • eval

        public static java.lang.String eval​(ObjectField f,
                                            ObjectDB obj,
                                            int context,
                                            java.lang.String[] row)
        Calculated field evaluation
        Parameters:
        f - field
        obj - object
        row - a record of list (or null to use a selected record)
        context - Context
        Returns:
        Field value