Class | OpenWFE::ProcessStatus |
In: |
lib/openwfe/engine/status_methods.rb
|
Parent: | Object |
ProcessStatus represents information about the status of a workflow process instance.
The status is mainly a list of expressions and a hash of errors.
Instances of this class are obtained via Engine.process_status().
errors | [R] | A hash whose values are ProcessError instances, the keys are FlowExpressionId instances (fei) (identifying the expressions that are concerned with the error) |
expressions | [R] |
The list of the expressions currently active in the process instance.
For instance, if your process definition is currently in a concurrence, more than one expressions may be listed here. |
launch_time | [R] | The time at which the process got launched. |
paused | [RW] | Is the process currently in pause ? |
variables | [R] | The variables hash as set in the process environment (the process scope). |
wfid | [R] | the String workflow instance id of the Process. |
Builds an empty ProcessStatus instance.
# File lib/openwfe/engine/status_methods.rb, line 91 91: def initialize 92: 93: @wfid = nil 94: @expressions = [] 95: @errors = {} 96: @launch_time = nil 97: @variables = nil 98: end
this method is used by Engine.get_process_status() when it prepares its results.
# File lib/openwfe/engine/status_methods.rb, line 155 155: def << (item) 156: 157: if item.kind_of?(FlowExpression) 158: add_expression item 159: else 160: add_error item 161: end 162: end
Returns true if the process is in pause.
# File lib/openwfe/engine/status_methods.rb, line 145 145: def paused? 146: 147: #@expressions.first.paused? 148: @paused 149: end
A String representation, handy for debugging, quick viewing.
# File lib/openwfe/engine/status_methods.rb, line 167 167: def to_s 168: 169: s = [] 170: 171: s << "-- #{self.class.name} --" 172: s << " wfid : #{@wfid}" 173: s << " launch_time : #{launch_time}" 174: s << " tags : #{tags.join(", ")}" 175: s << " errors : #{@errors.size}" 176: s << " paused : #{paused?}" 177: 178: s << " expressions :" 179: @expressions.each do |fexp| 180: s << " #{fexp.fei.to_s}" 181: end 182: 183: s.join "\n" 184: end
Returns the workflow definition name for this process.
# File lib/openwfe/engine/status_methods.rb, line 103 103: def wfname 104: 105: @expressions.first.fei.wfname 106: end
Returns the workflow definition revision for this process.
# File lib/openwfe/engine/status_methods.rb, line 113 113: def wfrevision 114: 115: @expressions.first.fei.wfrevision 116: end
# File lib/openwfe/engine/status_methods.rb, line 221 221: def add_error (error) 222: 223: @errors[error.fei] = error 224: end
# File lib/openwfe/engine/status_methods.rb, line 188 188: def add_expression (fexp) 189: 190: if fexp.is_a?(Environment) 191: @variables = fexp.variables if fexp.fei.expid == "0" 192: return 193: end 194: 195: set_wfid fexp.fei.parent_wfid 196: 197: @launch_time = fexp.apply_time if fexp.fei.expid == '0' 198: 199: exps = @expressions 200: @expressions = [] 201: 202: added = false 203: @expressions = exps.collect do |fe| 204: if added or fe.fei.wfid != fexp.fei.wfid 205: fe 206: else 207: if OpenWFE::starts_with(fexp.fei.expid, fe.fei.expid) 208: added = true 209: fexp 210: elsif OpenWFE::starts_with(fe.fei.expid, fexp.fei.expid) 211: added = true 212: fe 213: else 214: fe 215: end 216: end 217: end 218: @expressions << fexp unless added 219: end