I have at least figured out what was going on with my decision table.
I kept comparing what I was doing with the policy pricing example included
with drools and trying to figure out what I was doing different. Because of
the syntax of the rules I was getting back, it occurred to me that the issue
might be that I was never referencing my recipient object as part of the
condition.
I added a property to my BooleanAnswer object so it now looks like:
public class BooleanAnswer {
private boolean answer;
private int index = 2;
/**
* no-arg constructor
*/
public BooleanAnswer(){
}
/**
* create your own default answer
* @param answer the answer to set
*/
public BooleanAnswer(boolean answer){
setAnswer(answer);
}
/**
* @return the answer
*/
public boolean isTrue() {
return answer;
}
/**
* @param answer the answer to set
*/
public void setAnswer(boolean answer) {
this.answer = answer;
}
/**
* @return the index
*/
public int getIndex() {
return index;
}
/**
* @param index the index to set
*/
public void setIndex(int index) {
this.index = index;
}
I then modified my Decision table so it looks like:
CONDITION
ACTION
answer: BooleanAnswer
index
answer.setAnswer($param);
index
Allowed
2
TRUE
TRUE
This built the proper rule and works fine.
It appears that drools is not set up to store values in an object that was
not referenced in the condition. Is this true? If so, it seems this should
be a request for future enhancement.
If not, then how do I do this without referencing my recipient object in the
condition.
Thanks!
Thom Hehl
Sr. eJuror Architect
* Office (859) 277-8800 x 144
* Thomas.Hehl(a)acs-inc.com <mailto:Thomas.Hehl@acs-inc.com>
ACS, Inc.
Government Solutions
1733 Harrodsburg Road
Lexington, KY 40504-3617
This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the sender
by reply e-mail and destroy all copies of the original message and notify
sender via e-mail at Thomas.Hehl(a)acs-inc.com
<mailto:Thomas.Hehl@acs-inc.com> or by telephone at 859-277-8800 ext. 144.
Thank you.
Show replies by date