Hi, On Jul 5, 2007, at 8:03 PM, John Mettraux wrote:
Hi Igor, you have to store the workitems for the 'user input' into some kind of persisted participant. The engine will put the workitems in those store participants and your application can then interact with them, manipulating the workitems, and then you can forward (proceed) the workitem back into its process via the store's forward method. You could use HashParticipant (http://openwferu.rubyforge.org/participants.html#HashParticipant), but it's not persisted at all (you restart your application and the workitems are gone). There is then the YamlParticipant (http://openwferu.rubyforge.org/participants.html#YamlParticipant) which behaves as the HashParticipant but the workitems are persisted. The YamlParticipant is used in this example : http://openwferu.rubyforge.org/examples/mano_tracker.rb It shows how to interact with those 'store participants'. You can consider those participants as "workitem stores" for workitems ready for user input are stored. There is a third participant that you might consider, it's not yet publicly released. It stores the records in your database via ActiveRecord. It's athttp://viewvc.rubyforge.mmmultiworks.com/cgi/viewvc.cgi/trunk/ densha/?root=openwferuThe core is at http://viewvc.rubyforge.mmmultiworks.com/cgi/ viewvc.cgi/trunk/densha/lib/openwfe/densha/?root=openwferuThere is a test case that my help you :http://viewvc.rubyforge.mmmultiworks.com/cgi/viewvc.cgi/trunk/ densha/test/with_engine_test.rb?root=openwferu&view=markup
Nice, I read those documents, and now I have more questions.
My workflow is defined this way:
<code>
class RequisicaoProcessDefinition < OpenWFE::ProcessDefinition
def make
sequence do
participant :ref => 'Vendedor', :task => 'SolicitaOrcamento'
wait :until => "${f:status} == 'pronto'"
participant :ref => 'Fornecedor', :task => 'OutraAcao'
end
end
end
</code>
And my participants are defined this way - they're identical:
<code>
class VendedorParticipant < OpenWFE::YamlParticipant
include LocalParticipant
def logger
@logger ||= RAILS_DEFAULT_LOGGER || Logger.new(STDOUT)
end
def consume(workitem)
fe = get_flow_expression(workitem)
task = fe.attributes['task']
raise "request parameter is undefined" unless task
logger.debug("Vendedor Participant request: #{task}")
reply_to_engine(workitem)
end
end
</code>
I'm searching for the participant in Rails controller like this:
<code>
def list
@participant = $engine.get_participant_map.lookup_participant
('Vendedor')
end </code> Now, the questions:- At the 'wait' expression in my process definition, who 'owns' it? 'Vendedor' or 'Fornecedor'?
- At the Rails controller, how can I find the processes which are waiting for @participant action?
- The participants on my system will be the same as my system's Roles, instead of being each participant some different person like Mano's sample. Is that a good approach for it?
Thanks for your support!
PGP.sig
Description: This is a digitally signed message part
