O'Reilly logo

Drools JBoss Rules 5.0 Developer's Guide by Michal Bali, Bogdan Brinzarea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Validation package

Before writing our first validation rule, the domain model must be imported. The following three global objects will be used:

  1. Report for storing messages.
  2. Factory for creating messages.
  3. Banking inquiry service for information lookup. It contains one method for testing if an account number is unique—boolean isAccountNumberUnique(Account account) (We won't define and implement this service in this book).

This information goes into validation.drl (rules will be gradually added into this file as we'll be implementing them).

package droolsbook.validation; import org.drools.runtime.rule.RuleContext; import droolsbook.bank.model.*; import droolsbook.bank.service.*; global ValidationReport validationReport; global ReportFactory reportFactory; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required