| Class | OpenWFE::EvalExpression |
| In: |
lib/openwfe/expressions/fe_misc.rb
|
| Parent: | FlowExpression |
An advanced expression : it takes the value in a field or variable (or the nested value) and evaluates it as a process definition.
sequence
set :field => "code", :value => "<print>hello 0</print>"
_eval :field_def => "code"
set :field => "code", :value => "_print 'hello 1'"
_eval :field_def => "code"
end
will print "hello0\nhello1".
This expression can be useful for evaluating process definition snippets coming from participants directly.
It‘s also dangerous. This ‘eval’ expression will raise an error if the parameter :dynamic_eval_allowed in the engine‘s application context is not set to true.
# File lib/openwfe/expressions/fe_misc.rb, line 193
193: def reply (workitem)
194:
195: raise "dynamic evaluation of process definitions is not allowed" \
196: if @application_context[:dynamic_eval_allowed] != true
197:
198: df = lookup_vf_attribute(workitem, 'def') || workitem.get_result
199:
200: return reply_to_parent(workitem) unless df
201: #
202: # currently, 'nothing to eval' means, 'just go on'
203:
204: ldebug { "apply() def is >#{df}<" }
205:
206: raw_expression = build_raw_expression df
207:
208: #puts
209: #puts "======================================"
210: #puts raw_expression.to_s
211: #puts raw_expression.raw_representation
212: #puts "======================================"
213: #puts
214:
215: raw_expression.apply workitem
216: end