SearchCriteriaBuilder() This object is not indended to be a *real* Query engine.
It is indended to be used with GUI to allow end users uppend WHERE clause to SELECT statement.
How it works?
This object is not indended to be a *real* Query engine.
It is indended to be used with GUI to allow end users uppend WHERE clause to SELECT statement.
How it works?
User would add Criteria
Criteria would have
List of fileds to search. User must select one of the fields
List of operators for each field (fieldOperators). You can specify which operators can be used with selected field. For example you can remove "LIKE" operator for numeric field
Some fields can have list of values to select from (fieldValues). Example: field "State" can have a drop-down control (combobox) with list of states
Boolean condition AND/OR. User must select one of them if there will be another Criteria
Use beforeBuildCriteria() in descendants to modify/validate user input
After user done buildCriteria() would generate WHERE clause, which would be added to pre-defined SELECT statement
To make it user-friendly fields, operators, etc. should have "display values" and "real values"
Example:
fields.add(new SomeObject("firstName", "First Name"));
fields.add(new SomeObject("lastName", "Last Name"));
fields.add(new SomeObject("state", "State"));
...