Class: Ruote::Exp::RegisterpExpression
- Inherits:
-
FlowExpression
- Object
- FlowExpression
- Ruote::Exp::RegisterpExpression
- Defined in:
- lib/ruote/exp/fe_registerp.rb
Overview
This expressions lets one register participants directly from a process definition.
pdef = Ruote.define do
registerp 'alpha', :class => 'MyParticipant', :target => 'mail'
# register participant named 'alpha' with the given class
# and some attributes
registerp /^user_.+/, :class => 'MyParticipant'
registerp :regex => '^user_.+', :class => 'MyParticipant'
# register participant with a given regular expression
registerp 'admin', :class => 'MyParticipant', :position => -2
# register participant 'admin' as second to last in participant list
end
Participant info can be given as attributes to the expression (see code above) or via the workitem.
pdef = Ruote.define do
registerp :participant => 'participant'
# participant info is found in the field 'participant'
registerp :participants => 'participants'
# an array of participant info is found in the field 'participants'
end
The expression ‘unregisterp’ can be used to remove participants from the participant list.
Direct Known Subclasses
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_pause, #do_persist, #do_reply, #do_resume, #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_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
#apply ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/ruote/exp/fe_registerp.rb', line 65 def apply registerp_allowed? if pa = attribute('participant') register_participant(h.applied_workitem['fields'][pa]) elsif pas = attribute('participants') h.applied_workitem['fields'][pas].each do |part| register_participant(part) end else register_participant(attributes) end reply_to_parent(h.applied_workitem) end |
#reply(workitem) ⇒ Object
87 88 89 90 |
# File 'lib/ruote/exp/fe_registerp.rb', line 87 def reply(workitem) # never called end |