Hi Wolfgang,
The below code which you wrote is very appropriate but where should we mention on which collection we are traversing the conditions on . Like in collect $alarms : ArrayList(size>0) from collect ( Alarm( ...... ) from av.getAlarms() ) Thanks & Regards, Hari Kishan T -----Original Message----- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Wednesday, September 28, 2011 3:39 PM To: Rules Users List Subject: Re: [rules-users] Getting Exception while running rules continuously on the Event Streams from Mule Component. Here is an example: $av: List() from accumulate ( $a: Alarm( ...select "interesting" alarms... ), init( List<Alarm> alarms = new ArrayList<Alarm>(); ) action( alarms.add($a); ) reverse( alarms.remove($a); ) result(alarms) ) To select "interesting" alarms, separate the constraints for fields "activation" and "geofenceCustomer" with a comma (which acts like a logical "and"). -W 2011/9/28 Hari Kishan <harikishan.tamm...@pass-consulting.com>: > @wolfgang Yesterday you told me to use accumulate instead of collect. But i > could not find the right way to use accumulate here. Please see below my > rules when condition [ collect function(Bold & Italic) ] and please tell me > how can i use accumulate there. If possible change the conditional element > to accumulate with appropriate changes. when // "Sensor Data Idem Stream" is > where Mule sends the Sensordata facts // for each Alarm / Sensordata > combination that is identified via the vehicle id $sd : SensorDataIdem ($vid > : vehicleId) from entry-point "Sensor Data Idem Stream" // Set a references > for later on the initial facts $av : AlarmVehicle(vehicleId == $vid) //The > Condition to be added to get the active Alarms from the List of Alarms > eval($av!=null && $av.getAlarms()!=null && $av.getAlarms().size()>0) $alarms > : ArrayList(size>0) from collect ( Alarm( ( (activation == > AlarmConstants.ALWAYS_ACTIVE) || (activation == > AlarmConstants.ACTIVE_ONLY_ONTOUR && $sd.onTour == true) || (activation == > AlarmConstants.ACTIVE_ONLY_NOT_ONTOUR && $sd.onTour == false) || (activation > == AlarmConstants.ACTIVE_ONLY_ONMOVING && $sd.onMove == true) || (activation > == AlarmConstants.ACTIVE_ON_TIME_WINDOW ) ) && ( ( (geofenceCustomer == 0) > || (geofenceCustomer == 1 && $sd.inCustomerGeoFence == true) || > (geofenceCustomer == 2 && $sd.inCustomerGeoFence == false) ) && ( > (geofenceDepot == 0) || (geofenceDepot == 1 && $sd.inDepotGeoFence == true) > || (geofenceDepot == 2 && $sd.inDepotGeoFence == false) ) ) ) from > $av.getAlarms() ) eval($alarms!=null) then ........... > ________________________________ > View this message in context: Re: [rules-users] Getting Exception while > running rules continuously on the Event Streams from Mule Component. > Sent from the Drools: User forum mailing list archive at Nabble.com. > > _______________________________________________ > 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
<<inline: 30j_pass-1-1.jpg>>
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users