Class: Ruote::Exp::RefExpression
- Inherits:
-
FlowExpression
- Object
- FlowExpression
- Ruote::Exp::RefExpression
- Defined in:
- lib/ruote/exp/fe_ref.rb
Overview
Sometimes you don't know at 'design time', if you want to trigger a participant or subprocess.
Ruote.process_definition do
sequence do
participant 'alice'
ref '${solver}'
participant 'charlie'
end
end
In this process, solver's name could be a participant name or a subprocess name.
Subprocesses have the priority over participants.
Note : this expression is used by the worker when substituting unknown expression names with participant or subprocess refs.
Constant Summary
Constant Summary
Constants inherited from FlowExpression
FlowExpression::COMMON_ATT_KEYS
Instance Attribute Summary
Attributes inherited from FlowExpression
Instance Method Summary (collapse)
Methods inherited from FlowExpression
#ancestor?, #att, #attribute, #attribute_text, #attributes, #cancel, #compile_atts, #compile_variables, do_action, #do_apply, #do_cancel, #do_fail, #do_persist, #do_reply, #do_unpersist, #expand_atts, #fei, fetch, from_h, #handle_on_error, #has_attribute, #initial_persist, #initialize, #iterative_var_lookup, #launch_sub, #lookup_on_error, #lookup_val, #lookup_val_prefix, #lookup_variable, #name, names, #parent, #parent_id, #persist_or_raise, #reply, #reply_to_parent, #set_variable, #to_h, #tree, #tree_children, #try_persist, #try_unpersist, #unpersist_or_raise, #unset_variable, #update_tree, #variables
Methods included from WithMeta
Methods included from WithH
Constructor Details
This class inherits a constructor from Ruote::Exp::FlowExpression
Instance Method Details
- (Object) apply
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/ruote/exp/fe_ref.rb', line 52 def apply key = (attribute(:ref) || attribute_text).to_s if name != 'ref' key = name tree[1]['ref'] = key end key2, value = iterative_var_lookup(key) tree[1]['ref'] = key2 if key2 tree[1]['original_ref'] = key if key2 != key unless value # # seems like it's participant @h['participant'] = @context.plist.lookup_info(tree[1]['ref'], h.applied_workitem) value = key2 if ( ! @h['participant']) && (key2 != key) end if value.is_a?(Array) && value.size == 2 && value.last.is_a?(Hash) # # participant 'defined' in var @h['participant'] = value end unless value || @h['participant'] # # unknown participant or subprocess @h['state'] = 'failed' persist_or_raise raise("unknown participant or subprocess '#{tree[1]['ref']}'") end new_exp = if @h['participant'] @h['participant'] = nil if @h['participant'].respond_to?(:consume) # instantiated participant tree[0] = 'participant' @h['name'] = 'participant' Ruote::Exp::ParticipantExpression.new(@context, @h) else tree[0] = 'subprocess' @h['name'] = 'subprocess' Ruote::Exp::SubprocessExpression.new(@context, @h) end do_schedule_timeout(attribute(:timeout)) if tree[0] == 'subprocess' # # since ref neutralizes consider_timeout because participant expressions # handle timeout by themselves, we have to force timeout consideration # for subprocess expressions #new_exp.initial_persist # not necessary new_exp.apply end |
- (Object) consider_timeout
120 121 122 123 |
# File 'lib/ruote/exp/fe_ref.rb', line 120 def consider_timeout # neutralized end |