On Wed, Jun 09, 2010 at 05:42:59PM +0200, Asier wrote:
> 
> Currently I'm modeling the "delegate to" option in a workflow step like this:
> 
> <participant ref="requestor_notification" on_error="undo"/>
> <participant ref="${user}" if="${user}" />
> 
> <participant ref="sales_manager" task="validation"/>
> <participant ref="${user}" if="${user}" />
> 
> <participant ref="account_manager" task="sign"/>
> <participant ref="${user}" if="${user}" />
> 
> But it looks a bit annoying to have all the ref="${user}" after each
> participant so how do you model this? I've thinked about creating a
> subprocess but in the end looks similar because I must setup the
> field ${usuario}
> 
> <process-definition name="participant_with_delegation">
>    <participant ref="${usuario}" />
>    <participant ref="${user}" if="${user}" />
> </process-definition>
>
> Is there another form to perform this task?

Hi Asier,

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

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


> Another question: is possible to know whithout adding fields in
> which "horizontal" step of the workflow (as seen with ruote-fluo)
> lives a workitem? Sometimes is very helpful to know if the received
> workitem belongs to the first/last participant of a workflow

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 ?

For the steps inside of a sequence, it's vanilla easy, but when it comes to 
more dynamic processes, it gets hairy...

Another technique :

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


Best regards,

-- 
John Mettraux - http://jmettraux.wordpress.com

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