[rules-users] choose method from fact object in guided editor

Hans Wirz hans.wirz at xmv.ch
Mon Jun 10 11:05:12 EDT 2013


Michael,

you made me thinking ;-)

I tried it by adding a second action. The guided editor let me chose to Call
a method on a bound variable. (Call [d])



Unfortunately, the getContentValue() method was not available which made me
thinking again. I've found, that all public methods on my fact object which
begin with get. are stripped out by the guided editor!

I simply changed it to contentValue() and there it was ;-)

This means the following to my problem:

1.       Users are able to choose also a method from a fact object - but
only in the then-part of the rule.

2.       This expression (the result thereof) cannot be bound to a variable
(it is probably only thought to 'activate' some domain specific processes.)

3.       I need to call a method in the LHS to decide whether the rule fires
or not.

 

Regards - Hans

 

Von: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] Im Auftrag von Michael Anstis
Gesendet: Montag, 10. Juni 2013 16:35
An: Rules Users List
Betreff: Re: [rules-users] choose method from fact object in guided editor

 

Have you tried using an expression on the RHS?

 

On 10 June 2013 15:24, Hans Wirz <hans.wirz at xmv.ch> wrote:

Steve,

my problem is, that the ,key' after the method getContentValue() is looking
for, has to be variable and can be set by the rule creator.

I guess it remains the same problem whether I use DSL, Decision Table or any
other construct to specify a Rule.

It is simply necessary, that the user (actually NOT an IT-Expert) would be
guided through the possibilities a fact object supports.

If he cannot find the method getContentValue() he had to know its existence
and arguments from elsewhere.

 

That's why I'm curious whether it is possible (probably by using Java
annotations or what else?) to tell the guided editor that it should also
present some methods (not only fields according to the Java-Beans
convention) to the user.

Thank you for the DSL hint. I will have a closer look at this approach
anyway.  In my case it should probably looks like:

[when]There is a document which has a value keyed by {key} that matches
{expr}=$: Dokument(..

 

Regards - Hans

 

Von: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] Im Auftrag von Stephen Masters
Gesendet: Montag, 10. Juni 2013 16:01
An: Rules Users List
Betreff: Re: [rules-users] choose method from fact object in guided editor

 

Is there some reason you can't just create a no-args method on the fact such
as "getReviewedContent()"? Or why the pattern match couldn't directly match
on reviewed content instead of using rules in Java to determine whether
content has been reviewed?

 

If you don't want to do either of those, how about a DSL sentence to select
reviewed content? i.e. 

 

[when][]There is a document which was reviewed by {reviewer}=$d:
Document(getContentValue("reviewed") matches "{reviewer}"); Document(this ==
.

 

(warning - probable syntax errors above)

 

Steve

 

 

 

 

On 10 Jun 2013, at 13:58, Hans Wirz <hans.wirz at xmv.ch> wrote:

 

Hello

I'm new to Drools and Guvnor and I'm trying to find a way to enable the
selection of a method (other than getter and setter) by the guvnor guided
editor in a drop-down-list way like the fields.

 

Example (.drl-file edited by Drools-Plugin in Eclipse):

 

<image001.png>

 

How to achieve this in Guvnor guided editor, because the method
getContentValue("reviewed") cannot be chosen - it must be KNOWN by the one
who creates the rule?

 

My approach (using a Formula):

<image002.png>

 

 

Many thanks for your help

Hans

_______________________________________________
rules-users mailing list
 <mailto:rules-users at lists.jboss.org> rules-users at lists.jboss.org
 <https://lists.jboss.org/mailman/listinfo/rules-users>
https://lists.jboss.org/mailman/listinfo/rules-users

 


_______________________________________________
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/20130610/3918bdf7/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 24862 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20130610/3918bdf7/attachment-0001.obj 


More information about the rules-users mailing list