Class: OpenWFE::InFlowWorkItem
- Inherits:
-
InFlowItem
- Object
- WorkItem
- InFlowItem
- OpenWFE::InFlowWorkItem
- Defined in:
- lib/openwfe/workitem.rb
Overview
When the term ‘workitem’ is used it’s generally referring to instances of this InFlowWorkItem class. InFlowWorkItem are circulating within process instances and carrying data around. Their ‘payload’ is located in their attribute Hash field.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#dispatch_time ⇒ Object
Returns the value of attribute dispatch_time.
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#history ⇒ Object
Returns the value of attribute history.
-
#store ⇒ Object
Returns the value of attribute store.
Attributes inherited from InFlowItem
#flow_expression_id, #participant_name
Attributes inherited from WorkItem
Class Method Summary collapse
-
.from_h(h) ⇒ Object
Rebuilds an InFlowWorkItem from its hash version.
Instance Method Summary collapse
-
#get_boolean_result ⇒ Object
Returns true or false.
-
#get_result ⇒ Object
Just a shortcut (for consistency) of.
-
#set_result(result) ⇒ Object
Sets the ‘__result__’ field of this workitem.
-
#to_h ⇒ Object
For some easy YAML encoding, turns the workitem into a Hash (Any YAML-enabled platform can thus read it).
-
#to_s ⇒ Object
Outputting the workitem in a human readable format.
-
#unset_result ⇒ Object
Makes sure the ‘__result__’ field of this workitem is empty.
Methods inherited from InFlowItem
#last_expression_id, #last_expression_id=
Methods inherited from WorkItem
#[], #[]=, #dup, #has_attribute?, #initialize, #lookup_attribute, #method_missing, #set_attribute, #touch, #unset_attribute
Constructor Details
This class inherits a constructor from OpenWFE::WorkItem
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OpenWFE::WorkItem
Instance Attribute Details
#dispatch_time ⇒ Object
Returns the value of attribute dispatch_time.
286 287 288 |
# File 'lib/openwfe/workitem.rb', line 286 def dispatch_time @dispatch_time end |
#filter ⇒ Object
Returns the value of attribute filter.
286 287 288 |
# File 'lib/openwfe/workitem.rb', line 286 def filter @filter end |
#history ⇒ Object
Returns the value of attribute history.
286 287 288 |
# File 'lib/openwfe/workitem.rb', line 286 def history @history end |
#store ⇒ Object
Returns the value of attribute store.
288 289 290 |
# File 'lib/openwfe/workitem.rb', line 288 def store @store end |
Class Method Details
.from_h(h) ⇒ Object
Rebuilds an InFlowWorkItem from its hash version.
330 331 332 333 334 335 336 337 |
# File 'lib/openwfe/workitem.rb', line 330 def InFlowWorkItem.from_h (h) wi = super wi.dispatch_time = h[:dispatch_time] wi.history = h[:history] wi.filter = h[:filter] wi end |
Instance Method Details
#get_boolean_result ⇒ Object
Returns true or false.
368 369 370 371 372 373 |
# File 'lib/openwfe/workitem.rb', line 368 def get_boolean_result r = get_result return false unless r (r == true or r == "true") end |
#get_result ⇒ Object
Just a shortcut (for consistency) of
workitem.attributes["__result__"]
360 361 362 363 |
# File 'lib/openwfe/workitem.rb', line 360 def get_result @attributes[FIELD_RESULT] end |
#set_result(result) ⇒ Object
Sets the ‘__result__’ field of this workitem
342 343 344 345 |
# File 'lib/openwfe/workitem.rb', line 342 def set_result (result) @attributes[FIELD_RESULT] = result end |
#to_h ⇒ Object
For some easy YAML encoding, turns the workitem into a Hash (Any YAML-enabled platform can thus read it).
318 319 320 321 322 323 324 325 |
# File 'lib/openwfe/workitem.rb', line 318 def to_h h = super h[:dispatch_time] = @dispatch_time h[:history] = @history h[:filter] = @filter h end |
#to_s ⇒ Object
Outputting the workitem in a human readable format
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/openwfe/workitem.rb', line 295 def to_s s = "" s << " #{self.class} :\n" s << " - flow_expression_id : #{@flow_expression_id}\n" s << " - participant_name : #{@participant_name}\n" s << " - last_modified : #{@last_modified}\n" s << " - dispatch_time : #{@dispatch_time}\n" s << " - attributes :\n" s << " {\n" @attributes.keys.sort.each do |k| v = @attributes[k] s << " #{k.inspect} => #{v.inspect},\n" end s << " }" s end |
#unset_result ⇒ Object
Makes sure the ‘__result__’ field of this workitem is empty.
350 351 352 353 |
# File 'lib/openwfe/workitem.rb', line 350 def unset_result @attributes.delete FIELD_RESULT end |