workflow::action::fsm::generate_spec (private)

 workflow::action::fsm::generate_spec [ -action_id action_id ] \
    [ -one_id one_id ] [ -handlers handlers ]

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

Generate the spec for an individual action definition.

Switches:
-action_id
(optional)
The id of the action to generate spec for.
-one_id
(optional)
Same as action_id, just used for consistency across roles/actions/states.
-handlers
(optional)
Returns:
spec The actions spec
Author:
Lars Pind <lars@collaboraid.biz>

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

Testcases:
No testcase defined.
Source code:
    if { $action_id eq "" } {
        if { $one_id eq "" } {
            error "You must supply either action_id or one_id"
        }
        set action_id $one_id
    } else {
        if { $one_id ne "" } {
            error "You can only supply either action_id or one_id"
        }
    }

    get -action_id $action_id -array row

    # Get rid of elements that shouldn't go into the spec
    array unset row short_name
    array unset row action_id
    array unset row workflow_id
    array unset row sort_order
    array unset row assigned_role_id
    array unset row new_state_id
    array unset row callbacks_array
    array unset row callback_ids
    array unset row allowed_roles_array
    array unset row allowed_role_ids
    array unset row enabled_state_ids
    array unset row assigned_state_ids
    array unset row parent_action
    array unset row parent_action_id

    foreach { type namespace } $handlers {
        # type is 'roles', 'actions', 'states', etc.

        # LARS: Ugly as hell with the string range to cut from 'actions' to 'action_ids'

        if { [info exists row(child_[string range $type 0 end-1]_ids)] } {
            set row(child_${type}) [list]
            foreach child_id $row(child_[string range $type 0 end-1]_ids) {
                set child_short_name [${namespace}::get_element  -one_id $child_id  -element short_name]
                set child_spec [${namespace}::generate_spec -one_id $child_id -handlers $handlers]
                lappend row(child_${type}$child_short_name $child_spec
            }
            unset row(child_[string range $type 0 end-1]_ids)
        }
    }

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

    # Get rid of a few defaults
    array set defaults {
        trigger_type user
        always_enabled_p f
    }

    set spec [list]
    foreach name [lsort [array names row]] {
        if { $row($name) ne "" && !([info exists defaults($name)] && $defaults($name) eq $row($name)) } {
            lappend spec $name $row($name)
        }
    }

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

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

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

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