Class OpenWFE::DefineExpression
In: lib/openwfe/expressions/fe_define.rb
Parent: SequenceExpression

The <process-definition> expression.

Methods

Attributes

body_fei  [RW]  A pointer to the body expression of this process definition.

Public Instance methods

Called at the end of the ‘evaluation’, the ‘apply’ operation on the body of the definition is done here.

[Source]

    # File lib/openwfe/expressions/fe_define.rb, line 75
75:         def reply_to_parent (workitem)
76: 
77:             #return if @eval_only
78: 
79:             #puts "/// \n   bf #{@body_fei} \n   wi.fei #{workitem.fei}"
80: 
81:             return super(workitem) \
82:                 if @body_fei == nil or @body_fei == workitem.fei
83:                 #unless @body_fei
84: 
85:             #_fei = @body_fei
86:             #@body_fei = nil
87:             #store_itself
88:             #get_expression_pool.apply _fei, workitem
89: 
90:             get_expression_pool.apply @body_fei, workitem
91:         end

Overrides the set_variable in FlowExpression to make sure to intercept requests for binding subprocesses at the engine level and to store a copy of the raw expression, not only the flow expression id.

[Source]

     # File lib/openwfe/expressions/fe_define.rb, line 99
 99:         def set_variable (name, fei)
100: 
101:             if name[0, 2] == "//"
102: 
103:                 raw_exp = get_expression_pool.fetch_expression(fei).dup
104:                 raw_exp.parent_id = nil
105:                 raw_exp.fei = raw_exp.fei.dup
106:                 fei = raw_exp.fei
107:                 fei.wfid = get_wfid_generator.generate 
108: 
109:                 raw_exp.store_itself
110:             end
111: 
112:             super name, fei
113:         end

Protected Instance methods

Determines the flowExpressionId of the next child to apply.

[Source]

     # File lib/openwfe/expressions/fe_define.rb, line 120
120:             def next_child (current_fei)
121: 
122:                 next_fei = super
123: 
124:                 return nil unless next_fei
125: 
126:                 rawchild = get_expression_pool.fetch_expression next_fei
127: 
128:                 return next_child(next_fei) unless rawchild
129: 
130:                 unless rawchild.is_definition?
131: 
132:                     unless @body_fei
133:                         @body_fei = next_fei
134:                         store_itself
135:                     end
136:                     return next_child(next_fei)
137:                 end
138: 
139:                 exp_class = get_expression_map.get_class rawchild
140: 
141:                 if exp_class == DefineExpression
142:                     set_variable rawchild.definition_name, next_fei
143:                     return next_child(next_fei)
144:                 end
145: 
146:                 next_fei
147:                     #
148:                     # expression is a 'set', a 'filter-definition' or
149:                     # something like that, let it get applied
150:             end

[Validate]