Book Image

Mastering JBoss Drools 6

By : Mariano De Maio, Mauricio Salatino, Esteban Aliverti
Book Image

Mastering JBoss Drools 6

By: Mariano De Maio, Mauricio Salatino, Esteban Aliverti

Overview of this book

Mastering JBoss Drools 6 will provide you with the knowledge to develop applications involving complex scenarios. You will learn how to use KIE modules to create and execute Business Rules, and how the PHREAK algorithm internally works to drive the Rule Engine decisions. This book will also cover the relationship between Drools and jBPM, which allows you to enrich your applications by using Business Processes. You will be briefly introduced to the concept of complex event processing (Drools CEP) where you will learn how to aggregate and correlate your data based on temporal conditions. You will also learn how to define rules using domain-specific languages, such as spreadsheets, database entries, PMML, and more. Towards the end, this book will take you through the integration of Drools with the Spring and Camel frameworks for more complex applications.
Table of Contents (18 chapters)
Mastering JBoss Drools 6
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Drools syntactic sugar


Drools provides all sorts of special syntactic features. As much as we'd like, all of them won't fit in this book and more features are added constantly. Some of them, however, come in very handy when having to define our rules in a simple and comprehensive manner. We'll discuss the top three of these extra features, as follows:

  • Nested accessors for the attributes of our types

  • Inline casts for attributes of our types

  • Null-safe operators

Nested accessors

Nested accessors allow us to simplify our conditions when we have to define conditions on nested beans. Using parentheses, it allows us access the nested properties without having to redeclare the path to get to them. Let's see the following example to fully understand it:

OrderLine( item.cost < 30.0, item.salePrice < 25.0 )

In the previous condition, we're filtering order lines that have an item with a cost under 30 and a sale price under 25. We could simplify the expression using nested accessors, as follows:

OrderLine...