Home Page Icon
Home Page
Table of Contents for
C. Dependencies of Sample Application
Close
C. Dependencies of Sample Application
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
Prev
Previous Chapter
C. Dependencies of Sample Application
Index
A
abortWorkItem method /
Work item handler
accept method /
Session serialization
AccountService class /
Global variables
AccountUpdatedEvent /
Design and modeling
activation-group attribute /
Methods for managing the rule execution order
agenda-group attribute /
Methods for managing the rule execution order
AlphaNode /
AlphaNode
AlphaNode indexing
about /
The AlphaNode indexing
computation complexity /
Computation complexity
AND /
Gateway — diverging
and element /
The and element
Apache Ant
used, for external artifact building /
Building with Ant
Approve Event node /
Final approval
architecture /
Architecture
arrays /
Dialect
assertNotFired method /
Testing the twoLargeWithdrawals rule
Audit log /
Running a test scenario
averageBalanceQuery
monitoring /
Monitoring averageBalanceQuery
testing /
Testing the averageBalanceQuery
B
balance property /
Rule basics
banking domain model
about /
Banking domain model
UML diagram /
Banking domain model
entities /
Banking domain model
aacount types /
Banking domain model
validation requirements /
Problem definition
analysis /
Analysis
design /
Design
banking service
about /
Banking service
bankingService.approveLoan method /
Loan approval event
bean properties /
Dialect
beforeNodeTriggered method /
jBPM
BetaNode
about /
BetaNode
fact, inserting /
Example 2 – inserting a fact
BetaNode indexing
about /
The BetaNode indexing
example /
Example
BliP /
Drools
BPMN /
Loan approval process
BRMS /
Drools
,
Rule acceptance testing
buildCustomer method /
Transformation results
Business logic /
Business logic
C
CEP /
Drools
,
Architecture
about /
CEP and ESP
coercion /
Dialect
collections
about /
Working with collections
contains (Not) operator /
The contains (Not) operator
memberOf (Not) operator /
The memberOf (Not) operator
From operator /
The from operator
comments /
Comments
configuration
JPA annotations, for domain objects /
JPA annotations for domain objects
JPA configuration /
JPA configuration
spring framework configuration /
Spring framework configuration
web application setup /
Web application setup
deployment /
Deployment
contains (Not) operator /
The contains (Not) operator
createContext method /
Average balance test
createKnowledgeBase method /
Executing rules
createKnowledgeSession method /
Knowledge session recreation
createSerializableMarshaller method /
Full session serialization
customerMap parameter /
Transformation results
D
.drl file /
The DRL file format
.dslr file format /
The DSLR file format
data
obtaining /
Getting the data
facts, loading into rule session /
Loading facts into the rule session
database setup /
Database setup
data loading implementation
about /
Implementation of the data loading
database setup /
Database setup
project setup /
Project setup
iBatis configuration /
iBatis configuration
iBatis, running /
Running iBatis
alternative data loading /
Alternative data loading
data transformation
process overview /
Process overview
data transformation rules
for DSL /
DSL for data transformation rules
decision tables
about /
The decision tables
advantages /
Advantages of a decision table
disadvantages /
Disadvantages of a decision table
interest rate, calculating /
Calculating the interest rate
rule template /
Rule templates
development environment
setting up /
Environment setup
dependencies /
Dependencies and their licenses
licenses /
Dependencies and their licenses
dialect /
Dialect
,
Dialect
dispose() method /
StatefulKnowledgeSession
dispose method /
Tests
DRL file format /
The DRL file format
Drools
about /
Drools
modules, Drools Expert /
Drools
modules, Drools Fusion /
Drools
modules, jBPM /
Drools
modules, Drools Guvnor /
Drools
development environment /
Environment setup
Drools Camel server
about /
Drools Camel server
interest rate calculation example /
Interest rate calculation example
Drools Fusion /
Drools Fusion
Drools serialization
class figure /
Session serialization
identity mode /
Session serialization
full serialization mode /
Session serialization
JPA serialization mode /
Session serialization
DSL
about /
Domain-specific language
as interface /
DSL as an interface
for validation rules /
DSL for validation rules
file formats /
File formats
for multiple constraints in a condition /
DSL for multiple constraints in a condition
named capture groups /
Named capture groups
transformation functions /
The transformation functions
data transformation rules /
DSL for data transformation rules
DSL file format /
The DSL file format
DSLR file format /
The DSLR file format
Dynamic KnowledgeBase loading
about /
Dynamic KnowledgeBase loading
KnowledgeAgent /
KnowedgeAgent
E
Eclipse plugin /
jBPM
EDA
about /
CEP and ESP
enterprise service bus (ESB) /
Testing the notification rule
EntryPointNode /
EntryPointNode
equals method /
Rule basics
error event
about /
Error event
test setup /
Test setup
otherwise branch, testing /
Testing the Validated? node's otherwise branch
ESP
about /
CEP and ESP
ETL /
Alternative data loading
EvalConditionNode /
EvalConditionNode and FromNode
eval element /
The eval element
Event node /
Final approval
executeRules method /
Stateful Validation Service
,
The collect conditional element
exists element /
The exists element
external artifact
building /
External artifact building
building, Apache Ant used /
Building with Ant
F
file formats
DSL file format /
The DSL file format
DRL file format /
The DRL file format
DSLR file format /
The DSLR file format
final approval
about /
Final approval
Approve Event node test /
Test for the Approve Event node
findAddress rule /
Testing the findAddress rule
fireAllRules method /
Executing rules
FIT /
Rule acceptance testing
fraud detection
about /
Fraud detection
business requirements /
Problem description
modelling /
Design and modeling
design /
Design and modeling
rules /
Fraud detection rules
fraud detection rules
notification /
Notification
averageBalanceQuery, monitoring /
Monitoring averageBalanceQuery
two large withdrawals /
Two large withdrawals
twoLargeWithdrawals rule, testing with /
Testing the twoLargeWithdrawals rule
increasing withdrawal sequence /
Sequence of increasing withdrawals
high activity /
High activity
FromNode /
EvalConditionNode and FromNode
From operator /
The from operator
full serialization mode /
Session serialization
functions /
Functions
G
getAge() method /
The return element
getAverageBalance method /
Testing the averageBalanceQuery
getConversionToEurFrom function /
Currency conversion
getFactHandle method /
Design overview
getKnowledgeRuntime() method /
Setting the rating using an on-exit action
getNodeInstance() method /
Setting the rating using an on-exit action
getTasksAssignedAsPotentialOwner method /
Test for the human task
global variables /
Global variables
H
hashCode method /
Rule basics
helper method /
Integration testing
high activity
about /
High activity
testing /
Testing the highActivity rule
human task
about /
Human task
test /
Test for the human task
I
iBatis configuration /
iBatis configuration
identity mode /
Session serialization
imports /
Imports
increasing withdrawal sequence
about /
Sequence of increasing withdrawals
average balance test /
Average balance test
looping, prevention /
Looping prevention – property reactive
@propertyReactive annotation /
Looping prevention – property reactive
sequenceOfIncreasingWithdrawals rule, testing /
Testing the sequenceOfIncreasingWithdrawals rule
initialize method /
Testing the highActivity rule
inline eval element
about /
The inline eval element
nested accessors /
Nested accessors
insertLogical method /
Keeping the validation report up-to-date
insertOrUpdateRecursive method /
Stateful Validation Service
,
Testing
integration testing
about /
Integration testing
interest rate calculation, decision tables
about /
Calculating the interest rate
project setup /
Project setup
testing /
Testing
CSV /
Comma separated values
interest rate calculation example
about /
Interest rate calculation example
server /
The server
client /
The client
interface implementations /
Implementation
invalid loan application form
about /
Invalid loan application form
e-mail work item /
E-mail work item
error event /
Error event
J
Java.lang.System property /
Types
Java Persistence API (JPA) /
Test for the human task
jBPM
about /
jBPM
Drools agenda /
Drools agenda
rule execution order, managing /
Methods for managing the rule execution order
ruleflow-group attribute /
The ruleflow-group attribute
execution order, defining /
Example – defining an execution order
rules /
Rules
KnowledgeBase set up /
KnowledgeBase set up
test setup /
Tests
/
jBPM
JPA serialization mode /
Session serialization
JSP /
Technologies used
K
@key annotation /
Type declarations
KISS
about /
StatefulKnowledgeSession
KnowledgeAgent /
KnowedgeAgent
KnowledgeBase partitioning
about /
The KnowledgeBase partitioning
parallel execution /
Parallel execution
L
layer design /
Design
LeftInputAdapterNode /
LeftInputAdapterNode
left unblinking /
Left and right unlinking
LHS /
Rule basics
loan approval
about /
Loan approval
Loan Request form /
The Loan Request form
process persistence /
Process persistence
task list /
Task list
task, working on /
Working on a task
,
Problem 1 – joinTransaction
,
Problem 2 – processing does not continue
event /
Loan approval event
Loan approval process
about /
Loan approval process
diagram /
Loan approval process
invalid loan application form /
Invalid loan application form
loan size /
The size of the loan
Rating Calculation /
Rating Calculation
rating decision /
Decisions on rating
Transfer Funds work item /
The Transfer Funds work item
human task /
Human task
final approval /
Final approval
banking service /
Banking service
disadvantages /
Disadvantages of a process
disadvantag=disadvantages /
Disadvantages of a process
Loan approval service
about /
Loan approval service
model /
Model
loan size
about /
The size of the loan
small loan test /
Test for a small loan
loanSourceAccount method /
Test setup
logical assertions
about /
Logical assertions
LostCardEvent /
Design and modeling
M
Marshaller instance /
Full session serialization
memberOf (Not) operator /
The memberOf (Not) operator
MVC /
Web application setup
mvel /
Dialect
N
nested accessors /
Nested accessors
no-loop attribute /
The no-loop attribute
node indexing
about /
Node indexing
AlphaNode indexing /
The AlphaNode indexing
BetaNode indexing /
The BetaNode indexing
node sharing
about /
Node sharing
example /
Example
node types, Rete algorithm
about /
Node types
Rete node /
The Rete node
EntryPointNode /
EntryPointNode
ObjectTypeNode /
ObjectTypeNode
AlphaNode /
AlphaNode
LeftInputAdapterNode /
LeftInputAdapterNode
TerminalNode /
TerminalNode
BetaNode /
BetaNode
complex example /
More complex example
EvalConditionNode /
EvalConditionNode and FromNode
FromNode /
EvalConditionNode and FromNode
not element /
The not element
notification
about /
Notification
test configuration setup /
Test configuration setup
rule, testing /
Testing the notification rule
null-safe bean navigation /
Dialect
O
ObjectTypeNode /
ObjectTypeNode
OMG /
Loan approval process
OR /
Gateway — diverging
or element /
The or element
org.drools.builder.KnowledgeBuilder /
Executing rules
org.drools.FactHandle /
Stateful Validation Service
org.drools.KnowledgeBase /
Executing rules
org.drools.runtime.process.ProcessContext /
Setting the rating using an on-exit action
org.drools.runtime.StatefulKnowledgeSession /
Executing rules
,
StatefulKnowledgeSession
org.drools.runtime.StatelessKnowledgeSession /
Object required type rules
org.drools.spi.KnowledgeHelper /
Validation package
P
@propertyReactive annotation /
Looping prevention – property reactive
packages
about /
Package
imports /
Imports
global variables /
Global variables
functions /
Functions
type declarations /
Type declarations
dialect /
Dialect
POJO /
Rule basics
presentation layer, validation
about /
Presentation layer
localized messages /
Localized messages
customer save form controller /
Customer save form controller
Complex Event Processing service /
The Complex Event Processing service
processCustomer method /
Transformation results
Process Instances view /
jBPM
Process Loan node /
Test for the human task
Process Virtual Machine (PVM) /
Setting the rating using an on-exit action
projections /
Dialect
project setup /
Project setup
R
Rating? node /
Testing the Rating? node
Rating Calculation
about /
Rating Calculation
subprocess, benefits /
Subprocess
subprocess diagram /
Subprocess diagram
subprocess test /
Rating a calculation subprocess test
setting, on-exit action used /
Setting the rating using an on-exit action
rating decision
about /
Decisions on rating
Rating? node, testing /
Testing the Rating? node
readObject method /
Knowledge session recreation
,
Full session serialization
ResourceFactory.newClassPathResource (basicRule.drl) method /
Executing rules
respositories /
Repositories
REST /
Drools Camel server
Rete algorithm
about /
Rete algorithm
node types /
Node types
fact, retracting /
Retracting or modifying a fact
fact, modifying /
Retracting or modifying a fact
initial fact /
Initial fact
Rete node /
The Rete node
returned object /
Running iBatis
return element /
The return element
Return values /
Dialect
RHS /
Rule basics
RIF
about /
Standards
RightInputAdapterNode node /
More complex example
right unblinking /
Left and right unlinking
rule acceptance testing
about /
Rule acceptance testing
test scenario, creating /
Creating a test scenario
test scenario, running /
Running a test scenario
all test scenario, running /
Running all test scenarios
rule attributes
about /
Rule attributes
salience (priority) strategy /
The salience (priority) attribute
no-loop attribute /
The no-loop attribute
dialect /
Dialect
rule basics
about /
Rule basics
rules, executing /
Executing rules
rule concepts
about /
Rule concepts
rule variables /
Variables in rules
types /
Types
comments /
Comments
rule condition
about /
Rule condition
and conditional element /
The and element
or element /
The or element
not element /
The not element
exists element /
The exists element
eval element /
The eval element
return element /
The return element
inline eval element /
The inline eval element
rule conditions
null-safe dereferencing operator /
Null-safe dereferencing operator
this /
The keyword - this
free form expressions /
Free form expressions
rule consequence
about /
Rule consequence
KnowledgeSession /
Rule consequence
ruleflow-group attribute
about /
The ruleflow-group attribute
start event /
Start event
end event /
End event
script task /
Script task
rule task /
Gateway — diverging
gateway, diverging /
Gateway — diverging
gateway, converging /
Gateway – converge
rule integration testing
about /
Rule integration testing
RuleML
about /
Standards
rules /
Rules
unit test, writing /
Writing unit tests for rules
static analysis /
Static analysis of rules
rule syntax
about /
Rule syntax
concepts /
Rule concepts
package /
Package
rule conditions /
Rule condition
rule consequence /
Rule consequence
rule attributes /
Rule attributes
S
salience attribute /
Methods for managing the rule execution order
salience strategy /
The salience (priority) attribute
sample application
users /
Users
architecture /
Architecture
technologies used /
Technologies used
business logic /
Business logic
design /
Design
configuration /
Configuration
respositories /
Repositories
validation /
Validation
loan approval /
Loan approval
sequenceOfIncreasingWithdrawals rule /
Testing the sequenceOfIncreasingWithdrawals rule
serialization
about /
Serialization
Knowledge session, recreating /
Knowledge session recreation
testing /
Testing
session serialization /
Session serialization
full serialization /
Full session serialization
setGlobal method /
Validation service
setUpClass method /
Integration testing
setupClass method /
Testing
Smooks /
Alternative data loading
Spring framework integration
about /
Spring framework integration
standards
about /
Standards
StatefulKnowledgeSession
about /
StatefulKnowledgeSession
stateful session
using, for validation /
Validation using stateful session
,
Design overview
static analysis, rules
steps /
Static analysis of rules
SuspiciousAccount /
Design and modeling
SuspiciousTransaction /
Design and modeling
T
technologies
JSP /
Technologies used
using /
Technologies used
ADditional Drools projects /
Additional Drools projects used
TerminalNode /
TerminalNode
about /
TerminalNode
fact, inserting /
Example 1 – inserting a fact
testing
about /
Testing
batch, executing /
Batch execution
minimal account balance rule /
Minimal account balance rule
student account rule /
Student account rule
unique account number rule /
Unique account number rule
this keyword /
The keyword - this
TrackingProcessEventListener method /
Test setup
traditional approache problem
solution /
The solution
advantages /
Advantages
disadvantages /
Disadvantages
rule engine, avoiding /
When not to use a rule engine
traditional approaches
issues /
Problems with traditional approaches
TransactionCompletedEvent /
Design and modeling
TransactionCreatedEvent /
Design and modeling
Transfer Funds node /
Testing the transfer work item
Transfer Funds work item
about /
The Transfer Funds work item
definition /
The work item definition
registration /
Work item registration
handler, implementing /
Work item handler
handler, registering /
Work item handler registration
testing /
Testing the transfer work item
transformation functions /
The transformation functions
transformation rules
writing /
Writing transformation rules
testing /
Testing
address normalization /
Address normalization
findAddress rule, testing /
Testing the findAddress rule
country error message, creating /
Unknown country
currency conversion /
Currency conversion
single account permission /
One account allowed
results /
Transformation results
troubleshooting techniques
about /
Troubleshooting techniques
event listeners /
Event listeners
debugging /
Debugging
,
jBPM
rule conditions, debugging /
Debugging rule conditions
generated classes source /
Source of generated classes
twoLargeWithdrawals rule
about /
Two large withdrawals
testing /
Testing the twoLargeWithdrawals rule
type declarations /
Type declarations
types /
Types
U
unit test, rules
writing /
Writing unit tests for rules
users
about /
Users
properties /
Users
V
validation
implementing, stateful session used /
Validation using stateful session
design overview /
Design overview
stateful Validation Service /
Stateful Validation Service
integration testing /
Integration testing
logical assertions /
Logical assertions
about /
Validation
services /
Services
transactions /
Transactions
presentation layer /
Presentation layer
validation package
about /
Validation package
object required type rules /
Object required type rules
testing /
Testing
validation report
updating /
Keeping the validation report up-to-date
conditional element, collecting /
The collect conditional element
,
collect
serialization /
Serialization
validation service /
Validation service
W
WTP /
Deployment
X
XOR /
Gateway — diverging
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