On Thu, May 13, 2010 at 07:51:35PM -0700, eric woo wrote:
>
> ruote is a great workflow engine, but i found the participant is not
> Meet my needs.
> 
> i want to get the participant from the database table,not from the
> programm.

Hello Eric,

if you want to store workitems in a database, you should use "ruote-dm"

  http://github.com/jmettraux/ruote-dm

Here is some code :  (also at http://gist.github.com/400761)

---8<---
require 'rubygems'
require 'json' # gem install json
require 'ruote'
require 'ruote-dm' # gem install ruote-dm

#DataMapper.setup(:default, 'sqlite3::memory:')
#DataMapper.setup(:default, 'sqlite3:ruote_test.db')
DataMapper.setup(:default, 'postgres://localhost/ruote_test')

#Ruote::Dm::Document.all.destroy!
  # cleans up the ruote database before running

  engine = Ruote::Engine.new(
    Ruote::Worker.new(
        Ruote::Dm::DmStorage.new(:default)))

  sp = engine.register_participant '.+', Ruote::StorageParticipant

  pdef = Ruote::process_definition do
    sequence do
        eric
            john
              end
              end

# launch a process instance

#engine.context.logger.noisy = true
engine.launch(pdef)

sleep 1

# display workitems

puts '-' * 80
sp.all.each do |wi|
  p [ wi.participant_name, wi.fields ]
  end

# manipulate one workitem

wi = sp.first
wi.fields['hello'] = 'world'

sp.reply(wi)

sleep 1

# display workitems

puts '-' * 80
sp.all.each do |wi|
  p [ wi.participant_name, wi.fields ]
  end

# ...
--->8---


> and i want to says if the participant just like workflow role?

Sorry I don't understand this question.

Maybe this chat extract could help :

---8<---
11:40 hansen_: how to build the relation between people and participant?
11:40 jmettraux: use a storage participant
11:41 jmettraux: then in your rails application use some logic to decide which 
user has the right to view which workitem
11:43 jmettraux: RuoteKit.storage_participant.by_participant('review')
11:43 jmettraux: will return all the workitems where participant name is 
"review"
11:43 jmettraux: these are just examples
11:46 jmettraux: another technique is to have participant names mapped to 
groups of people
11:46 jmettraux: and then have a workitem field named 'user'
11:46 jmettraux: when this field is empty it means that the workitem is not 
assigned to a user...
11:46 jmettraux: there are many techniques, your imagination is the limit
--->8---


Welcome in this mailing list and 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