Class Ruote::Exp::FlowExpression
In: lib/ruote/exp/ro_attributes.rb
lib/ruote/exp/flowexpression.rb
lib/ruote/exp/ro_variables.rb
lib/ruote/exp/ro_persist.rb
Parent: Object

Reopening the FlowExpression class to add [un]persist methods.

Methods

Included Modules

Ruote::WithH Ruote::WithMeta

Constants

VV = %w[ val value ]
COMMON_ATT_KEYS = %w[ if unless forget timeout on_error on_cancel on_timeout ]
VAR_PREFIX_REGEX = /^(\/*)/

Attributes

context  [R] 
h  [R] 

Public Class methods

Fetches an expression from the storage and readies it for service.

Instantiates expression back from hash.

Keeping track of names and aliases for the expression

Public Instance methods

Returns true if the given fei points to an expression in the parent chain of this expression.

Returns the value for attribute ‘key’, this value should be present in the array list ‘values’. If not, the default value is returned. By default, the default value is the first element of ‘values’.

Given something like

  sequence do
    participant 'alpha'
  end

in the context of the participant expression

  attribute_text()

will yield ‘alpha’.

This default implementation cancels all the [registered] children of this expression.

Returns a Hash containing all attributes set for an expression with their values resolved.

Returns a fresh hash of all the variables visible from this expression.

This is used mainly when forgetting an expression.

The raw handling of messages passed to expressions (the fine handling is done in the cancel method).

do_receive(msg)

Alias for do_reply

Like compile_atts, but the keys are expanded as well.

Useful for things like

  set "f:${v:field_name}" => "${v:that_variable}"

Generates a sub_wfid, without hitting storage.

There‘s a better implementation for sure…

Looks up parent with on_error attribute and triggers it

has_att(*args)

Alias for has_attribute

Given a list of attribute names, returns the first attribute name for which there is a value.

Persists and fetches the _rev identifier from the storage.

Only used by the worker when creating the expression.

TODO : redoc rewrite needed

This method is mostly used by the worker when looking up a process name or participant name bound under a variable.

Looks up "on_error" attribute

prefix = ‘on’ => will lookup on, on_val, on_value, on_v, on_var, on_variable, on_f, on_fld, on_field…

Looks up the value of a variable in expression tree (seen from a leaf, it looks more like a stack than a tree)

lv(var, prefix=nil)

Alias for lookup_variable

persist()

Alias for persist_or_raise

A default implementation for all the expressions.

Sets a variable to a given value. (will set at the appropriate level).

Turns this FlowExpression instance into a Hash (well, just hands back the base hash behind it.

Returns the current version of the tree (returns the updated version if it got updated.

unpersist()

Alias for unpersist_or_raise

Updates the tree of this expression

  update_tree(t)

will set the updated tree to t

  update_tree

will copy (deep copy) the original tree as the updated_tree.

Adding a child to a sequence expression :

  seq.update_tree
  seq.updated_tree[2] << [ 'participant', { 'ref' => 'bob' }, [] ]
  seq.do_persist
v(var, prefix=nil)

Alias for lookup_variable

A shortcut to the variables held in the expression (nil if none held).

Protected Instance methods

Returns the flow expression that owns a variable (or the one that should own it) and the var without its potential / prefixes.

Used by lookup_variable and set_variable to extract the prefix in a variable name

(Called by trigger_on_cancel & co)

‘on_{error|timeout|cancel}’ triggering

Sets (or unsets) the value of a local variable

val should be nil in case of ‘unset’.

[Validate]