Thanks, I have resolved the problem with some modified to the Drools source, maybe you can take a loot at my blog: wangzaixiang.blogspot.com, (In chinese, but i post some source code)
On Sat, Mar 27, 2010 at 8:23 AM, Peter Butler <peter.but...@141.com> wrote: > Hi Wang > > I've done something similar with questions in an insurance application. > I found it easiest to split the map entries up into separate objects and > put them all into working memory: > > class Answer { > String questionCode; > String answer; > AnswerSet answerSet; > // ...getters and setters omitted > } > > class AnswerSet { > String answerSetCode; > List<Answer> answers; > } > > The rule looks something like: > > when > set1 : AnswerSet(code == 'answerSet1') > answer1 : Answer(questionCode == 'question1', answer == "100", answerSet > == set1) > answer2 : Answer(questionCode == 'question2', answer == '200', answerSet > == set1) > then > answer1.hidden = true > > These are also easy to convert into a DSL. The "answerSet" in the rule > is used to make sure both answers have come from the same set of answers > (if that's important to you). > > I did read somewhere in the docs that MVEL can handle maps in the same > way as beans, but I'm not sure if this is correct. > > Cheers > > Peter > > 王在祥 wrote: > > I have a requirement of run rules on dynamic map instead of POJO, for > > example: > > > > *when > > Map(* TransCode == "LOGIN" , userName == "wangzx", password == "123456" ) > > *then > > doSth1() > > > > when > > Map( *TransCode = "SaveOrder" userName == "wangzx" category == "Book") > > *then > > doSth2() > > > > * > > the Fact is not a Java Bean, but a dynamic map<String, Object>, so the > > TransCode == "Login" is what we means map("TransCode") == "Login". > > > > By using map insteam of POJO, we can build a rules run on the message > > dispatch, since there is a lot of Message Types, and each message type > > has different schema, so using dynamic types is more flexible than POJO. > > > > Can someone tell me how can it be supported in drools? Very thanks. > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > rules-users mailing list > > rules-users@lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/rules-users > > > > _______________________________________________ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users >
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users