This webinar explores a best practice approach for the integration of
Business Process Models and Decision Modeling in Enterprise Architect.
Enterprise Architect 14 provides a tool suite
for dynamically executing simulating and exploring such behavioral models.
This webinar examines the mechanics of DMN and BPMN integration
via three unique examples.
The first example calculates Sales from two departments.
We demonstrate how to model a decision in Enterprise Architect.
Including building the DMN Diagram
and generating Java code based on that Decision Model.
We also model the underlying Business Process in Enterprise Architect,
which can user generated Java code to make appropriate decisions.
We use Enterprise Architect to simulate the expected Delivery Cost
of furniture based on Weight and Price.
We run a simulation that looks at a 100 Delivery Costs,
using randomly generated values for both the Cost and the Weight.
We use a new Model Pattern feature in Enterprise Architect 14
to build a completed example based on the DMN Specification from the OMG.
This example illustrates how multiple decisions
can be modeled and connected within Enterprise Architect
To establish complex Decisions with multiple inputs and paths.
You can even edit Customer Data,
make comparisons and see
which path is taken through the Business Process
based on different Customer Data.
We shall begin by using Enterprise Architect to model a Business Process.
To calculate the total Sales from each Department.
In this case Department A and B.
The Decision Process for calculating Sales
and the underlying Business Process are modeled separately.
So if the Decision Process for calculating
aggregate Sales ever changes.
- Extra Departments are added,
or you decide to only take 80% of Department A sales.
It does not impact the underlying Business Process.
Switching to Enterprise Architect.
On screen we have created a simple Business Process, to calculate Sales.
Containing a Start Event and End Event in a single Activity
Place the Business Process Simulation Artifact on screen,
so we can simulate the Sales Calculation
using the BPM Execution Engine
When you open the Simulation.
Scenario Parameters are displayed on the right of screen.
The first thing we need to do is set the expression language to Java.
Please also note the JDK and JRE are set.
As you need in Java to run the Simulation.
It's important to note the BPSim is the Sparx Systems implementation,
that allows the simulation of a BPMN Model.
I'm now going to create a Class Diagram to display
the Simulation Artifact in the DMN Configuration Artifact.
However it could appear on either diagram.
Note, I am drawing a Dependency Connector
between the two Artifacts.
This is important because it tells Enterprise Architect,
that a "dependency" exists between the two models.
Meaning the Decision will feed into the Business Model
thus creating our Integration.
Our single BKM or Business Knowledge Model is a literal expression,
that is used to add two numbers together.
The next step is to generate our Java code
from our Decision Model.
Double-click the DMN Simulation Artifact to get started.
Specify the Path, Namespace and Module Name.
Then press "Generate" to build the Java code based on our Decision.
The System Output Window indicates,
the DMN Module has been successfully generated.
Press the "View" button to examine
the code in the Enterprise Architect Code Editor.
The code is quite simple
- Functionality basically adds two numbers stored as doubles
Now let's switch focus and return to our Business Process.
We can now instruct Enterprise Architect to use the Java Code,
we've just produced.
The DMN is designed to model repeatable decisions.
Decisions that you make more than once
At anytime we can alter the decision-making process
and generate new code.
In the Business Process I'm adding a trigger count,
which is used by the BPSim Execution Engine.
I also add two properties to store the Sales of Department A and
the Sales of Department B.
I'm adding a trigger count, used by the BPSim Execution Engine.
I'm adding Sales Values for the various Departments.
Department A had sales of 25,
while Department B had sales of 30.
I'm using two constants,
but you can also add statistical distributions
and random numbers if relevant.
On the activity entitled Calculate Sales
I want to add the Sales of the two departments.
I only want to use a code from my Decision Model to undertake this work.
I've created a new property called "Sum A B".
In order to generate the value for the Sum.
I'm going to enter an expression.
Simply press "ctrl + space" to use "Intellisense"
to automatically complete the expression.
You can see I've selected Artifact1.AddTwoNums.
Using the Java code we can add the two numbers function
to return a meaningful result.
You can see I am passing the parameters
for Department A and B to this function.
We can now execute or run our Simulation to see the result.
As we step through the Simulation
to see how the results are calculated.
You can see the sales from Department A and B are listed
as 25 and 30 respectively.
Finally you can see the sum of 55 is calculated accordingly.
Our BPMN Model has used Java code
from our DMN Model to calculate a decision and
produce a meaningful result.
This integration between Business Process Modeling
and Decision Model Notation
is a powerful feature found in Enterprise Architect 14
What is the benefit of modeling a Business Process
and DMN separately in Enterprise Architect
If you combine Decisions with a Business Process in a single diagram.
You often get a messy complex diagram with far too many gateways.
By modeling Decision making process separately -
to the Business Process.
You get improved focus in clarity
It also allows you to edit a Decision
without impacting the underlying Business Process.
Every time the rule changes for decision-making -
in frequent flyer programs,
you can change, how the rules are implemented.
But you do not have to change the underlying Business Process.
This in turns allows you to simplify the Business Process,
making it easier to read and follow.
You can eliminate any unnecessary gateways
and focus on getting the process right.
The integrated solution takes the
Decisions from one model and feeds them into your Business Process.
You can reuse the process on multiple projects
or test different decisions to find the optimal approach.
Enterprise Architect allows you to automate decisions to produce behavioral code.
Let's take a look at another example
to see the benefits of integration and simulation.
Our next example uses a simple Business Process designed to calculate
the Cost of Delivery based on the Price and Weight of the Furniture.
To generate the furniture price and weight
we use a random statistical distribution.
This allows us to simulate the Decision a hundred times,
which may be based on, that typical number of customers
of a furniture shop can manage in a single day.
The BPMN Model on-screen uses code from our Decision Model.
You can see the function,
"Delivery Cost Calculator" is currently displayed on screen.
If we switch to our DMN diagram.
We can generate out the code for our simple Decision,
that calculates a Cost of Delivery based on Furniture Price and Weight.
Each rule has been listed in our Java code,
which could even be reused for web-based application.
Where customers could get a quote for their delivery price.
The DMN Module has once again been successfully generated
and produced 99 lines of Java code.
Our Decision Model uses a simple table to calculate the Delivery Cost.
For example - if the price of the furniture is between 200 and 300$
and the Weight is less than 10 kilos.
the Delivery Cost is only 5$,
as shown on screen in rule number 10.
The U at the top of the table identifies,
the table can only produce a single unique result.
Once again we have established a dependency relationship
between our Decision Model and the corresponding Business Process.
Now we can execute the Simulation.
You will note that the Trigger Count is displayed in red as 100.
In other words we've calculated the Delivery Cost for
100 deliveries in a matter of seconds.
We can now step through the Simulation to observe the results.
If the price is 209$ and the weight is 10 kilos
then the Delivery Cost is 5$ based on rule number 10.
Now if we step through the Simulation again.
You'll notice the token ID changes to 01 indicating
a new customer come along.
This time the delivery cost is 20$ as outlined by row 8 of our rules.
The next cost is $40 based on Row 3.
The Model shown in this example could easily be adapted to
parcels, packages or any other relevant product transported by a courier.
It illustrates how Enterprise Architect 14 can use a simple table
to develop a complex set of rules.
So what are the benefits of using this approach
within Enterprise Architect.
The Delivery Calculator is a Business Process been modeled in BPMN.
The BPMN is easy to read and does not contain any gateways or complex logic.
The prices are in a simple table,
both IT and Business People can read and understand.
You can test different decisions and rules to determine the optimum profitability.
Decisions are easily changed without
impacting the underlying Business Process Model.
The code can be reused
even in a web-based application to generate Delivery Quotes.
Providing benefits beyond the Simulation itself -
in Automation and Software reuse.
For our final example we need to apply a "Perspective"
From "BPSim". Select: "Apply Perspective"
Select the "Completed Model Pattern"
which is BPMN integrate with DMN Complete Example.
The Model shown on screen come directly
from the DMN specification from the OMG.
Generate the Java code after you've selected
a Model, Path, Namespace, a Module Name.
Once again the code has been successfully generated.
There are 702 lines of code,
that have been produced from our complex model.
You can validate the DMN
to ensure that the module is compiled successfully,
and is valid.
Once again we have a relationship established between our BPSim Artefact
and our DMN Simulation Configuration Artifact.
One of the advantages of this particular example is,
that you can bring up the Business Process Model and you can see,
what path has been taken through the Business Process Model.
The token is displayed in red once again.
So for customer number 0,
you can see that Strategy is equal to "through"
So the attribute and value are displayed on the right hand side
I'm gonna bring up a notes window.
Another advantage of the completed example is,
that you can take the Applicant Data.
You can modify it and -
instantly run the simulation and see
what impact those changes have on the overall simulation.
Now if I step through the simulation using the new data.
You can see a different path through the Business Process has been highlighted.
Once again if I step through.
I can see that this time
Strategy is equal to "Bureau" and routing is equal to "Decline".
This real-time analysis of a Business Process is really quite valuable.
The other advantages is you can see,
Enterprise Architect has modeled multiple Decisions
and shown you how,
these Decisions can have some kind of hierarchical structure employed.
Some of the advantages; you have the ability to quickly edit customer Data
and run a Simulation.
For more information about DMN, BPMN, or Enterprise Architect14
Please visit www.sparxsystems.com/ea14