Hello Klaus,
On Fri, May 04, 2012 at 09:16:16AM -0700, Klaus Schmidtmamn wrote:
>
> 1.
> The construct:
>
> @dboard.register do
> participant /^skill_/, Klaus::SkilledParticipant
> participant /^user_/, Ruote::StorageParticipant
> end
>
> means that all participants, containing a "skill" in her name are
> instantiated as SkillParticipants and "user" as "StorageParticipant".
> Do I need this "participant /^user_/, Ruote::StorageParticipant" if
> there are only "skill-participants"?
No.
> E.g. if each Workflow-Action
> depends on the skill-level of the user, I only need "participant /
> ^skill_/, Klaus::SkilledParticipant"?
Yes.
> What does "Klaus" mean in "Klaus::SkilledParticipant"?
> For me, it only works without the "Klaus::"- prefix.
Sorry, it's a namespace:
---8<---
module Klaus
class SkilledParticipant
include Ruote::LocalParticipant
# ...
end
end
--->8---
> 2.
> What actually confuses me most is the way how to realize individual
> steps within my process-definition for the different users with
> different skill level:
> What I did is the following: After starting the client, the user can
> input his name (not mandatory) and his skill-level (mandatory) like
> this:
>
> @dboard.register do
> participant /^skill_/, SkilledParticipant
> #participant /^user_/, Ruote::StorageParticipant
> end
>
> print 'username: '; @user = gets.strip
> print 'skill-level: '; @skill = Integer(gets.strip)
>
> Does it make sense to launch the process-definition only with the
> required skill-level... like this:
>
> puts 'user= '+@user
> puts 'skill= '+String(@skill)
>
> wfid = @dboard.launch('./defs/def0.rb', 'skill_level' => @skill)
Yes, I think so.
> How to read this 'skill-level' parameter within the Process-
> Definition?
when you do
wfid = @dboard.launch('./defs/def0.rb', 'skill_level' => @skill)
you're starting a workflow instance with a workitem field "skill_level" set
to @skill.
---8<---
$engine.register :klaus, Ruote::StorageParticipant
pdef = Ruote.define do
klaus, :task => 'go to ${f:city}'
end
$engine.launch(pdef, 'city' => 'Oslo')
$engine.launch(pdef, 'city' => 'Bratislava')
$engine.launch(pdef, 'city' => 'Vilnius')
--->8---
> I think the skill-parameter has no influence over the
> procss-definition if it starts like this:
>
> citerator :on => [ 0, 1, 2, 3 ], :to_f => 'level' do
> echo 'level= ${f:level}'
> handle :level => '$f:level'
> end
> ...
Indeed.
> To me it seems like no matter what variable is given to the "launch",
> the process-definition is deployed for all participants? I do not
> understand what influence a variable like
> 'skill_level' => @skill has at this position.
It's not a variable, it's a workitem field.
Please re-read my previous email carefully, you'll notice that I proposed you
two distinct solutions. If now you mix them, of course it will be confusing.
> 3.
> On the other hand side, you gave me the example below with the "skill-
> level as variable". But how can I combine the registered participants
> with this variable?
> This confused me... So how would you change this part to make sense:
>
> (...)
>
> skill_3 :task => 'very hard', :if => '${v:level} == 3'
You can do:
participant :ref => 'skill_${f:skill_level}', :task => 'x'
> 4.
> Concerning to your explanation of task: "skill_0 :task => 'easy'" will
> only say what to do, but in what way I can execute a function or a
> method, if this workflow-position is reached?
> I think on sth. like "skill_1 :task => doSth()'
> Where should this function exist?
You can't do that.
You could do:
---8<---
class SkilledParticipant
include Ruote::LocalParticipant
def on_workitem
task = workitem.params['task']
case task
when do_this
Something.do_this
when do_that
Something.do_that
else
raise "unknown task: #{task.inspect}"
end
reply
end
end
--->8---
So many ways to skin a cat.
--
John Mettraux - http://lambda.io/jmettraux
--
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