Hello John,

It's allright. I kind of panicked when fexp.set_variable() didn't seem
to work at #proceed. So I had to stick with $children for the rest of
my team to have a working, single-process, test case.

With all this variable and state sharing, I just got curious about how
the pdef-level, variable-related workload and could be assumed by
participants in general, as stated in the first post of this thread.
The most important lesson is variable scope. In the adapted pdef,
variables must be process-wide for both parent and children to be able
to access them as the children are replied.

This '/children' process variable is then processed by
workitem.command at #proceed so that the paren can never reply in case
it has living children.

On the other hand, I tried to learn more about the new #stash_*
methods, which only seem useful in cases where "confidential", JSON-
serializable fields are shared among certain participant methods
belonging to the same fei. Not very useful for this sample case, but I
refactored some of our other pdefs.

Having said all of these, the "final" participant looks like this:

---8<---

class FillParticipant < Ruote::StorageParticipant
  def consume(workitem)
    # Process definition sets 'v:/children' => 0
    children = fexp.lookup_variable('/children')

    p "in for #{workitem.params['form']} - #{children} children"
    workitem.fields['form'] = workitem.params['form']
    workitem.fields['launch'] = false

    super(workitem)
  end

  def proceed(workitem)
    children = fexp(workitem).lookup_variable('/children')
    if workitem.params['form'] == 'parent'
       fexp(workitem).set_variable('/children', children + 1) if
workitem.fields['launch']
    elsif workitem.params['form'] == 'child'
       fexp(workitem).set_variable('/children', children - 1)
    end

    super(workitem)
  end
end

--->8---


So this '/children' variable means that our front-end coders don't
need to worry about their business logic having to deal with
interactions between the worklist and internal form behaviour. The
ruote process works!

Thanks for your time and help, John. This little confusion has been a
good way of keeping in touch with the latest ruote commits :-)

//nando

PS-> As soon as we have more time, we'll get back to the list and
share some feedback about the forget/lose issue.

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to