The ListValidator determines whether an attribute value is in a given list of values. The list can be either a list of literal values, the results of a SQL query, or the results of a view object query.
The method validateValue gets the list either by executing a SQL query or by executing a view object query, and then searches the list for the value. If the value is found, validateValue returns true.
The supported operators are:
In
Not In
The following table describes the ways that the list can be created:
|
Type |
Description |
|
Literal value |
The list is created by providing one or more literal values to compare. |
|
Query result |
The list is created by executing a SQL query using a custom view object. The values are defined by the first column returned by the query. In both ListValidator and CompareValidator, attributes from the entity object being validated can be used as bind variables, for example, "SELECT UNIQUE loc FROM dept WHERE loc = %Loc%", where Loc is an attribute on the entity object being validated and thus has a method getLoc defined on it. |
|
View object attribute |
The list is created by executing the query for a predefined view object. Choose the view object from the tree structure. |