Class | OpenWFE::ConcurrentIteratorExpression |
In: |
lib/openwfe/expressions/fe_concurrence.rb
|
Parent: | ConcurrenceExpression |
This expression is a mix between a ‘concurrence’ and an ‘iterator’. It understands the same attributes and behaves as an interator that forks its children concurrently.
Some examples :
<concurrent-iterator on-value="sales, logistics, lob2" to-field="p"> <participant field-ref="p" /> </concurrent-iterator>
Within a Ruby process definition :
sequence do set :field => f, :value => %w{ Alan, Bob, Clarence } #... concurrent_iterator :on_field => "f", :to_field => "p" do participant "${p}" end end
template | [RW] |
# File lib/openwfe/expressions/fe_concurrence.rb, line 234 234: def apply (workitem) 235: 236: return reply_to_parent(workitem) \ 237: if @children.length < 1 238: 239: @template = @children[0] 240: 241: @children.clear 242: 243: @workitems = [] 244: 245: iterator = Iterator.new self, workitem 246: 247: return reply_to_parent(workitem) \ 248: unless iterator.has_next? 249: 250: while iterator.has_next? 251: 252: wi = workitem.dup 253: 254: @workitems << wi 255: 256: vars = iterator.next wi 257: 258: rawexp = get_expression_pool.prepare_from_template( 259: self, nil, iterator.index, template, vars) 260: 261: @children << rawexp.fei 262: end 263: 264: super 265: end
# File lib/openwfe/expressions/fe_concurrence.rb, line 267 267: def reply_to_parent (workitem) 268: 269: get_expression_pool.remove(@template) 270: 271: super 272: end