Thanks for the explanation!<br><br>I've found the CR1 downloads, I've just tried it, and it works just as I needed :). <br><br>Just one comment. In my first attempts I missed your comment about using a variable with the specific name "processInstance"... I'm "slower" than I thought... But, just as a suggestion, it may be better to have a clearer way to use this special matching. Maybe using a fact property or a keyword... ? Well, I don't know anything about the ruleflow project and its complexity so take my suggestion as it is :).<br>
<br>Well, thanks again for the help and congratulations for your impressive work!<br><br>Ricardo.<br><br><div class="gmail_quote">2009/3/9 Kris Verlaenen <span dir="ltr"><<a href="mailto:kris.verlaenen@cs.kuleuven.be">kris.verlaenen@cs.kuleuven.be</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff">
<div><font size="2" face="Arial">Ricardo,</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">This method has recently been added into
WorkflowProcessInstance, it is on trunk and will be in CR1. For M5, you
could indeed use WorkflowProcessInstanceImpl ...</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">Kris</font></div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;"><div><div></div><div class="h5">
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b>
<a title="rgil@okode.com" href="mailto:rgil@okode.com" target="_blank">Ricardo Gil Alcaņiz</a>
</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b> <a title="rules-users@lists.jboss.org" href="mailto:rules-users@lists.jboss.org" target="_blank">Rules Users List</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b> Monday, March 09, 2009 4:37
PM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b> [rules-users] Re: rules-users
Digest, Vol 28, Issue 19</div>
<div><br></div>
<div class="gmail_quote">
<div>Thanks for your fast response Kris and Michal!<br><br>I tried to use your
solution Kris, but I've found that 5.0.0 M5 WorkflowProcessInstance does not
seems to provide getVariable method. I've found that method into
WorkflowProcessInstanceImpl searching in svn trunk. I must work with that
class or I missed something? Thanks again!<br><br>Ricardo.<br> </div>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">----------
Mensaje reenviado ----------<br>From: Kris Verlaenen <<a href="mailto:Kris.Verlaenen@cs.kuleuven.be" target="_blank">Kris.Verlaenen@cs.kuleuven.be</a>><br>To: Rules
Users List <<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>><br>Date: Sun,
8 Mar 2009 03:56:29 +0100<br>Subject: Re: [rules-users] Drools Flow,
constraint parametrization<br>Ricardo,<br><br>If you need to access process
variables and have only simple constraint<br>expressions, I suggest you use
code constraints (Java or MVEL dialect),<br>as they have direct access to
variables (and globals).<br><br>If you want to use rule constraints anyway
(because your constraints can<br>become rather complex), there are a few
options:<br><br> - You cannot use globals to pass information used in
your constraints,<br>because globals are considered immutable with respect
to rule conditions<br><br> - You can put your data you want to access
in your working memory.<br>Rule constraints can then access this info just
like any normal rule.<br><br> - You access the variable value using the
special "processInstance"<br>rule constraint (I just added a new section in
the documentation to<br>explain):<br><br>Rule constraints do not have direct
access to variables defined inside<br>the process. It is however possible to
refer to the current process<br>instance inside a rule constraint, by adding
the process instance to the<br>working memory and matching to the process
instance inside your rule<br>constraint. We have added special logic to make
sure that a variable<br>"processInstance" of type WorkflowProcessInstance
will only match to the<br>current process instance and not to other process
instances in the<br>working memory. Note that you are however responsible
yourself to insert<br>(and possibly update) the process instance into the
session (for example<br>using Java code or an (on-entry or on-exit or
explicit) action in your<br>process). The following exampleof a rule
constraint will search for a<br>person with the same name as the value
stored in the variable "name" of<br>the process:<br><br>processInstance:
WorkflowProcessInstance()<br>Person( name == (
processInstance.getVariable("name") ) )<br># add more constraints here
...<br><br>Kris<br><br>Quoting Ricardo Gil Alcaņiz <<a href="mailto:rgil@okode.com" target="_blank">rgil@okode.com</a>>:<br><br>>
Hi,<br>><br>> I'm not a new drools user but I started to test rule
flows (5.0M5)<br>> recently<br>> and I'm stucked, so any clue will be
welcomed :). I'm testing how to<br>> share a<br>>
StatefulKnowledgeSession between N rule flow instances. I'm trying<br>>
to<br>> parametrize each instance with process variables at start time
but I<br>> don't<br>> know how to use them from rule constraints (in
event waits, splits,<br>> etc.).<br>> I've read the documentation and
I've found this text related to<br>> constraints<br>> "Both rule and
code constraints have access to globals that are<br>> defined for<br>>
the process and can reuse imports at the process level." I tried it<br>>
assigning (from an action) a variable value to a global variable but<br>>
it's<br>> not working for me. ŋI'm missing something?<br>><br>>
Thanks in advance!<br>><br>> Ricardo.<br>><br></blockquote></div><br>
</div></div><p>
</p><hr>
<p></p>_______________________________________________<br>rules-users mailing
list<div class="im"><br><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br></div><div class="im"><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></blockquote></div>
<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></blockquote></div><br>