Commit 689b2fc5 authored by Frank Bergmann's avatar Frank Bergmann

Beautified source code

parent 4d349199
...@@ -1399,54 +1399,54 @@ begin ...@@ -1399,54 +1399,54 @@ begin
and place_key = 'end'; and place_key = 'end';
if v_num_rows = 0 then if v_num_rows = 0 then
return 'f'; return 'f';
else else
/* There is a token in the end place. /* There is a token in the end place.
* Count the total integer of tokens to make sure the wf is well-constructed. * Count the total integer of tokens to make sure the wf is well-constructed.
*/ */
select case when count(*) = 0 then 0 select case when count(*) = 0 then 0
when count(*) = 1 then 1 when count(*) = 1 then 1
else 2 else 2
end into v_num_rows end into v_num_rows
from wf_tokens from wf_tokens
where case_id = finished_p__case_id where case_id = finished_p__case_id
and state in ('free', 'locked'); and state in ('free', 'locked');
if v_num_rows > 1 then if v_num_rows > 1 then
raise EXCEPTION '-20000: The workflow net is misconstructed: Some parallel executions have not finished.'; raise EXCEPTION '-20000: The workflow net is misconstructed: Some parallel executions have not finished.';
end if; end if;
/* Consume that token */ /* Consume that token */
select token_id into v_token_id select token_id into v_token_id
from wf_tokens from wf_tokens
where case_id = finished_p__case_id where case_id = finished_p__case_id
and state in ('free', 'locked'); and state in ('free', 'locked');
PERFORM workflow_case__consume_token ( PERFORM workflow_case__consume_token (
finished_p__case_id, finished_p__case_id,
'end', 'end',
finished_p__journal_id, finished_p__journal_id,
null null
); );
update wf_cases update wf_cases
set state = 'finished' set state = 'finished'
where case_id = finished_p__case_id; where case_id = finished_p__case_id;
/* Add an extra entry to the journal */ /* Add an extra entry to the journal */
v_journal_id := journal_entry__new ( v_journal_id := journal_entry__new (
null, null,
finished_p__case_id, finished_p__case_id,
'case finish', 'case finish',
'Case finished', 'Case finished',
now(), now(),
null, null,
null, null,
null null
); );
return 't'; return 't';
end if; end if;
end if; end if;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment