workflow::new_from_spec (public)

 workflow::new_from_spec [ -package_key package_key ] \
    [ -object_id object_id ] -spec spec [ -array array ] \
    [ -workflow_handler workflow_handler ] [ -handlers handlers ]

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

Create a new workflow from spec. Workflows must belong to either a package key or an object id.

Switches:
-package_key (optional)
A package to which this workflow belongs
-object_id (optional)
The id of an ACS Object indicating the scope the workflow. Typically this will be the id of a package type or a package instance but it could also be some other type of ACS object within a package, for example the id of a bug in the Bug Tracker application.
-spec (required)
The workflow spec
-array (optional)
The name of an array in the caller's namespace. Values in this array will override workflow attributes of the workflow being cloned.
-workflow_handler (optional, defaults to "workflow")
-handlers (optional, defaults to " roles workflow::role actions workflow::action ")
Returns:
The ID of the workflow created
Author:
Lars Pind <lars@collaboraid.biz>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 workflow::fsm::new_from_spec workflow::fsm::new_from_spec (public) workflow::new_from_spec workflow::new_from_spec workflow::fsm::new_from_spec->workflow::new_from_spec util_memoize_flush_regexp util_memoize_flush_regexp (public) workflow::new_from_spec->util_memoize_flush_regexp workflow::parse_spec workflow::parse_spec (private) workflow::new_from_spec->workflow::parse_spec

Testcases:
No testcase defined.
Source code:
    if { [llength $spec] > 2 } {
        # Create any additional (child) workflows first, so they're available when creating the main one below
        # Not passing in the array, not keeping the workflow_id
        ${workflow_handler}::new_from_spec  -package_key $package_key  -object_id $object_id  -spec [lrange $spec 2 end]  -workflow_handler $workflow_handler  -handlers $handlers
    }

    set short_name [lindex $spec 0]
    array set workflow_array [lindex $spec 1]

    # Override workflow attributes from the array
    if { $array ne "" } {
        upvar 1 $array row
        foreach name [array names row] {
            if {$name eq "short_name"} {
                set short_name $row($name)
            } else {
                set workflow_array($name$row($name)
            }
        }
    }

    set workflow_id [workflow::parse_spec  -package_key $package_key  -object_id $object_id  -short_name $short_name  -spec [array get workflow_array]  -workflow_handler $workflow_handler  -handlers $handlers]

    # The lookup proc might have cached that there is no workflow
    # with the short name of the workflow we have now created so
    # we need to flush
    util_memoize_flush_regexp {^workflow::get_id_not_cached}

    return $workflow_id
Generic XQL file:
packages/workflow/tcl/workflow-procs.xql

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

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

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