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?, #applied_workitem, #att, #att_text, #attribute, #attribute_text, #attributes, #await, #cancel, #cancel_flanks, #cfei_at, #child_id, #child_ids, #compile_atts, #compile_variables, #debug_id, #deflate, #do, do_action, #do_apply, #do_cancel, #do_fail, #do_pause, #do_persist, #do_reply, #do_reply_to_parent, #do_resume, #do_unpersist, dummy, #fei, fetch, from_h, #handle_on_error, #has_attribute, #initial_persist, #initialize, #is_concurrent?, #iterative_var_lookup, #launch_sub, #lookup_val, #lookup_val_prefix, #lookup_variable, #name, names, #parent, #parent_id, #pause_on_apply, #persist_or_raise, #reply_to_parent, #root, #root_id, #set_variable, #to_h, #tree, #tree_children, #try_persist, #try_unpersist, #unpersist_or_raise, #unset_variable, #update_tree, #variables, #wfid

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
71
72
73
# File 'lib/ruote/exp/fe_cancel_process.rb', line 67

def apply

  @context.storage.put_msg(
    'cancel_process',
    'wfid' => h.fei['wfid'],
    'flavour' => name == 'kill_process' ? 'kill' : nil)
end

#reply(workitem) ⇒ Object



75
76
77
78
# File 'lib/ruote/exp/fe_cancel_process.rb', line 75

def reply(workitem)

  # never called
end