On Sun, May 16, 2010 at 08:55:17PM -0700, eric woo wrote:
>
> i want to map a particitant to group of user,so when i launch a
> process definition,i must read the process definition to know all
> particitant,and then map the particitant to user.

Hello Eric,

are you sure you need to read the process definition to know all participants 
before the participant execution ?

You could :

a) use "user names" as "participants"

  sequence do
    eric
    hanse
  end

but this is very inflexible.

b) use "group names"

  sequence do
    team_a
    team_b
  end

And then, in your application, have some way to map users to groups.

  class User
    def groups
      [ 'team_a', 'team_x' ]
    end
    def workitems
      groups.inject([]) do |a, groupname|
        a += RuoteKit.storage_participant.by_participant(groupname)
        a
      end
    end
  end

"reading the process definition before launching it to determine the list of 
participants" is a very inflexible technique. Consider this piece of process 
definition :

  sequence do
    participant :ref => '${f:next_team}'
    participant :ref => '${f:next_team}'
  end

The participants are obviously determined at runtime, the first participant may 
change the value of the field 'next_team'...


> my problem is if i can get all particitant when i start launch a
> process definition.

As I wrote, if you are focusing on launchtime, you will lose the flexibility of 
choosing "just in time" (runtime).


> or if i can implement Ruote::StorageParticipant?

Nothing prevents you from subclassing / re-opening this class.


> just like before reply the workitem to engine,if i can map the
> particitant to the user,then insert to table about the next step user.

Consider this loop :

  pdef = Ruote.process_definition :name => 'for_eric' do
    cursor do
      participant '${f:next}'
      rewind :if => '${f:next}'
    end
  end

  # ...

  engine.launch(pdef, 'next' => 'eric')

The first participant is the user 'eric'. Once eric has replied, the 'cursor' 
is rewound if the field 'next' is still filled with a value. For example, eric 
could have set the value to 'hanse'. Once a user erases the value in 'next', 
the cursor will exit (it will not rewind).

Participants are decided at runtime, just in time.

  http://ruote.rubyforge.org/exp/cursor.html

Of course, nothing prevents you from using group names instead of user names.


I hope this will help, 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