workflow::generate_spec (public)

 workflow::generate_spec -workflow_id workflow_id \
    [ -workflow_handler workflow_handler ] [ -handlers handlers ]

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

Generate a spec for a workflow in array list style. Note that calling this directly with the default arguments will bomb, because workflow::action doesn't implement the required API.

Switches:
-workflow_id
(required)
The id of the workflow to generate a spec for.
-workflow_handler
(defaults to "workflow") (optional)
-handlers
(defaults to " roles workflow::role actions workflow::action ") (optional)
An array-list with Tcl namespaces where handlers for various elements are defined. The keys are identical to the keys in the spec, and the namespaces are where the procs to handle them are defined.
Returns:
The spec for the workflow.
Author:
Lars Pind <lars@collaboraid.biz>
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 workflow::fsm::generate_spec workflow::fsm::generate_spec (public) workflow::generate_spec workflow::generate_spec workflow::fsm::generate_spec->workflow::generate_spec workflow::get workflow::get (public) workflow::generate_spec->workflow::get

Testcases:
No testcase defined.
Source code:
    workflow::get -workflow_id $workflow_id -array row

    set short_name $row(short_name)

    array unset row object_id
    array unset row workflow_id
    array unset row short_name
    array unset row callbacks_array
    array unset row callback_ids
    array unset row callback_impl_names
    array unset row initial_action
    array unset row initial_action_id

    if { (![info exists row(description)] || $row(description) eq "") } {
        array unset row description_mime_type
    }

    set spec [list]

    # Output sorted, and with no empty elements
    foreach name [lsort [array names row]] {
        if { $row($name) ne "" } {
            lappend spec $name $row($name)
        }
    }

    foreach { key namespace } $handlers {
        set subspec [list]

        foreach sub_id [${namespace}::get_ids -workflow_id $workflow_id] {
            set sub_short_name [${namespace}::get_element  -one_id $sub_id  -element short_name]
            set elm_spec [${namespace}::generate_spec -one_id $sub_id -handlers $handlers]

            lappend subspec $sub_short_name $elm_spec
        }
        lappend spec $key $subspec
    }

    set spec [list $short_name $spec]

    return $spec
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: