workflow::state::fsm::generate_short_name (public)

 workflow::state::fsm::generate_short_name -workflow_id workflow_id \
    -pretty_name pretty_name [ -short_name short_name ] \
    [ -state_id state_id ]

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

Generate a unique short_name from pretty_name.

Switches:
-workflow_id (required)
-pretty_name (required)
-short_name (optional)
-state_id (optional)
If you pass in this, we will allow that state's short_name to be reused.

Partial Call Graph (max 5 caller/called nodes):
%3 workflow::state::fsm::edit workflow::state::fsm::edit (public) workflow::state::fsm::generate_short_name workflow::state::fsm::generate_short_name workflow::state::fsm::edit->workflow::state::fsm::generate_short_name _ _ (public) workflow::state::fsm::generate_short_name->_ util_text_to_url util_text_to_url (public) workflow::state::fsm::generate_short_name->util_text_to_url workflow::state::fsm::get_existing_short_names workflow::state::fsm::get_existing_short_names (public) workflow::state::fsm::generate_short_name->workflow::state::fsm::get_existing_short_names

Testcases:
No testcase defined.
Source code:
    set existing_short_names [workflow::state::fsm::get_existing_short_names  -workflow_id $workflow_id  -ignore_state_id $state_id]

    if { $short_name eq "" } {
        if { $pretty_name eq "" } {
            error "Cannot have empty pretty_name when short_name is empty"
        }
        set short_name [util_text_to_url  -replacement "_"  -existing_urls $existing_short_names  -text $pretty_name]
    } else {
        # Make lowercase, remove illegal characters
        set short_name [string tolower $short_name]
        regsub -all {[- ]} $short_name {_} short_name
        regsub -all {[^a-zA-Z_0-9]} $short_name {} short_name

        if {$short_name in $existing_short_names} {
            error "State with short_name '$short_name' already exists in this workflow."
        }
    }

    return $short_name
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/workflow/tcl/state-procs.xql

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