Class: OpenWFE::CancelProcessExpression
- Inherits:
-
FlowExpression
- Object
- ObjectWithMeta
- FlowExpression
- OpenWFE::CancelProcessExpression
- Includes:
- ConditionMixin
- Defined in:
- lib/openwfe/expressions/fe_cancel.rb
Overview
This expression cancels the current process instance. Use with care.
<sequence>
<participant ref="before" />
<cancel-process />
<participant ref="after" />
</sequence>
the message “after” will never get printed.
Use rather in scenarii like that one :
class TestDefinition1 < ProcessDefinition
def make
process_definition :name => "25_cancel", :revision => "1" do
sequence do
participant "customer"
_cancel_process :if => "${f:no_thanks} == true"
concurrence do
participant "accounting"
participant "logistics"
end
end
end
end
end
Note that the expression accepts an “if” attribute.
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
-
#apply(workitem) ⇒ Object
apply / reply.
Methods included from ConditionMixin
#determine_condition_attribute, #eval_condition
Methods inherited from FlowExpression
#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, #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
#apply(workitem) ⇒ Object
apply / reply
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/openwfe/expressions/fe_cancel.rb', line 86 def apply (workitem) conditional = eval_condition(:if, workitem, :unless) # # for example : <cancel-process if="${approved} == false"/> if conditional == false reply_to_parent(workitem) return end # # else, do cancel the process get_expression_pool.cancel_process(self) # no need to reply to parent end |