Eric D. Schabell has been working within software development since 1998 for many different organizations such as IBM, Radboud University Nijmegen, SNS Bank and smaller software companies. He has been involved in different roles within Open Source projects such as Sourcemage Linux, eGroupWare, DocConversion, cmlFramework and is still helping out in the JBoss jBPM project focusing as lead on the jBPM Migration project. Since 2009 he has been actively evangelising JBoss products and is a huge fan of OpenShift (PaaS). He is employed as JBoss Technology Evangelist for Red Hat, is a guest lecturer at the Radboud University Nijmegen and enjoys writing on various topics. Eric D. is a DZone MVB and is not an employee of DZone and has posted 74 posts at DZone. You can read more from them at their website. View Full User Profile

Red Hat JBoss BRMS - Adding a Declarative Data Model to the Customer Evaluation Demo

04.04.2013
| 1423 views |
  • submit to reddit

Previously I posted a demo of Business Process Management (BPM) integration with rules, using the JBoss Business Rules Management System (BRMS) product. This demo provided a look at both the developers JBoss Developer Studio (JBDS) IDE project and then the business user side with the project also in the Business Rules Manager (BRM) web tooling.

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.
Our declarative model in knowledge base.
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: 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.

 

Published at DZone with permission of Eric D. Schabell, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)