lib/openwfe/expressions/fe_value.rb in openwferu-0.9.8 vs lib/openwfe/expressions/fe_value.rb in openwferu-0.9.9
- old
+ new
@@ -42,14 +42,10 @@
require 'openwfe/workitem'
require 'openwfe/flowexpressionid'
require 'openwfe/expressions/flowexpression'
-#
-# expressions like 'set' and 'unset' and their utility methods
-#
-
module OpenWFE
#
# The 'set' expression is used to set the value of a (process) variable or
# a (workitem) field.
@@ -59,14 +55,21 @@
# <set variable="/stage" field-value="f_stage" />
# <set field="stamp" value="${r:Time.now.to_i}" />
#
# (Notice the usage of the dollar notation in the last exemple).
#
+ # 'set' expressions may be placed outside of a process-definition body,
+ # they will be evaluated sequentially before the body gets applied
+ # (executed).
+ #
class SetValueExpression < FlowExpression
+ is_definition
+
names :set
+
def apply (workitem)
if @children.length < 1
workitem.attributes[FIELD_RESULT] = lookup_value(workitem)
reply(workitem)
@@ -118,22 +121,10 @@
reply(workitem)
else
get_expression_pool().apply(child, workitem)
end
end
-
- #def determine_value (workitem)
- # if @children.length > 0
- # child = @children[0]
- # if child.kind_of? FlowExpressionId
- # return "nada"
- # else
- # return child
- # end
- # end
- # return lookup_value(workitem)
- #end
end
#
# 'unset' removes a field or a variable.
#
@@ -157,12 +148,9 @@
raise "attribute 'variable' or 'field' is missing for 'unset' expression"
end
reply_to_parent(workitem)
end
-
- #def reply (workitem)
- #end
end
end