3.8« Business objects » and « business rules » modeling
3.8« Business objects » and « business rules » modeling
« Business objects » are the « Business Rules » (BR) containers. BRs are a set of short and concise business rules. These rules are represented by operations in « Business Object » (BO) class inheriting from an entity class. Operations may come with an OCL (Object Constraint Language) description.
3.8.1BO modeling and applicable rules
Design items
Operation parameters and return type.
Applicable stereotypes list and modeling rules
- Ocl_sql
This operation describes a SQL request in OCL.
- Ocl_impl
This operation describes its implementation in OCL.
- formula
This operation describes its implementation in Java or .NET.
- setter
This operation is used to change an object or a data type value.
- getter
This operation is used to get back an object or a data type value.
- attach
Used to add an element to a list (association). The method has only one parameter of « List » or « business object » type. The return type must be void.
- detach
Used to remove an element from a list (association). The method has only one parameter of « List » or « business object » type. The return type must be void.
OCL use for business rules modeling
The OCL may be used to interact on various levels. « Business Rules » may also be used to define SQL specific requests.
OCL constraints list
Body, definition of a condition body executed in the BR.
Rules
- A « business object » must inherit from an entity.
- Every operation must be stereotyped.
- Every operation has a return type.
- A « setter » stereotyped method must have only one parameter, a « void » return type, and its name must start with ‘set’ followed by an uppercase letter.
- A « getter » stereotyped method shall not have any parameters, shall not have a « void » return, and its name must start with ‘get’ followed by an uppercase letter.
- A business object name must be the same as the entity it inherits from followed by the ‘BO’ suffix.
- A business object may only inherit from one entity at a time.
NULL parameter
The check_null stereotype is used to tell the application to automatically check whether a method parameter is null. If the concerned parameter is null, an ApplicationException is thrown. The Message exception can be specified into the « message » attribute.
Examples
- Ocl_sql
This operation describes a SQL request in OCL.

Figure 1 «ocl sql» Applied Stereotype example

Figure 2 «ocl sql» Constraint example
- Ocl_impl
This operation describes its implementation in OCL.

Figure 3 «ocl impl» Applied Stereotype example

Figure 4 «ocl impl» Constraint example
- formula
This operation describes its implementation in Java or .NET.

Figure 5 « formula » Tag example
- setter
This operation is used to change an object or a data type value.

Figure 6 «setter» Applied Stereotype example
- getter
This operation is used to return an object or a data type value.

Figure 7 «getter» Applied Stereotype example
- attach
Used to add an element to a list (association). The method must have only one parameter of « List » or « business object » type. The return type must be void.

Figure 8 «attach» Applied Stereotype example
- detach
Used to remove an element from a list (association). The method must have only one parameter of « List » or « business object » type. The return type must be void.

Figure 9 «detach» Applied Stereotype example
- checkNull
Throws an exception if the associated parameter is null

Figure 10 «check_null» Tag example