Stop Rules on update facts drools

我怕爱的太早我们不能终老 提交于 2019-12-11 16:16:48

问题


I have a scenario in Drools. I have some set of rules. For Example :

In Rule 1: I am setting ProductName in the fact pojo that comes from session after some condition. In Rule 2: I am calculating grade value i.e. X1,X2,X3,X4. So for each grade I have single rule to calculate.

The Fact pojo that is coming from User may ask to calculate any grade value. However, say user asked for X4, then all the grade value from X1 to X3 should also be calculated.

What I did is that whenever any rule is executed; in then condition I am updating a fact that is holding a grade value property and in the last one single rule is written that will check for matching of the grade that is incoming from Pojo and executed rule grade.

However, it is not stopping on the particuler grade and executing all the grade value.

Please suggest some way.

========Edit=======

Rule Calculate X when seq == true then calculate X;

Rule Calculate x1 when seq == true then calculate X1; Rule Calculate x2 when seq == true then calculate X2;

Say if I asked to calculate X2, then rule x and x1 should also be calculated. If x1 then rule x and x1 should only execute.

Thanks Kumar Shorav

来源:https://stackoverflow.com/questions/26322576/stop-rules-on-update-facts-drools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!