Library JSON
stateModelLibrary.json typically contains all the JSON parameters that are necessary to take the request through its end-to-end cycle. It consists of the following four high-level JSON parameter types:
The naming convention stateModelLibrary.json can be changed as per the implementation team's convenience but the same has to be specified in the startup listener registry class from the framework side.
- Evaluators - Evaluators are classes that can be used to check if a given rule evaluates to true or false for the current transaction's data. To add a custom evaluator class, do the following steps:
- In the evaluator section of the stateModelLibrary.json, include the custom class as an object and provide the required id, image path, and class path.
- ICanvasRuleEvaluator must be implemented for the custom class and the following methods must be modified as instructed:
- Override the getName() method to return the id provided in the JSON file.
- evaluate()Â method must return the Boolean value for custom evaluator.
- Activities - Activities are classes that perform a certain task. It must implement ICanvasActivity. Each activity may or may not be associated with an instruction class to carry their assigned actions on the request. See Activities for more details. To add a custom activity, do the following steps:
- In the activity section of the stateModelLibrary.json, include the custom class as an object and provide the required id, image path, and class path.
- ICanvasActivity must be implemented for the custom class and the following methods must be modified as instructed:
- Override the getName() method to return the id provided in the JSON file.
- evaluate()Â method must return the Boolean value for custom evaluator.
- Error handlers - These handlers are used to identify any error state that occurs within a request cycle and respond with the relevant error message. Currently, the error handlers that are within Request Modeler are:
- invalidState
- invalidAction
- exception
- States - States are the various stages of the request cycle such as INIT, RA etc. It uses all the three parameter types that are mentioned above to process each request and complete its cycle. More custom stages can be added to the JSON file by using/creating the relevant evaluators/activities/error handlers and associating them with the respective states.