Customer Evaluation with declarative data model |
The data model at that time was built using JBDS and is nothing more than Java objects, a Person object and a Request object to be precise. These are then put into a single Java archive (jar) file and importing into the BRM project.
Declarative models
Many customers are interested in using the declarative data model, which is the data model hosted in your rules repository. You will not create Java object classes, instead you create your model using the BRM tooling guided editor.
Using a declarative model has some benefits:
- it reinforces that the model belongs to the knowledge base and not to the application.
- the model lifecycle is separate from your applications.
- your Java types can be enriched with rule specific annotations.
- when using imported Java archive (jar) files, they must be kept synchronized between the rules and the applications that use them, a declarative model does not.
Using the declarative model example project
The Quick Start documentation covers how to use the project to demonstrate the declarative model, but for ease of getting started:
- clone the project from https://github.com/eschabell/brms-customer-evaluation-demo/tree/v1.4
- add JBoss BRMS product, see installs/README
- run init.sh to setup project
- start JBoss BRMS server at with standalone.sh (in newly created target directory)
- import support/repository_export_declarative_model.zip into BRM at http://localhost:8080/jboss-brms
- build project and deploy
- run process from Business Central at http://localhost:8080/business-central and see server log.
You server log should play out something a lot like this:
16:49:24,047 INFO [stdout] (http-/127.0.0.1:8080-3) starting new transaction 16:49:26,555 INFO [stdout] (http-/127.0.0.1:8080-3) Entering Initialize Node 16:49:26,556 INFO [stdout] (http-/127.0.0.1:8080-3) There as no evaluation objects defined, adding default ones for demo purposes. 16:49:26,562 INFO [stdout] (http-/127.0.0.1:8080-3) Leaving Initialize Node 16:49:26,565 INFO [stdout] (http-/127.0.0.1:8080-3) Gateway: Qualify Age 16:49:26,565 INFO [stdout] (http-/127.0.0.1:8080-3) Gateway: Qualify Age 16:49:26,567 INFO [stdout] (http-/127.0.0.1:8080-3) Entering Adult Customer Node 16:49:26,568 INFO [stdout] (http-/127.0.0.1:8080-3) Detected and reporting valid request 16:49:26,569 INFO [stdout] (http-/127.0.0.1:8080-3) Set validRequest to: true 16:49:26,573 INFO [stdout] (http-/127.0.0.1:8080-3) Leaving Adult Customer Node 16:49:26,573 INFO [stdout] (http-/127.0.0.1:8080-3) Entering Finance Rules Node 16:49:26,585 INFO [stdout] (http-/127.0.0.1:8080-3) Leaving Finance Rules Node. 16:49:26,585 INFO [stdout] (http-/127.0.0.1:8080-3) Gateway: Decide Financial Status 16:49:26,585 INFO [stdout] (http-/127.0.0.1:8080-3) Determined request is valid, heading to Rich Customer Node 16:49:26,588 INFO [stdout] (http-/127.0.0.1:8080-3) Entering Rich Customer Node 16:49:26,588 INFO [stdout] (http-/127.0.0.1:8080-3) Detected and reporting valid request 16:49:26,588 INFO [stdout] (http-/127.0.0.1:8080-3) Customer has amount: 5000 in the bank. 16:49:26,589 INFO [stdout] (http-/127.0.0.1:8080-3) Leaving Rich Customer Node 16:49:26,589 INFO [stdout] (http-/127.0.0.1:8080-3) Process ended in End Rich Customer Node.
You can examine the different ways you need to interact with the declarative model by examining the process in the web designer:
- Initialize script task shows how to interact with process context variables and load our model with data.
- Gateways can be viewed by examining the exit transitions, they show interaction with the model.
- Adult Customer script task shows how facts are inserted into working memory using our declarative model.
I hope this demo helps in your understanding of the different ways our data model can be implemented in JBoss BRMS BPM projects.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.