EntityRules
The entityRules section allows you to create your business rules logic using an entity.
This is useful, for example, for treating or setting values for the properties of an entity before its persistence, among other needs.
This rule type doesn't depend on a context and execution order and can be used in one or more service, if needed.
Fields
An entityRule contains the following fields to be defined:
Name
The name of entityRule to be created.
Requirements Rules:
- Is Required;
- Must not be a Reserved Keyword;
- Must start with a letter;
- Must contains only letters, numbers and the underline char ('_');
- Max length of 50 chars
Example:
1 2 |
|
Type
The type of rule to be created.
Possible types are:
- SetPropertyValue: Allows set default values to the current entity properties. When this type is used, it is necessary to fill the SetPropertyValueParams field, as defined below.
Requirements Rules:
- Is Required;
- Must be an Allowed valid type, according to the types informed above
Example:
1 2 3 |
|
EntityName
The name of business entity to which rule will be applied.
Requirements Rules:
- Is Required;
- The name must exist in Entities list in the current model;
- See Entity section for more details.
Example:
1 2 3 4 |
|
SetPropertyValueParams
The list of default values and properties that will be assigned to the entity linked to that business rule.
Requirements Rules:
- Must be filled out only for the SetPropertyValue type.
- Each item on list must follows rules as specified in SetPropertyValueParam
Example:
1 2 3 4 5 6 7 8 9 |
|
Complete Example
See below for a complete example, containing all the properties for the EntityRules section.
1 2 3 4 5 6 7 8 |
|