0
@@ -43,7 +43,48 @@ require 'openwfe/expressions/flowexpression'
0
+ # This expression takes its root in this "trouble ticket blog post" :
0
+ # http://jmettraux.wordpress.com/2008/01/04/the-trouble-ticket-process/
0
+ # In this post, the "step" was implemented directly in the OpenWFEru
0
+ # process definition language.
0
+ # It's been turned into an expression and it's not limited anymore to
0
+ # the concept "state is a participant, transition points to a subprocess",
0
+ # state can now point to a subprocess as well as to a participant, idem
0
+ # In other words, this "step" expression allows you to write
0
+ # state-transition process definitions in OpenWFEru (the Ruote workflow
0
+ # engine). But don't abuse it. Classical OpenWFEru constructs can
0
+ # An interesting aspect of the "step" expression is that it can remove
0
+ # the need for some "if" expression constructs (well the fact
0
+ # class ProcDef0 < OpenWFE::ProcessDefinition
0
+ # step "Alfred", :outcomes => [ 'blue_pen', 'red_pen' ]
0
+ # # Alfred gets to choose between a blue pen and a red pen
0
+ # # flow resumes with Bob in a classical way (sequence)
0
+ # define "blue_pen" do
0
+ # # ... Alfred buying a blue pen
0
+ # # ... Alfred buying a red pen
0
+ # For some more discussions about Ruote and state-transition see
0
+ # http://groups.google.com/group/openwferu-dev/t/16e713c1313cb2fa
0
class StepExpression < FlowExpression
0
@@ -61,16 +102,21 @@ module OpenWFE
0
- @outcomes = lookup_array_attribute :outcomes, workitem
0
- @default = lookup_attribute :default, workitem
0
- # keeping track of outcomes and default as found at apply time
0
+ # keeping track of outcomes and default as found at apply time
0
+ @outcomes = lookup_array_attribute(
0
+ :outcomes, workitem, :to_s => true)
0
+ @default = lookup_attribute(
0
+ :default, workitem, :to_s => true)
0
+ # launching the 'step' itself
0
- step, # expression name
0
- { :outcomes => @outcomes, :default => @default }, # attributes
0
+ step.to_s, # expression name
0
+ lookup_attributes(workitem), # attributes
0
@@ -84,18 +130,21 @@ module OpenWFE
0
- outcome = workitem.fields['outcome'] || @default
0
+ outcome = workitem.fields.delete 'outcome'
0
+ outcome = outcome.to_s if outcome
0
- return reply_to_parent(workitem) \
0
+ #p [ outcome, @outcomes, @default ]
0
+ if @outcomes and (not @outcomes.include?(outcome))
0
return reply_to_parent(workitem) \
0
-
if @outcomes and ( ! @outcomes.include?(outcome))0
- outcome
, # expression name
0
+ outcome
.to_s, # expression name
Comments
No one has commented yet.