lib/ruote/dboard/process_status.rb
# The expressions that compose the process instance.
#
The expressions that compose the process instance.
The expressions that compose the process instance .
def inspect
      vars = variables rescue nil
      avars = (all_variables || {}).remap { |(k, v), h| h[Ruote.sid(k)] = v }
      s = [ "== #{self.class} ==" ]
      s << ''
      s << "  wfid:           #{wfid}"
      s << "  name:           #{definition_name}"
      s << "  revision:       #{definition_revision}"
      s << "  last_active:    #{last_active}"
      s << "  launched_time:  #{launched_time}"
      s << ''
      s << "  expressions: #{@expressions.size}"
      s << ''
      @expressions.each do |e|
        eflags = %w[
          flanking forgotten attached
        ].each_with_object([]) { |f, a| a << f if e.h[f] }
        s << "     #{e.fei.to_storage_id}"
        s << "       | #{e.name}"
        s << "       | _rev: #{e.h._rev.inspect}"
        s << "       | * #{e.state} *" if e.state
        s << "       | #{e.attributes.inspect}"
        e.children.each do |ce|
          s << "       | . child-> #{Ruote.sid(ce)}"
        end if e.children.any?
        s << "       | timers: #{e.h.timers.collect { |t| t[1] }}" if e.h.timers
        s << "       | tagname: #{e.h.tagname}" if e.h.tagname
        s << "       | (#{eflags.join(', ')})" if eflags.any?
        s << "       `-parent--> #{e.h.parent_id ? e.parent_id.to_storage_id : 'nil'}"
      end
      s << ''
      s << "  schedules: #{@schedules.size}"
      if @schedules.size > 0
        @schedules.each do |sched|
          s << "    * #{sched['original']}"
          s << "      #{sched['flavour']} #{sched['at']}"
          s << "      #{sched['action']}"
          s << "      #{Ruote.sid(sched['target']) rescue '** no target **'}"
        end
        s << ''
      end
      s << "  stored workitems: #{@stored_workitems.size}"
      s << ''
      s << "  initial workitem fields:"
      if @root_expression
        s << hinspect(4, @root_expression.h.applied_workitem['fields'])
      else
        s << "    (no root expression identified)"
      end
      s << ''
      s << "  variables:"; s << hinspect(4, vars)
      s << ''
      s << "  all_variables:"; s << hinspect(4, avars)
      s << ''
      s << "  errors: #{@errors.size}"
      @errors.each do |e|
        s << "    ***"
        s << "      #{e.fei.to_storage_id} :" if e.fei
        s << "    action: #{e.action}"
        s << "    message: #{e.message}"
        s << "    trace:"
        e.trace.split("\n").each do |line|
          s << "      #{line}"
        end
        s << "    details:"
        (e.details || '').split("\n").each do |line|
          s << "      #{line}"
        end
        if e.respond_to?(:deviations)
          s << "    deviations:"
          (e.deviations || []).each do |line|
            s << "      #{line.inspect}"
          end
        end
        s << "    fields:"; s << hinspect(6, e.fields)
      end
      s.join("\n") + "\n"
    end
def inspect vars = variables rescue nil avars = ( all_variables || { } ) . remap { | ( k , v ) , h | h [ Ruote . sid ( k ) ] = v } s = [ "== #{self.class} ==" ] s << '' s << "  wfid:           #{wfid}" s << "  name:           #{definition_name}" s << "  revision:       #{definition_revision}" s << "  last_active:    #{last_active}" s << "  launched_time:  #{launched_time}" s << '' s << "  expressions: #{@expressions.size}" s << '' @expressions . each do | e | eflags = %w[ flanking forgotten attached ] . each_with_object ( [ ] ) { | f , a | a << f if e . h [ f ] } s << "     #{e.fei.to_storage_id}" s << "       | #{e.name}" s << "       | _rev: #{e.h._rev.inspect}" s << "       | * #{e.state} *" if e . state s << "       | #{e.attributes.inspect}" e . children . each do | ce | s << "       | . child-> #{Ruote.sid(ce)}" end if e . children . any? s << "       | timers: #{e.h.timers.collect { |t| t[1] }}" if e . h . timers s << "       | tagname: #{e.h.tagname}" if e . h . tagname s << "       | (#{eflags.join(', ')})" if eflags . any? s << "       `-parent--> #{e.h.parent_id ? e.parent_id.to_storage_id : 'nil'}" end s << '' s << "  schedules: #{@schedules.size}" if @schedules . size > 0 @schedules . each do | sched | s << "    * #{sched['original']}" s << "      #{sched['flavour']} #{sched['at']}" s << "      #{sched['action']}" s << "      #{Ruote.sid(sched['target']) rescue '** no target **'}" end s << '' end s << "  stored workitems: #{@stored_workitems.size}" s << '' s << "  initial workitem fields:" if @root_expression s << hinspect ( 4 , @root_expression . h . applied_workitem [ 'fields' ] ) else s << "    (no root expression identified)" end s << '' s << "  variables:" ; s << hinspect ( 4 , vars ) s << '' s << "  all_variables:" ; s << hinspect ( 4 , avars ) s << '' s << "  errors: #{@errors.size}" @errors . each do | e | s << "    ***" s << "      #{e.fei.to_storage_id} :" if e . fei s << "    action: #{e.action}" s << "    message: #{e.message}" s << "    trace:" e . trace . split ( "\n" ) . each do | line | s << "      #{line}" end s << "    details:" ( e . details || '' ) . split ( "\n" ) . each do | line | s << "      #{line}" end if e . respond_to? ( :deviations ) s << "    deviations:" ( e . deviations || [ ] ) . each do | line | s << "      #{line.inspect}" end end s << "    fields:" ; s << hinspect ( 6 , e . fields ) end s . join ( "\n" ) + "\n" end
The expressions that compose the process instance.
The expressions that compose the process instance .
# TODO: add trackers