Class: OpenWFE::EqualsExpression
- Inherits:
-
ComparisonExpression
- Object
- ObjectWithMeta
- FlowExpression
- ComparisonExpression
- OpenWFE::EqualsExpression
- Defined in:
- lib/openwfe/expressions/fe_equals.rb
Overview
The ‘equals’ expression compares two values. If those values are equal, the field (attribute) of the workitem named ‘__result__’ will be set to true (else false).
Usually, this expression is used within the ‘if’ expression.
<if>
<equals field-value="customer_name" other-value="Dupont" />
<!-- then -->
<participant ref="special_salesman" />
<!-- else -->
<participant ref="ordinary_salesman" />
</if>
(The ‘if’ expression reads the ‘__result__’ field to route the flow either towards the then branch, either towards the else one).
With a Ruby process definition, a variation on the same ‘equals’ :
equals :field_value => "phone", :other_value => "090078367"
equals :field_val => "phone", :other_value => "090078367"
equals :f_value => "phone", :other_value => "090078367"
equals :f_val => "phone", :other_value => "090078367"
equals :f_val => "phone", :other_val => "090078367"
Thus, note that ‘variable’ in an expression attribute can be shortened to ‘var’ or ‘v’. ‘value’ can be shortened to ‘val’ and ‘field’ to ‘f’.
Usually, the “test” attribute of the “if” expression is preferred over this ‘equals’ expression, like in :
<if test="${f:customer_name} == Dupont">
<!-- then -->
<participant ref="special_salesman" />
<!-- else -->
<participant ref="ordinary_salesman" />
</if>
Another shortcut : the ‘participant’ and the ‘subprocess’ expressions accept an optional ‘if’ (or ‘unless’) attribute, so that ifs can be contracted to :
participant :ref => "toto", :if => "${f:customer_name} == Alfred"
subprocess :ref => "special_delivery", :if => "'${f:special}' != ''"
This also works with the implicit form of the participant and the subprocess :
toto :if => "${f:customer_name} == Alfred"
special_delivery :if => "'${f:special}' != ''"
Instance Attribute Summary
Attributes inherited from FlowExpression
#apply_time, #attributes, #children, #environment_id, #fei, #parent_id, #raw_representation
Attributes included from Contextual
Method Summary
Methods inherited from ComparisonExpression
Methods inherited from FlowExpression
#apply, #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