Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
acs-workflow
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
acs-workflow
Commits
689b2fc5
Commit
689b2fc5
authored
Apr 20, 2023
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Beautified source code
parent
4d349199
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
47 deletions
+47
-47
workflow-case-package-body.sql
sql/postgresql/workflow-case-package-body.sql
+47
-47
No files found.
sql/postgresql/workflow-case-package-body.sql
View file @
689b2fc5
...
...
@@ -1399,54 +1399,54 @@ begin
and
place_key
=
'end'
;
if
v_num_rows
=
0
then
return
'f'
;
return
'f'
;
else
/* There is a token in the end place.
* Count the total integer of tokens to make sure the wf is well-constructed.
*/
select
case
when
count
(
*
)
=
0
then
0
when
count
(
*
)
=
1
then
1
else
2
end
into
v_num_rows
from
wf_tokens
where
case_id
=
finished_p__case_id
and
state
in
(
'free'
,
'locked'
);
if
v_num_rows
>
1
then
raise
EXCEPTION
'-20000: The workflow net is misconstructed: Some parallel executions have not finished.'
;
end
if
;
/* Consume that token */
select
token_id
into
v_token_id
from
wf_tokens
where
case_id
=
finished_p__case_id
and
state
in
(
'free'
,
'locked'
);
PERFORM
workflow_case__consume_token
(
finished_p__case_id
,
'end'
,
finished_p__journal_id
,
null
);
update
wf_cases
set
state
=
'finished'
where
case_id
=
finished_p__case_id
;
/* Add an extra entry to the journal */
v_journal_id
:
=
journal_entry__new
(
null
,
finished_p__case_id
,
'case finish'
,
'Case finished'
,
now
(),
null
,
null
,
null
);
return
't'
;
/* There is a token in the end place.
* Count the total integer of tokens to make sure the wf is well-constructed.
*/
select
case
when
count
(
*
)
=
0
then
0
when
count
(
*
)
=
1
then
1
else
2
end
into
v_num_rows
from
wf_tokens
where
case_id
=
finished_p__case_id
and
state
in
(
'free'
,
'locked'
);
if
v_num_rows
>
1
then
raise
EXCEPTION
'-20000: The workflow net is misconstructed: Some parallel executions have not finished.'
;
end
if
;
/* Consume that token */
select
token_id
into
v_token_id
from
wf_tokens
where
case_id
=
finished_p__case_id
and
state
in
(
'free'
,
'locked'
);
PERFORM
workflow_case__consume_token
(
finished_p__case_id
,
'end'
,
finished_p__journal_id
,
null
);
update
wf_cases
set
state
=
'finished'
where
case_id
=
finished_p__case_id
;
/* Add an extra entry to the journal */
v_journal_id
:
=
journal_entry__new
(
null
,
finished_p__case_id
,
'case finish'
,
'Case finished'
,
now
(),
null
,
null
,
null
);
return
't'
;
end
if
;
end
if
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment