Class: OpenWFE::EvalExpression
- Inherits:
-
FlowExpression
- Object
- ObjectWithMeta
- FlowExpression
- OpenWFE::EvalExpression
- Includes:
- ValueMixin
- Defined in:
- lib/openwfe/expressions/fe_misc.rb
Overview
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 “hello0nhello1”.
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.
Instance Attribute Summary
Attributes inherited from FlowExpression
#apply_time, #attributes, #children, #environment_id, #fei, #parent_id, #raw_representation
Attributes included from Contextual
Instance Method Summary collapse
Methods included from ValueMixin
#apply, #lookup_field_attribute, #lookup_variable_attribute
Methods inherited from FlowExpression
#apply, #cancel, #clean_children, #delete_variable, #dup_environment, #fetch_environment, #fetch_text_content, #get_binding, #get_environment, #get_parent, #get_root_environment, #has_attribute, #initialize, is_definition, is_definition?, #lookup_attribute, #lookup_attributes, #lookup_boolean_attribute, #lookup_comma_list_attribute, #lookup_downcase_attribute, #lookup_ref, #lookup_string_attribute, #lookup_sym_attribute, #lookup_value, #lookup_variable, #lookup_vf_attribute, names, #new_environment, new_exp, #owns_its_environment?, #paused?, #remove_child, #reply_to_parent, #set_variable, #store_itself, #synchronize, #to_s, #to_yaml_properties
Methods included from Contextual
#get_work_directory, #init_service, #lookup
Methods included from Logging
#ldebug, #ldebug_callstack, #lerror, #lfatal, #linfo, #llog, #lunknown, #lwarn
Methods included from OwfeServiceLocator
#get_engine, #get_error_journal, #get_expool, #get_expression_map, #get_expression_pool, #get_expression_storage, #get_expression_storages, #get_journal, #get_participant_map, #get_scheduler, #get_wfid_generator
Methods inherited from ObjectWithMeta
#class_def, meta_def, meta_eval, metaclass
Constructor Details
This class inherits a constructor from OpenWFE::FlowExpression
Instance Method Details
#reply(workitem) ⇒ Object
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/openwfe/expressions/fe_misc.rb', line 193 def reply (workitem) raise "dynamic evaluation of process definitions is not allowed" \ if @application_context[:dynamic_eval_allowed] != true df = lookup_vf_attribute(workitem, 'def') || workitem.get_result return reply_to_parent(workitem) unless df # # currently, 'nothing to eval' means, 'just go on' ldebug { "apply() def is >#{df}<" } raw_expression = build_raw_expression df #puts #puts "======================================" #puts raw_expression.to_s #puts raw_expression.raw_representation #puts "======================================" #puts raw_expression.apply workitem end |