Class OpenWFE::ExpExpression

  1. lib/openwfe/expressions/fe_misc.rb

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.

Methods

public instance

  1. apply

protected instance

  1. expression_name
  2. extract_attributes
  3. extract_children
  4. extract_parameters

Public instance methods

apply (workitem)
[show source]
     # File lib/openwfe/expressions/fe_misc.rb, line 282
282:     def apply (workitem)
283: 
284:       @applied_workitem = workitem
285: 
286:       super
287:     end

Protected instance methods

expression_name ()

Evaluates the ‘name’ attribute, if it’s not present or empty, will return the value for the ‘default’ attribute.

[show source]
     # File lib/openwfe/expressions/fe_misc.rb, line 295
295:     def expression_name
296: 
297:       n = lookup_attribute(:name, @applied_workitem)
298: 
299:       return lookup_attribute(:default, @applied_workitem) \
300:         if (not n) or (n.strip == '')
301:       n
302:     end
extract_attributes ()

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).

[show source]
     # File lib/openwfe/expressions/fe_misc.rb, line 309
309:     def extract_attributes
310: 
311:       att = lookup_vf_attribute(@applied_workitem, :attributes)
312:         # will currently only work with an attribute hash
313:         # whose keys are strings... symbols :(
314: 
315:       att || @attributes
316:     end
extract_children ()
[show source]
     # File lib/openwfe/expressions/fe_misc.rb, line 318
318:     def extract_children
319:       @children
320:     end
extract_parameters ()
[show source]
     # File lib/openwfe/expressions/fe_misc.rb, line 322
322:     def extract_parameters
323:       []
324:     end