[rules-users] Inserting new Object

Tina Vießmann tviessmann at stud.hs-bremen.de
Fri Aug 13 06:34:39 EDT 2010


Hi Edson,

I can't provide a test case. But I've figured out what the exception are 
about. It's not about the code I've posted before. It's about the 
exceptions that the java.util.Set.add() method throws. I've attached the 
concerned code at the end.
That means for me I have to manage the exception handling. I've tried to 
google the topic. The best I came up with is a mailing list entry: 
http://drools-java-rules-engine.46999.n3.nabble.com/Exception-handling-policy-td113782.html  
Would that be the correct solution? If yes, how do I implement the 
handler? I would be thankful for a code example.

The code that the exception references is:

    declare Watcher
         @role ( event )

         triggeringValue : Value
         numberOfContainedValues : int
         valueSet : Set  // Set<Value>
    end

    // ....

    function Watcher generateWatcherEvent(Value firstValue) {
         Watcher watcher = new Watcher();
         watcher.setNumberOfContainedValues(1);
         watcher.setTriggeringValue(firstValue);

         // add value to set
         Set set = watcher.getValueSet();
         set.add(firstValue);
         watcher.setValueSet(set);

         return watcher;
    }


Thanks for your help! :)

Tina


Am 13.08.2010 01:14, schrieb Edson Tirelli:
>    Hi Tina,
>
>    Can you provide a test case?
>
>    Edson
>
> 2010/8/12 Tina Vießmann <tviessmann at stud.hs-bremen.de 
> <mailto:tviessmann at stud.hs-bremen.de>>
>
>     Hi again ...
>
>     I would like to insert a new generated object into the knowledge base.
>     It seems that
>         insert (new Watcher())
>      is working. But
>         Watcher watcher = new Watcher();
>         insert (watcher);
>      isn't working?
>
>     Why?
>
>     Thank you for any explanations. :)
>
>     Tina
>     _______________________________________________
>     rules-users mailing list
>     rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> -- 
>   Edson Tirelli
>   JBoss Drools Core Development
>   JBoss by Red Hat @ www.jboss.com <http://www.jboss.com>
>
>
> _______________________________________________
> 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/20100813/1bc702f6/attachment.html 


More information about the rules-users mailing list