lib/openwfe/expressions/fe_define.rb in openwferu-0.9.15 vs lib/openwfe/expressions/fe_define.rb in openwferu-0.9.16
- old
+ new
@@ -50,45 +50,43 @@
is_definition
names :define, :process_definition, :workflow_definition
+ attr_accessor :body_fei
- attr_accessor :body_fei, :eval_only
-
- #
+ #--
# Evaluates the definition, but doesn't apply its body, will
# simply return the body fei.
#
- def evaluate (workitem)
+ #def evaluate (workitem)
+ # @eval_only = true
+ # apply workitem
+ # @body_fei
+ #end
+ #++
- @eval_only = true
-
- apply workitem
-
- @body_fei
- end
-
#
# Called at the end of the 'evaluation', the 'apply' operation on
# the body of the definition is done here.
#
def reply_to_parent (workitem)
- return if @eval_only
+ #return if @eval_only
- unless @body_fei
- super workitem
- return
- end
+ #puts "/// \n bf #{@body_fei} \n wi.fei #{workitem.fei}"
- fei = @body_fei
- @body_fei = nil
+ return super(workitem) \
+ if @body_fei == nil or @body_fei == workitem.fei
+ #unless @body_fei
- store_itself()
+ #_fei = @body_fei
+ #@body_fei = nil
+ #store_itself
+ #get_expression_pool.apply _fei, workitem
- get_expression_pool.apply fei, workitem
+ get_expression_pool.apply @body_fei, workitem
end
#
# Overrides the set_variable in FlowExpression to
# make sure to intercept requests for binding subprocesses
@@ -111,37 +109,42 @@
super name, fei
end
protected
- def get_to_next_child
+ #
+ # Determines the flowExpressionId of the next child to apply.
+ #
+ def next_child (current_fei)
next_fei = super
return nil unless next_fei
rawchild = get_expression_pool.fetch_expression next_fei
+ return next_child(next_fei) unless rawchild
+
unless rawchild.is_definition?
- @body_fei = next_fei unless @body_fei
- return get_to_next_child
+
+ unless @body_fei
+ @body_fei = next_fei
+ store_itself
+ end
+ return next_child(next_fei)
end
exp_class = get_expression_map.get_class rawchild
if exp_class == DefineExpression
- #
- # binds the FlowExpressionId of the current child
- # as a variable and recurses to the next child
- #
set_variable rawchild.definition_name, next_fei
- return get_to_next_child
+ return next_child(next_fei)
end
- #
- # our next child will simply get applied
-
next_fei
+ #
+ # expression is a 'set', a 'filter-definition' or
+ # something like that, let it get applied
end
end
end