bug_tracker::bug::instance_workflow_create (private)

 bug_tracker::bug::instance_workflow_create -package_id package_id \
    [ -workflow_id workflow_id ]

Defined in packages/bug-tracker/tcl/bug-procs.tcl

Creates a clone of the given workflow for a specific package instance, or reassign an existing clone if it already exists.

Switches:
-package_id (required)
-workflow_id (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 bug_tracker::install::package_instantiate bug_tracker::install::package_instantiate (private) bug_tracker::bug::instance_workflow_create bug_tracker::bug::instance_workflow_create bug_tracker::install::package_instantiate->bug_tracker::bug::instance_workflow_create bug_tracker::install::package_upgrade bug_tracker::install::package_upgrade (private) bug_tracker::install::package_upgrade->bug_tracker::bug::instance_workflow_create bug_tracker::bug::get_package_workflow_id bug_tracker::bug::get_package_workflow_id (public) bug_tracker::bug::instance_workflow_create->bug_tracker::bug::get_package_workflow_id db_0or1row db_0or1row (public) bug_tracker::bug::instance_workflow_create->db_0or1row db_dml db_dml (public) bug_tracker::bug::instance_workflow_create->db_dml workflow::fsm::clone workflow::fsm::clone (public) bug_tracker::bug::instance_workflow_create->workflow::fsm::clone

Testcases:
No testcase defined.
Source code:
    if { ![info exists workflow_id] } {
        set workflow_id [get_package_workflow_id]
    }

    if { ![db_0or1row get_workflow_id {}] } {
        # The workflow package only allows one instance of a workflow to be bound to
        # a given object.  If the workflow doesn't exist for this package instance,
        # we clone the package workflow.  If it does, we just reuse the existing clone.
        set workflow_id [workflow::fsm::clone  -workflow_id $workflow_id  -object_id $package_id]
    }

    db_dml update_project {}

    return $workflow_id
Generic XQL file:
<fullquery name="bug_tracker::bug::instance_workflow_create.get_workflow_id">
    <querytext>
      select w1.workflow_id
      from workflows w, workflows w1
      where w.workflow_id = :workflow_id
        and w.short_name = w1.short_name
        and w1.object_id = :package_id
    </querytext>
</fullquery>

<fullquery name="bug_tracker::bug::instance_workflow_create.update_project">
    <querytext>
      update bt_projects
      set workflow_id = :workflow_id
      where project_id = :package_id
    </querytext>
</fullquery>
packages/bug-tracker/tcl/bug-procs.xql

PostgreSQL XQL file:
packages/bug-tracker/tcl/bug-procs-postgresql.xql

Oracle XQL file:
packages/bug-tracker/tcl/bug-procs-oracle.xql

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