workflow::case::insert (private)

 workflow::case::insert -workflow_id workflow_id [ -case_id case_id ] \
    -object_id object_id

Defined in packages/workflow/tcl/case-procs.tcl

Internal procedure that creates a new workflow case in the database. Should not be used by applications. Use workflow::case::new instead.

Switches:
-workflow_id (required)
The ID of the workflow.
-case_id (optional)
-object_id (required)
The object_id which the case is about
Returns:
The case_id of the case. Returns the empty string if no case could be found.
Author:
Lars Pind <lars@collaboraid.biz>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 workflow::case::new workflow::case::new (public) workflow::case::insert workflow::case::insert workflow::case::new->workflow::case::insert db_dml db_dml (public) workflow::case::insert->db_dml db_nextval db_nextval (public) workflow::case::insert->db_nextval db_transaction db_transaction (public) workflow::case::insert->db_transaction

Testcases:
No testcase defined.
Source code:
    db_transaction {
    if { (![info exists case_id] || $case_id eq "") } {
        set case_id [db_nextval "workflow_cases_seq"]
    }
        
        # Create the case
        db_dml insert_case {}

        # Initialize the FSM state to NULL
        db_dml insert_case_fsm {}
    }
    
    return $case_id
Generic XQL file:
<fullquery name="workflow::case::insert.select_initial_state">
    <querytext>
      select state_id
      from   workflow_fsm_states
      where  workflow_id = :workflow_id
      order  by sort_order
      fetch first 1 rows only
    </querytext>
</fullquery>

<fullquery name="workflow::case::insert.insert_case">
    <querytext>
      insert into workflow_cases (
        case_id, workflow_id, object_id
      ) values (
        :case_id, :workflow_id, :object_id
      )      
    </querytext>
</fullquery>

<fullquery name="workflow::case::insert.insert_case_fsm">
    <querytext>
      insert into workflow_case_fsm (
        case_id, parent_enabled_action_id, current_state
      ) values (
        :case_id, null, null
      )
    </querytext>
</fullquery>
packages/workflow/tcl/case-procs.xql

PostgreSQL XQL file:
packages/workflow/tcl/case-procs-postgresql.xql

Oracle XQL file:
packages/workflow/tcl/case-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: