[rules-users] Not able to create object in [then] clause in DSL using Guvnor

Esteban Aliverti esteban.aliverti at gmail.com
Tue Aug 3 16:22:50 EDT 2010


You have to write java (or mvel) in the THEN part. Have you tried this?

[when] IMRR action requested is in one of {acts} = Action(action in {acts})
[then] permitted =Decisions dec = new Decision(); dec.setDecision("Granted")

Best,

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Tue, Aug 3, 2010 at 5:18 PM, bbarani <bbarani at gmail.com> wrote:

>
> Hi,
>
> I am trying to execute a simple DSL as below. Decisions is the bean class
> which I have imported in to Guvnor
>
> [when] IMRR action requested is in one of {acts} = Action(action in {acts})
> [then] permitted =dec:Decisions dec.setDecision("Granted")
>
> Now I want the object for decision to be created and the value set in a
> single mapping. I tried the above code and got the error as below.
>
>  [NamedParameterRule] Unable to build expression for 'consequence':
> java.lang.Class cannot be cast to org.mvel2.util.MethodStub '
> System.out.println("Rule Fired From Guvnor");
>                dec: Decisions () dec.setDecision("Granted")'
>
> If I create the object in [when] clause it works fine. Any idea when this
> error would pop up?? and how to resolve this?
>
> Thanks,
> Barani
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Not-able-to-create-object-in-then-clause-in-DSL-using-Guvnor-tp1020366p1020366.html
> Sent from the Drools - User mailing list archive at Nabble.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/20100803/7796f1b8/attachment.html 


More information about the rules-users mailing list