<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16809" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Ricardo,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>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 face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Kris</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=rgil@okode.com href="mailto:rgil@okode.com">Ricardo Gil Alcaņiz</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=rules-users@lists.jboss.org
href="mailto:rules-users@lists.jboss.org">Rules Users List</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, March 09, 2009 4:37
PM</DIV>
<DIV style="FONT: 10pt arial"><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="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">----------
Mensaje reenviado ----------<BR>From: Kris Verlaenen <<A
href="mailto:Kris.Verlaenen@cs.kuleuven.be">Kris.Verlaenen@cs.kuleuven.be</A>><BR>To: Rules
Users List <<A
href="mailto:rules-users@lists.jboss.org">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">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>
<P>
<HR>
<P></P>_______________________________________________<BR>rules-users mailing
list<BR>rules-users@lists.jboss.org<BR>https://lists.jboss.org/mailman/listinfo/rules-users<BR></BLOCKQUOTE></BODY></HTML>