<div dir="ltr">im getting the following error on doing that<div><br></div><div><div>Exception in thread "pool-2-thread-1" Exception executing consequence for rule "size" in <a href="http://com.net">com.net</a>: java.lang.NullPointerException</div>
</div><div><br></div><div>what might be the problem?</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Mar 10, 2014 at 4:16 PM, Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Seeing that the list is static you can use the usual way for accessing<br>
a static class member:<br>
<br>
Event.listOfEvent.add( ... );<br>
<br>
@Mauricio: It's not unusual to maintain a static collection (even<br>
though there may be better ways, esp. with Drools).<br>
<div><div class="h5"><br>
<br>
<br>
On 10/03/2014, Mauricio Salatino <<a href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>> wrote:<br>
> Can you please elaborate about why do you want to do that? what's the point<br>
> of having a list inside of the Event class that will contain the same<br>
> event?<br>
><br>
> The "Then" side of the rule is pure java.. so you just do<br>
> event.getEvents().add(event);<br>
><br>
> but I don't see the point of doing that.<br>
><br>
> Regards<br>
><br>
><br>
> On Mon, Mar 10, 2014 at 10:31 AM, Sandhya Sree<br>
> <<a href="mailto:sandhyachinnaraj@gmail.com">sandhyachinnaraj@gmail.com</a>>wrote:<br>
><br>
>> hi ,<br>
>><br>
>> i have a class called Event which is as follows:<br>
>><br>
>> public class Event {<br>
>> private String name;<br>
>> private File source;<br>
>> private Date timeStamp;<br>
>> public static List<Event> listOfEvents;<br>
>><br>
>> public Event(String name, File source, Date timeStamp) {<br>
>> <a href="http://this.name" target="_blank">this.name</a> = name;<br>
>> this.source = source;<br>
>> this.timeStamp = timeStamp;<br>
>> }<br>
>> public String getName() {<br>
>> return name;<br>
>> }<br>
>> public void setName(String name) {<br>
>> <a href="http://this.name" target="_blank">this.name</a> = name;<br>
>> }<br>
>> public File getSource() {<br>
>> return source;<br>
>> }<br>
>> public void setSource(File source) {<br>
>> this.source = source;<br>
>> }<br>
>> public Date getTimeStamp() {<br>
>> return timeStamp;<br>
>> }<br>
>> public void setTimeStamp(Date timeStamp) {<br>
>> this.timeStamp = timeStamp;<br>
>> }<br>
>><br>
>><br>
>> public void display()<br>
>> {<br>
>> System.out.println(name +" " + "in folder: " + source + " on " +<br>
>> timeStamp );<br>
>> }<br>
>><br>
>><br>
>><br>
>> there are also some other classes associated with my project.. i have a<br>
>> rules file which computes the size of a folder and creates an object of<br>
>> Event class. every time this object of Event class is created i wwant to<br>
>> put it in a List<Event>.. how can i do this..<br>
>><br>
>> my rules is as follows:<br>
>><br>
>> rule "size"<br>
>> when<br>
>> $p: RuleContext($size: getOldContext().getParent().getUsableSpace() ><br>
>> (30*1024*1024))<br>
>><br>
>> then<br>
>> Event event = new Event("folder almost full",<br>
>> $p.getOldContext().getParent(), new Date());<br>
>> event.display();<br>
>> ......here i want to put this event into the List<Event> declared in<br>
>> Event Class.....<br>
>><br>
>> end<br>
>><br>
>><br>
>><br>
>> thanks,<br>
>> Sandhya<br>
>><br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>><br>
><br>
><br>
><br>
> --<br>
</div></div>> - MyJourney @ <a href="http://salaboy.com" target="_blank">http://salaboy.com</a> <<a href="http://salaboy.wordpress.com" target="_blank">http://salaboy.wordpress.com</a>><br>
<div class="im HOEnZb">> - Co-Founder @ <a href="http://www.jugargentina.org" target="_blank">http://www.jugargentina.org</a><br>
> - Co-Founder @ <a href="http://www.jbug.com.ar" target="_blank">http://www.jbug.com.ar</a><br>
><br>
> - Salatino "Salaboy" Mauricio -<br>
><br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br></div>