Home Page Icon
Home Page
Table of Contents for
Cover
Close
Cover
by Michal Bali
Drools JBoss Rules 5.X Developer's Guide
Drools JBoss Rules 5.X Developer's Guide
Table of Contents
Drools JBoss Rules 5.X Developer's Guide
Credits
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Programming Declaratively
Problems with traditional approaches
The solution
Advantages
Disadvantages
When not to use a rule engine
Drools
Summary
2. Writing Basic Rules
Rule basics
Executing rules
Rule syntax
Rule concepts
Variables in rules
Types
Comments
Package
Imports
Global variables
Functions
Type declarations
Dialect
Rule condition
The and element
The or element
The not element
The exists element
The eval element
The return element
The inline eval element
Nested accessors
Null-safe dereferencing operator
The keyword - this
Free form expressions
Working with collections
The contains (Not) operator
The memberOf (Not) operator
The from operator
Rule consequence
Rule attributes
The salience (priority) attribute
The no-loop attribute
Dialect
Summary
3. Validating
Banking domain model
Problem definition
Analysis
Design
Validation package
Object required type rules
Testing
Batch execution
Minimal account balance rule
Student account rule
Unique account number rule
Implementation
Validation service
Summary
4. Transforming Data
Process overview
Getting the data
Loading facts into the rule session
Writing transformation rules
Testing
Address normalization
Testing the findAddress rule
Unknown country
Currency conversion
One account allowed
Transformation results
Implementation of the data loading
Database setup
Project setup
iBatis configuration
Running iBatis
Alternative data loading
Summary
5. Creating Human-readable Rules
Domain-specific language
DSL as an interface
DSL for validation rules
File formats
The DSL file format
The DRL file format
The DSLR file format
DSL for multiple constraints in a condition
Named capture groups
The transformation functions
DSL for data transformation rules
The decision tables
Advantages of a decision table
Disadvantages of a decision table
Calculating the interest rate
Project setup
Testing
Comma separated values
Rule templates
jBPM
Drools agenda
Methods for managing the rule execution order
The ruleflow-group attribute
Start event
End event
Script task
Rule task
Gateway — diverging
Gateway – converge
Example – defining an execution order
Rules
KnowledgeBase set up
Tests
Summary
6. Working with Stateful Session
StatefulKnowledgeSession
Validation using stateful session
Design overview
Stateful Validation Service
Integration testing
Logical assertions
Keeping the validation report up-to-date
The collect conditional element
collect
Serialization
Knowledge session recreation
Testing
Session serialization
Full session serialization
Summary
7. Complex Event Processing
CEP and ESP
Fraud detection
Problem description
Design and modeling
Fraud detection rules
Notification
Test configuration setup
Testing the notification rule
Monitoring averageBalanceQuery
Testing the averageBalanceQuery
Two large withdrawals
Testing the twoLargeWithdrawals rule
Sequence of increasing withdrawals
Average balance test
Looping prevention – property reactive
Testing the sequenceOfIncreasingWithdrawals rule
High activity
Testing the highActivity rule
Summary
8. Defining Processes with jBPM
Loan approval service
Model
Loan approval process
Invalid loan application form
E-mail work item
Error event
Test setup
Testing the Validated? node's otherwise branch
The size of the loan
Test for a small loan
Rating Calculation
Subprocess
Subprocess diagram
Rating a calculation subprocess test
Setting the rating using an on-exit action
Decisions on rating
Testing the Rating? node
The Transfer Funds work item
The work item definition
Work item registration
Work item handler
Work item handler registration
Testing the transfer work item
Human task
Test for the human task
Final approval
Test for the Approve Event node
Banking service
Disadvantages of a process
Summary
9. Building a Sample Application
Users
Architecture
Technologies used
Additional Drools projects used
Libraries used
Design
Configuration
JPA annotations for domain objects
JPA configuration
Spring framework configuration
Web application setup
Deployment
Repositories
Validation
Services
Transactions
Presentation layer
Localized messages
Customer save form controller
The Complex Event Processing service
Loan approval
The Loan Request form
Process persistence
Task list
Transactions
Working on a task
Problem 1 – joinTransaction
Problem 2 – processing does not continue
Loan approval event
Summary
10. Testing
Writing unit tests for rules
Rule integration testing
Rule acceptance testing
Creating a test scenario
Running a test scenario
Running all test scenarios
Static analysis of rules
Troubleshooting techniques
Event listeners
Debugging
jBPM
Debugging rule conditions
Source of generated classes
Summary
11. Integrating
Dynamic KnowledgeBase loading
KnowedgeAgent
External artifact building
Building with Ant
Drools Camel server
Interest rate calculation example
The server
The client
Spring framework integration
Standards
Summary
12. Learning about Performance
Rete algorithm
Node types
The Rete node
EntryPointNode
ObjectTypeNode
AlphaNode
LeftInputAdapterNode
TerminalNode
Example 1 – inserting a fact
BetaNode
Example 2 – inserting a fact
More complex example
EvalConditionNode and FromNode
Retracting or modifying a fact
Initial fact
Node sharing
Example
Node indexing
The AlphaNode indexing
Computation complexity
The BetaNode indexing
Example
Left and right unlinking
Summary
A. Setting Up the Development Environment
Environment setup
Dependencies and their licenses
B. Creating Custom Operators
Summary
C. Dependencies of Sample Application
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Next
Next Chapter
Table of Contents
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset