Class: Ruote::Exp::CancelProcessExpression

Inherits:
FlowExpression show all
Defined in:
lib/ruote/exp/fe_cancel_process.rb

Overview

Cancels a whole process instance.

pdef = Ruote.process_definition :name => 'test' do
  sequence do
    participant :ref => 'editor'
    concurrence do
      participant :ref => 'reviewer1'
      participant :ref => 'reviewer2'
      sequence do
        participant :ref => 'main_reviewer'
        cancel_process :if => '${f:over} == true'
      end
    end
    participant :ref => 'editor'
  end
end

This example has a ‘main_reviewer’ with the ability to cancel the whole process, if he sets the workitem field ‘over’ to ‘true’.

If the goal is to cancel only a segment of a process instance, the expression ‘undo’ (Ruote::Exp::UndoExpression) is better suited.

‘terminate’

Sometimes ‘terminate’ reads better than ‘cancel_process’

Ruote.process_definition do
  alice :task => 'do this'
  terminate :if => '${no_need_for_bob}'
  bob :task => 'do that'
  charly :task => 'just do it'
end

Constant Summary

Constants inherited from FlowExpression

FlowExpression::COMMON_ATT_KEYS

Instance Attribute Summary

Attributes inherited from FlowExpression

#context, #error, #h

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

#class_def, included

Methods included from WithH

included

Constructor Details

This class inherits a constructor from Ruote::Exp::FlowExpression

Instance Method Details

#applyObject



67
68
69
70
# File 'lib/ruote/exp/fe_cancel_process.rb', line 67

def apply

  @context.storage.put_msg('cancel_process', 'wfid' => h.fei['wfid'])
end

#reply(workitem) ⇒ Object



72
73
74
75
# File 'lib/ruote/exp/fe_cancel_process.rb', line 72

def reply(workitem)

  # never called
end