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 but with the attribute values transformed as desired and needed.
A new attribute cannot be added, nor can an existing one be removed from the object; if this occurs, execution will fail. Only the value of an attribute can be modified; if any other parameter is modified, execution will fail.
Input and Output Interfaces
The input and output DTO is the same, com.anjana.core.customers.model.EntityFormDTO, and it is available in the public library customers-lib.
Inside this DTO is the entityAttributes property; this property contains a list of AttributeDefinitionDTO. In this second DTO, transformations can be made to the value property. The rest of the attributes cannot be modified but may be useful for the transformation that needs to be done.
For more information about the DTOs used, check the API documentation by searching for the mentioned DTO, or check the ANNEX with screenshots of that same documentation
Configuration
The following configurations must be made in the Kerno configuration, whether YAML or of any other kind.
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 which package and class are 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>6.1.0</version>
</dependency>
Sample Interceptor
A base interceptor is provided for use or modification; the sources of this sample artifact will be provided upon client request. It is located in the 'releasesmvn' repository of the provided artifactory under the path: com/anjana/inventory/interceptor/inventory-interceptor-example/
The sample interceptor includes the following classes:
-
IARiskSurvey which has an example of risk calculation for an AI questionnaire
-
className: com.anjana.inventory.example.IARiskSurvey
-
-
DescriptionCalculation which makes a "DUMMY" modification of the object's description
-
className: com.anjana.inventory.example.DescriptionCalculation
-
ANNEX: DTOS