varamfer / openhab

Automatically exported from code.google.com/p/openhab
0 stars 0 forks source link

drools: accesing changed property in when clause #73

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Reading the drools wiki page: http://code.google.com/p/openhab/wiki/Drools

There is an example related to when clause (LHS) where you can use changed 
property with drools standard notation

$event : StateEvent(itemName=="Rain", changed==true)

But, as this boolean property doesn't follow javabean pattern in StateEvent 
class, it can't be used this way in rules (they won't compile)

For now, you have to do something like this, using the only method available:

this.hasChanged == true

So, i guess that we can change the wiki or refactor this property, in order to 
fix this issue.

Original issue reported on code.google.com by juank...@gmail.com on 10 Feb 2012 at 8:49

GoogleCodeExporter commented 8 years ago
Ok, so if I understand it right, all refactoring that would need to be done is 
to rename StateEvent.hasChanged into StateEvent.isChanged, right?
As StateEvent is local to the Drools add-on, I do not mind to do this small 
change.

Original comment by kai.openhab on 10 Feb 2012 at 11:47

GoogleCodeExporter commented 8 years ago
I have changed StateEvent accordingly.

Original comment by kai.openhab on 12 Feb 2012 at 5:32

GoogleCodeExporter commented 8 years ago
Sorry for the late answer Kai, surprisingly i haven't received any 
notifications by mail.

Thanks for the fix, i will try it asap.

Original comment by juank...@gmail.com on 14 Feb 2012 at 10:35