Index: openacs-4/contrib/obsolete-packages/acs-workflow/sql/oracle/workflow-case-package-body.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/acs-workflow/sql/oracle/workflow-case-package-body.sql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/obsolete-packages/acs-workflow/sql/oracle/workflow-case-package-body.sql 19 Nov 2001 18:17:46 -0000 1.1 +++ openacs-4/contrib/obsolete-packages/acs-workflow/sql/oracle/workflow-case-package-body.sql 3 Jan 2002 00:58:44 -0000 1.2 @@ -1967,7 +1967,26 @@ ); end finish_task; + function get_task_id ( + case_id in wf_cases.case_id%TYPE, + transition_key in wf_transitions.transition_key%TYPE + ) return wf_tasks.task_id%TYPE + is + v_task_id number; + begin + select task_id into v_task_id + from wf_tasks + where case_id = get_task_id.case_id and + transition_key = get_task_id.transition_key; + + return v_task_id; + + exception when no_data_found then + raise_application_error(-20000, 'Case ' || case_id || 'has no transition with key ' || transition_key); + + end get_task_id; + end workflow_case; / show errors; Index: openacs-4/contrib/obsolete-packages/acs-workflow/sql/oracle/workflow-case-package-head.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/acs-workflow/sql/oracle/workflow-case-package-head.sql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/obsolete-packages/acs-workflow/sql/oracle/workflow-case-package-head.sql 19 Nov 2001 18:17:46 -0000 1.1 +++ openacs-4/contrib/obsolete-packages/acs-workflow/sql/oracle/workflow-case-package-head.sql 3 Jan 2002 00:58:44 -0000 1.2 @@ -148,7 +148,14 @@ transition_key in wf_transitions.transition_key%TYPE ); + -- DRB: I added this function because there appeared to be no way for a + -- client to get the task_id without querying the wf_tasks table directly, + -- breaking the PL/SQL abstraction. + function get_task_id ( + case_id in wf_cases.case_id%TYPE, + transition_key in wf_transitions.transition_key%TYPE + ) return wf_tasks.task_id%TYPE; /* DBMS_JOBS */ Index: openacs-4/contrib/obsolete-packages/acs-workflow/sql/postgresql/workflow-case-package-body.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/acs-workflow/sql/postgresql/workflow-case-package-body.sql,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/obsolete-packages/acs-workflow/sql/postgresql/workflow-case-package-body.sql 24 Dec 2001 02:50:17 -0000 1.2 +++ openacs-4/contrib/obsolete-packages/acs-workflow/sql/postgresql/workflow-case-package-body.sql 3 Jan 2002 00:58:44 -0000 1.3 @@ -2047,8 +2047,24 @@ return 0; end;' language 'plpgsql'; +create function workflow_case__get_task_id (integer, integer) +returns integer as ' +declare + get_task_id__case_id alias for $1; + get_task_id__transition_key alias for $2; + v_task_id integer; +begin + select task_id into v_task_id + from wf_tasks + where case_id = get_task_id__case_id and + transition_key = get_task_id__transition_key; --- show errors + if not found then + raise error ''Case % has no transition with key %'', get_task_id__case_id, get_task_id__transition_key; + return v_task_id; +end;' language 'plpgsql'; + +