| Class | OpenWFE::ExpExpression |
| In: |
lib/openwfe/expressions/fe_misc.rb
|
| Parent: | RawExpression |
Some kind of limited ‘eval’ expression.
Here is an usage example :
class ExampleDef < OpenWFE::ProcessDefinition
sequence do
exp :name => "p0"
exp :name => "sub0"
exp :name => "sequence" do
p0
sub0
end
set :var => "a", :value => { "ref" => "p0" }
exp :name => "participant", :variable_attributes => "a"
end
process_definition :name => "sub0" do
_print "sub0"
end
end
This example is a bit static, but the point is that the ‘exp’ is extracting the real expression name (or participant or subprocess name) from its ‘name’ attribute.
The ‘eval’ expression is about evaluating a complete process definition branch, ‘exp’ is only about one node in the process definition.
# File lib/openwfe/expressions/fe_misc.rb, line 279
279: def apply (workitem)
280:
281: @applied_workitem = workitem
282:
283: super
284: end
Evaluates the ‘name’ attribute, if it‘s not present or empty, will return the value for the ‘default’ attribute.
# File lib/openwfe/expressions/fe_misc.rb, line 292
292: def expression_name
293:
294: n = lookup_attribute(:name, @applied_workitem)
295:
296: return lookup_attribute(:default, @applied_workitem) \
297: if (not n) or (n.strip == '')
298:
299: n
300: end
If the ‘attributes’ attribute is present, will return its value. Else, will simply return the attributes of the ‘exp’ expression itself (‘name’ and ‘default’ included).
# File lib/openwfe/expressions/fe_misc.rb, line 307
307: def extract_attributes
308:
309: att = lookup_vf_attribute @applied_workitem, :attributes
310: # will currently only work with an attribute hash
311: # whose keys are strings... symbols :(
312:
313: att || @attributes
314: end
# File lib/openwfe/expressions/fe_misc.rb, line 320
320: def extract_children
321: @children
322: end