Validation package

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

  • Report for storing messages.
  • Factory for creating messages.
  • Banking inquiry service for information lookup; this object contains one method for testing if an account number is unique, boolean isAccountNumberUnique(Account accout). We won't define and implement this service in this book.

We can now start creating our rule file, 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 ValidationReportvalidationReport; global ReportFactoryreportFactory; ...

Get Drools JBoss Rules 5.X Developer's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.