Package com.simplicite.util
Class FieldValidation
- java.lang.Object
-
- com.simplicite.util.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 patternstatic 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 evaluationstatic 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 modelstatic java.util.List<java.lang.String>
validateFilter(ObjectField f, ObjectDB obj, Processus process, Grant g)
Field common validation, return errors such as :
- ERR_SEARCHREQUIRED: mandatorystatic 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 modelstatic 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
-
-
-
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 valueobj
- optional objectprocess
- optional processg
- 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 definitionval
- value to testobj
- 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 definitionval
- value to testobj
- 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 filterobj
- optional objectprocess
- optional processusg
- 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
- fieldobj
- objectrow
- a record of list (or null to use a selected record)context
- Context- Returns:
- Field value
-
-