I'll try to make my questions less verbose: 1) When you change a flow variable what is the best way to update the WorkflowProcessInstance object in working memory if you are using subflows and hence have multiple WorkflowProcessInstances?
2) If I insert the WorkflowProcessInstance for both a parent flow and child subflow and reference it in the LHS of a rule using "processInstance : WorkflowProcessInstance()" I get activations for both instances of the object. The documentation says that this should only match the current process instance. Am I doing something wrong? Cheers! Gareth On 25 February 2011 08:48, Gareth Evans <[email protected]> wrote: > Hello, > > I am having some problems using WorkflowProcessInstance in rules. I > have searched and not been able to find an answer to my question. > > I am attempting to use rule flows to define business processes and > rules both in ruleflow groups to be executed on demand of the process > and outside of a ruleflow group for "global" rules and to potentially > direct the ruleflow(/process) is to run. Many of these processes are > comprised of subprocesses which I have been using sub flows to model. > > I have used flow variables to store some minimal information about the > process such as what the process ID corresponds to in the existing > data model I am working with. My intent was so that I could use a > single rule flow group in many rule flows to extract information from > the database for the corresponding process ID in the working memory > (this extraction would also depend on other facts in the working > memory). > > I've inserted the WorkflowProcessInstance by using an action node in > the "parent" process and it seems to work fine. My problem arises when > I am then in a "child" process/subflow and try to invoke this single > rule flow group with a different process ID in the flow variable, > there are no activations. I think this happens because the > WorkflowProcessInstance has not been updated in working memory so it > will not know that there might be a new process ID stored in the flow > variable (it has the same name in both flows as it is meant to > represent the same thing). > > If I insert the WorkflowProcessInstance again in the sub flow I get > activations in the rule flow group for facts in the working memory > associated with both the parent and child sub flow which almost makes > sense except for this: > > "We have added special logic to make sure that a variable > processInstance of type WorkflowProcessInstance will only match to the > current process instance and not to other process instances in the > Working Memory." > > It seems that it is matching both instances of > WorkflowProcessInstance. I use the convention of starting variable > names from the LHS of a rule with a $ but I have tested it without and > I get the same result. Is this expected behaviour? > > An alternative I've been trying to figure out is how to update the > WorkflowProcessInstance in working memory in the child process. Since > it is actually a different object I'm unsure how to do this. Should I > retract all instances and then insert the current? Is there a way to > do this more cleanly than looking through all working memory objects > and checking their type in an action node? > > Finally (or perhaps firstly...), am I going about this correctly? > > Cheers, > Gareth > _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
