Class | OpenWFE::InFlowWorkItem |
In: |
lib/openwfe/extras/participants/activeparticipants.rb
lib/openwfe/workitem.rb |
Parent: | Object |
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.
db_id | [RW] | |
dispatch_time | [RW] | |
filter | [RW] | |
history | [RW] | |
store | [RW] |
Rebuilds an InFlowWorkItem from its hash version.
# File lib/openwfe/workitem.rb, line 330 330: def InFlowWorkItem.from_h (h) 331: 332: wi = super 333: wi.dispatch_time = h[:dispatch_time] 334: wi.history = h[:history] 335: wi.filter = h[:filter] 336: wi 337: end
Returns true or false.
# File lib/openwfe/workitem.rb, line 368 368: def get_boolean_result 369: 370: r = get_result 371: return false unless r 372: (r == true or r == "true") 373: end
Just a shortcut (for consistency) of
workitem.attributes["__result__"]
# File lib/openwfe/workitem.rb, line 360 360: def get_result 361: 362: @attributes[FIELD_RESULT] 363: end
Sets the ‘result’ field of this workitem
# File lib/openwfe/workitem.rb, line 342 342: def set_result (result) 343: 344: @attributes[FIELD_RESULT] = result 345: end
For some easy YAML encoding, turns the workitem into a Hash (Any YAML-enabled platform can thus read it).
# File lib/openwfe/workitem.rb, line 318 318: def to_h 319: 320: h = super 321: h[:dispatch_time] = @dispatch_time 322: h[:history] = @history 323: h[:filter] = @filter 324: h 325: end
Outputting the workitem in a human readable format
# File lib/openwfe/workitem.rb, line 295 295: def to_s 296: 297: s = "" 298: s << " #{self.class} :\n" 299: s << " - flow_expression_id : #{@flow_expression_id}\n" 300: s << " - participant_name : #{@participant_name}\n" 301: s << " - last_modified : #{@last_modified}\n" 302: s << " - dispatch_time : #{@dispatch_time}\n" 303: s << " - attributes :\n" 304: 305: s << " {\n" 306: @attributes.keys.sort.each do |k| 307: v = @attributes[k] 308: s << " #{k.inspect} => #{v.inspect},\n" 309: end 310: s << " }" 311: s 312: end