El 10/06/2010 3:45, John Mettraux escribió:

you could pass 'parameters' to your subprocess :

   http://ruote.rubyforge.org/exp/subprocess.html
   under 'passing attributes as variables'

For example :

---8<---
Ruote.process_definition do

   sequence do
     asier_participant :user =>  'juan'
     asier_participant :user =>  'mafalda'
   end

   define :name =>  'asier_participant' do
     participant :ref =>  '${v:user}'
     participant :ref =>  '${user}' :if =>  '${user}'
   end
end
--->8---

Please note that the user is passed to the subprocess as a variable (no 
conflict with your subsequent 'user' field).

This exactly what I'm looking for! Lots of thanks, John. I think sometimes you must feel like a teacher with awkward students.

(I assume it's OK for you to translate to XML by yourself).

Note : these days I'm using ruote + rails a lot, I'm using a StorageParticipant 
and a workitem
field named 'user'. All the delegation occurs without the workitem leaving the 
storage participant,
by simply modifiying the value of this 'user' field. Many possibilities.

I don't understand this approach: "all the delegation occurs without the workitem leaving the storage participant".

Like in a loop?

set 'user' => 'asier'
repeat do
  participant '${user}'
  stop :unless => "${user}'
end

Ruote-fluo knows the position of a workitem by doing :

   workitem.fei.expid

This 'expression id' looks like, for example, '0.1.0'

---8<---
Ruote.process_definition do
   alpha
   cursor do
     bravo
     charly
     delta
   end
   echo
end
--->8---

'0.1.0' points to 'bravo'.

It requires a bit of gymnastics to go from workitem.fei.expid + process definition 
representation to "I'm in the last step of the process definition".

I could write a few methods for this if you'd like, but what are the questions 
that should be answered ?

- am I in the first step ?
- am I in the last step ?

Yes, these exactly are my two questions, but this info being accesible from ruote-kit. The idea is to know which user has launched the workflow because participants are mapped to roles. These two questions should be sufficient because sometimes is very helpful to know if a workitem is the first or last one.

Perhaps it's easy to check for the existence of a field named "launchedBy", and if not present, add it with the participant name.

---8<---
Ruote.process_definition do
   alpha
   cursor do
     bravo
     charly
     delta
   end
   echo :stage =>  'last'
end
--->8---

The workitem addressed to the participant 'echo' would have

   workitem.fields['params']['stage'] == 'last'

An interesting property of this 'params' subhash is that it's cleared after 
each participant.

I hope it helps.

Hmmm, I'm going to use the "launchedBy" wirkitem field approach in the first step, and something in the line of

        echo :stage => 'last'

for the last step, probably modelled with a ruote-amqp participant. Looks a good and flexible approach.

Again, thanks for your support.

Thanks

--
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