Integration Model
A point is enabled in Kerno where attribute values included in the template can be transformed.
The transformer class will receive the entire object and must return that same object with the attribute values transformed as desired and needed.
It is not possible to add a new attribute or remove one already contained in the object; in such a case the execution will fail. Only the value of an attribute can be modified; if any other parameter is modified, the execution will fail.
Input and Output Interfaces
The input and output DTO is the same, com.anjana.core.customers.model.EntityFormDTO, and is available in the public library customers-lib.
Within this DTO there is the entityAttributes property, which contains a list of AttributeDefinitionDTO. In this second DTO, transformations can be made on the value property. The remaining attributes cannot be modified but may be useful for the transformation that needs to be performed.
For more information about the DTOs used, refer to the API documentation by searching for the mentioned DTO or review the ANNEX with screenshots of that same documentation.
Configuration
The following configurations must be made in the Kerno configuration, whether YAML or any other format.
anjana:
...
transformation:
enabled: true
className: com.anjana.inventory.example.DescriptionCalculation
jarLocation: "/opt/inventory-interceptor/inventory-interceptor-example.jar"
-
enabled: To enable attribute transformation
-
className: to specify the package and class chosen to perform transformations
-
jarLocation: the exact location (including the jar name) of the artifact containing the interceptor
Available Artifacts
Library
To generate or edit a new Interceptor, the provided library will be used:
<dependency>
<groupId>com.anjana.core</groupId>
<artifactId>customers-library</artifactId>
<version>5.0.0</version>
</dependency>
Example Interceptor
A base interceptor is provided for use or modification; the sources of this example artifact will be provided upon customer request. It is located in the ‘releasesmvn’ repository of the provided artifactory under the path: com/anjana/inventory/interceptor/inventory-interceptor-example/
The example interceptor includes the following classes:
-
IARiskSurvey which contains an example of risk calculation for an AI questionnaire
-
className: com.anjana.inventory.example.IARiskSurvey
-
-
DescriptionCalculation which makes a “DUMMY” modification to the object’s description
-
className: com.anjana.inventory.example.DescriptionCalculation
-
ANNEX: DTOS