5.2 Adding Business Logic
The application business logic for the application is placed in the implementation tree. There is an implementation tree for each Processing
Unit and by default is called 'impl'. It can be found directly below the processing unit project.
Each implementation class has a number of hooks into which business logic can be added. They are:
- Imports - any additional imports needed for the implementation code.
- Methods - any business logic that needs to be added to methods, either modelled directly, such as on a service;
or generated from artefacts in the model, such as an action.
- Additional Code - any additional code to be added to the class
For each of the hooks there is a beginning-comment and an end-comment, between which the implementation code must be placed.
For example the imports comment is shown below.
/* imports uid:actions@2c64cc93-d1bf-44d5-bfb8-8: ... extra imports go below this comment*/
/* imports end:actions@2c64cc93-d1bf-44d5-bfb8-8: ... extra imports go above this comment*/
|
The diagram below shows the implementation code for the LicenceService.java, which shows all the hooks for adding business logic.
Note also that as the service is called asynchronously there is an async method into which business logic can be added.
Each beginning-comment and end-comment is based on the uid of the element within the model that drives the generation of this snippet of code.
Any text contained within the comments is preserved. Therefore the comments should not be removed nor amended.
Even if the model is altered, such as the renaming of the method, or changing the signature, the code within the comments will be preserved.
Once the implementation code is added the system can be rebuilt, in the same ways as it was initially built. The implementation code will be
compiled.
|