Hi all
When testing a process I was experimenting "strange" behaviour when using
the _*if *condition.engine.register_participant :alpha do |workitem|
puts 'Working on request -->'+workitem.fields['cre_request_id'].to_s+ '
Executing --> ' + workitem.params['task']
end
So I wrote the following test:
*pdef=Ruote.process_definition :name => 'ifcase', :on_cancel =>
'handle_issue', :on_error => 'cancel' do
cursor do
set :field => 'var1', :value => '0'
set :field => 'var2', :value => 'false'
alpha :task => 'start'
alpha :task => 'prepare1'
_if :test => '${f:var1} != 0' do
# cursor do
alpha :task => 'task1'
alpha :task => 'task2'
# end
end
alpha :task => 'prepare2'
_if '${f:var2}' do
# cursor do
alpha :task => 'task3'
alpha :task => 'task4'
alpha :task => 'task5'
# end
end
alpha :task => 'finish'
end
define 'handle_issue' do
alpha :task => 'handle_issue'
end
define 'no_reply' do
alpha :task => 'no_reply'
end
end
wfid = engine.launch(pdef)
engine.wait_for(wfid)
~*
This gives an incorrect behaviour, here is the output:
*Working on request --> Executing --> start
Working on request --> Executing --> prepare1
Working on request --> Executing --> task2
Working on request --> Executing --> prepare2
Working on request --> Executing --> task4
Working on request --> Executing --> finish
*
OK so I'm not sure if it is "normal" or not the *_if *documentation does
dot suggest that you have to wrap your if-dependent activities with
something.
It looks to me that the _if "scope" is just limited to the next line, so it
will skip 1 line in my case.
Nevertheless I tried :
*pdef=Ruote.process_definition :name => 'ifcase', :on_cancel =>
'handle_issue', :on_error => 'cancel' do
cursor do
set :field => 'var1', :value => '0'
set :field => 'var2', :value => 'false'
alpha :task => 'start'
alpha :task => 'prepare1'
_if :test => '${f:var1} != 0' do
cursor do
alpha :task => 'task1'
alpha :task => 'task2'
end
end
alpha :task => 'prepare2'
_if '${f:var2}' do
cursor do
alpha :task => 'task3'
alpha :task => 'task4'
alpha :task => 'task5'
end
end
alpha :task => 'finish'
end
define 'handle_issue' do
alpha :task => 'handle_issue'
end
define 'no_reply' do
alpha :task => 'no_reply'
end
end
wfid = engine.launch(pdef)
engine.wait_for(wfid)
*
And it's give a correct output.
*Working on request --> Executing --> start
Working on request --> Executing --> prepare1
Working on request --> Executing --> prepare2
Working on request --> Executing --> finish
*
So I'm not sure if it is an issue or not, may be just a change in the
documentation, but then it has definitely to be mentioned clearly.
Cheers
--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en