[rules-users] DSL usage in Guvnor

Stephen Masters stephen.masters at me.com
Wed Sep 5 16:46:28 EDT 2012


Hi there,

When using DSL to drive the guided editor, I seem to remember having similar trouble. I opted for writing DSL to generate code which stands alone and re-uses variables. i.e.

[when][]Given a request = $request : Request()
[when][]for a savings account = eval($request.getAccountType().equals("Savings"))


I don't think you can use DSL in decision tables (I'd love to be told that's no longer the case!), but if you need to do that kind of thing, it would probably be worth looking at rule templates instead. They behave a bit like a cross between a decision table and a guided rule.


I have had trouble with DSL-based rules and decision tables where defining an enumeration as a constraint on a field just doesn't get picked up in Guvnor. You need to explicitly define the enumeration within your DSL, like so:

[when][]Given a request for a "{account:ENUM:Account.AccountType}" account = AccountRequest(AccountType=="{account}")


Hopefully that's useful …

Steve


On 5 Sep 2012, at 20:43, dme1 <mehtad at hotmail.com> wrote:

> Hi,
> 
> Do I have to use the Text based DSL Editor in Guvnor if I want to use DSL
> which has definition for the Object and the fields within it (using the "-"
> at the beginning). If I use this in the Guided editor, it shows are 2
> separate rule entries.
> 
> Also can I use DSL for defining conditions and actions in a Guided Decision
> Table, if yes is there an example which shows how to do this.
> 
> Also if I have a Domain Model, and if I use "Enumerations" to define
> constraints on some of the fields (map to a list of values), these do not
> show up when using DSL based rules in the Guided Editor, is there any way to
> get this to work.
> 
> Thanks,
> dme
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/DSL-usage-in-Guvnor-tp4019609.html
> Sent from the Drools: User forum 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/20120905/d2b45b4c/attachment.html 


More information about the rules-users mailing list