Blog Posts BPMN DMN

Calling Java from DMN

Blog: Drools & jBPM Blog

Decision Model and Notation (DMN) is designed to catch the crucial business logic which affects decisions. It’s not meant to be a replacement for a general purpose programming language. FEEL is a powerful expression, but it is on purpose designed to be an expression language and not an imperative language to avoid bringing in the DMN unnecessary complexities which should be addressed somewhere else.

For example, the "french amortization method" is widely used in the financial industry, however it does not make a lot of sense to implement it in DMN.

Why not? Because, it’s a fixed algorithm not subject to change, the implementation is already available somewhere else and more importantly business users don’t want to change that logic. Whereas, It’s likely that business users want to adjust the algorithm parameters based on the customer features: eventually, this part of the logic is eligible to be designed in a DMN.

In short, at the design stage you have to decide what you need to implement in Java (or another language) and what you need to implement in DMN. The input data of a decision can be pre-processed by an application logic, the same applies to the output data which can be enriched or used by a complex algorithm.

In some cases, complex data manipulation may be required within a decision, which is difficult to implement in FEEL but easy to write in Java.

Inside DMN, you can call a static method of a Java class. The Function call can happen inside a Context or in Business Knowledge Model, in essence:

  1. Click in the corner and switch from FEEL to JAVA
Select Java
  1. Define the Fully Qualified Name of the Java Class
  1. Define the method signature.
  1. Define the parameter list.

Here the final outcome:

Java function

Pay attention: in Java a string is a class, so you have to type the fully qualified name: java.lang.String.

In the following video, a step by step tutorial using Kogito DMN:

References

The post Calling Java from DMN appeared first on KIE Community.

Leave a Comment

Get the BPI Web Feed

Using the HTML code below, you can display this Business Process Incubator page content with the current filter and sorting inside your web site for FREE.

Copy/Paste this code in your website html code:

<iframe src="https://www.businessprocessincubator.com/content/calling-java-from-dmn/?feed=html" frameborder="0" scrolling="auto" width="100%" height="700">

Customizing your BPI Web Feed

You can click on the Get the BPI Web Feed link on any of our page to create the best possible feed for your site. Here are a few tips to customize your BPI Web Feed.

Customizing the Content Filter
On any page, you can add filter criteria using the MORE FILTERS interface:

Customizing the Content Filter

Customizing the Content Sorting
Clicking on the sorting options will also change the way your BPI Web Feed will be ordered on your site:

Get the BPI Web Feed

Some integration examples

BPMN.org

XPDL.org

×