[rules-users] (no subject)

Michael Anstis michael.anstis at gmail.com
Mon Mar 17 05:43:21 EDT 2014


What field do you set in the constructor then?

new Event("folder almost full",* $p.getOldContext().getParent()*, new
Date());

Whatever field this is you should check in the LHS with the "not
Event(....)" - this ensures the rule only activates if there isn't an Event
already for the RuleContext.


On 17 March 2014 09:41, Sandhya Sree <sandhyachinnaraj at gmail.com> wrote:

> no...Event doesnot have context field
>
>
> On Mon, Mar 17, 2014 at 3:07 PM, Michael Anstis <michael.anstis at gmail.com>wrote:
>
>> Assuming Event has a field called "context" (which is set by the
>> constructor you use in your RHS):-
>>
>> when
>>  $p: RuleContext($size: getOldContext().getParent().getUsableSpace() >
>> (30*1024*1024))
>> * not Event( context == $p.getOldContext().getParent());*
>> then
>>    Event event = new Event("folder almost full",
>> $p.getOldContext().getParent(), new Date());
>>    event.display();
>> end
>>
>>
>> On 17 March 2014 09:25, Sandhya Sree <sandhyachinnaraj at gmail.com> wrote:
>>
>>> hi,
>>>
>>> i have the following rule file :
>>>
>>> rule "size"
>>>
>>> when
>>>  $p: RuleContext($size: getOldContext().getParent().getUsableSpace() >
>>> (30*1024*1024))
>>> then
>>>    Event event = new Event("folder almost full",
>>> $p.getOldContext().getParent(), new Date());
>>>    event.display();
>>> end
>>>
>>>
>>> im loading this rule file and executing the rules once in 10 seconds in
>>> a continuous loop from my java class. assuming the when part is always
>>> true, the event object created gets displayed each and every time once in
>>> 10 seconds. i want to create the object only once with the fact that the
>>> event is already there.. i.e.  i dont want to create the object again if it
>>> is already created.. how can i do that?
>>>
>>>
>>> Thanks.
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140317/481a4429/attachment-0001.html 


More information about the rules-users mailing list