lib/ruote/engine/process_status.rb in ruote-2.1.4 vs lib/ruote/engine/process_status.rb in ruote-2.1.5

- old
+ new

@@ -45,13 +45,15 @@ def initialize (context, expressions, errors) @expressions = expressions.collect { |e| Ruote::Exp::FlowExpression.from_h(context, e) } + @expressions.sort! { |a, b| a.fei.expid <=> b.fei.expid } @errors = errors.collect { |e| ProcessError.new(e) } + @errors.sort! { |a, b| a.fei.expid <=> b.fei.expid } end # Returns the expression at the root of the process instance. # def root_expression @@ -98,11 +100,15 @@ # Returns the unique identifier for this process instance. # def wfid - root_expression.fei.wfid + begin + root_expression.fei.wfid + rescue + @errors.first.fei.wfid + end end def definition_name root_expression.attribute('name') || root_expression.attribute_text @@ -142,13 +148,24 @@ @expressions.each do |e| s << " #{e.fei.to_storage_id} : #{e}\n" end s << " errors : #{@errors.size}\n" @errors.each do |e| + s << " #{e.fei.to_storage_id} :\n" if e.fei s << " #{e.inspect}\n" end s + end + + def to_dot (opts={}) + + s = [ "digraph \"process wfid #{wfid}\" {" ] + @expressions.each { |e| s.push(*e.send(:to_dot, opts)) } + @errors.each { |e| s.push(*e.send(:to_dot, opts)) } + s << "}" + + s.join("\n") end def to_h h = {}