Building blocks for Business rules
Business rules define functional behaviour of your application. Business rules can be implemented by defining helpers, user groups and permissions.
You can use the following helpers:
- Calculation helpers
- Lookup helpers
- Field trigger helpers
- Class trigger helpers
- Validation helpers
- Action helpers
Calculation helpers
In many cases the value of a field is dependent on values in other fields. Calculations are helpers that determine a value of a field, based on the value of other fields. Calculations are like formulas in a spreadsheet. Examples:
- straightforward calculations, like adding the values of two fields.
- a velocity script containing a complex calculation.with if-then-else rules
In all cases, a calculation always results in a single value for a single field. Calculations are always applied automatically in the application engine on all refelevant records. A field with a calculation can never be edited manually by the user.
Lookup list helpers
If a lookup list on a field is not a static list and can be created directly from a foreign class, you can use a lookup list helper.
Field trigger helpers
Field triggers are fired when the value of a field changes, usually by user input. The field trigger can update the content of other fields, but also change the modified field itself. Examples:
- conversion of all input to upper case
- a velocity script that updates another field in the same record.
Field triggers differ from calculations since the fields that are effected by a field trigger can be editable. So users can still modify these fields. Calculated fields are always read-only.
Class trigger helpers
Class triggers are litte procedures that are activated when a record is created, saved or deleted. Examples:
- an email is sent when data is inserted in the database
- history is logged when data is deleted from the database
Validation helpers
Validations are data quality checks applied when data is saved in the database. When data does not meet the validation rules, the data are not saved and error messages appear on the page. Examples:
- a birth date has to be in the past
- the start date has to be before the end date
Action helpers
Actions are operations that can be started by the end user, usually by clicking a button.
Class actions are actions that can be executed by a button on a class manager page. It can be any type of action, but usually an action uses a dialog with the user. Class actions can also be scheduled with the job scheduler. Examples:
- Export data from the database
- Send an email to all persons in the database
Session actions are actions that can be executed from the main menu of an application. An action uses a dialog with the user. Session actions can also be scheduled with the job scheduler. Session actions can also be called from outside the application with direct urls. Examples:
- link to a velocity page
- unsubscribe from a newsletter
- implementing a web service
User Groups
User groups define groups of users of your application. There are three types of user groups:
- anonymous
Anonymous users do not have to be identified. - identified
Identified users have to logon to the application, usually with a login name and password combination - super
Super users are identified users who can generally perform more actions and access more data than normal users.
Permissions
For every individual user you want your application to be as relevant as possible. The application should show permitted data, and offer allowed functions. The easiest way to implement this is, is by using user groups. For all user groups, you can define the permission of classes, fields and actions and the relevance of triggers.