workflow::role::get_all_info_not_cached (private)

 workflow::role::get_all_info_not_cached -workflow_id workflow_id

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

This proc is for internal use in the workflow API only and should not be invoked directly from application code. Returns all information related to roles for a certain workflow instance. Goes to the database on every invocation and should be used together with util_memoize.

Switches:
-workflow_id
(required)
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 workflow::role::get_all_info workflow::role::get_all_info (private) workflow::role::get_all_info_not_cached workflow::role::get_all_info_not_cached workflow::role::get_all_info->workflow::role::get_all_info_not_cached db_foreach db_foreach (public) workflow::role::get_all_info_not_cached->db_foreach util_memoize_seed util_memoize_seed (public) workflow::role::get_all_info_not_cached->util_memoize_seed workflow::role::get_workflow_id_not_cached workflow::role::get_workflow_id_not_cached (private) workflow::role::get_all_info_not_cached->workflow::role::get_workflow_id_not_cached

Testcases:
No testcase defined.
Source code:
    # For performance we avoid nested queries in this proc
    set role_ids [list]

    db_foreach role_info {} -column_array row {
        set role_id $row(role_id)

        lappend role_ids $role_id

        # store in role,$role_id arrays
        foreach name [array names row] {
            set role,${role_id}($name$row($name)
        }

        # Cache the mapping role_id -> workflow_id
        util_memoize_seed [list workflow::role::get_workflow_id_not_cached -role_id $role_id]  $workflow_id
    }
    
    # Get the callbacks of all roles of the workflow
    foreach role_id $role_ids {
        set role,${role_id}(callbacks) {}
        set role,${role_id}(callback_ids) {}
        array set callback_impl_names,$role_id [list]
        array set callbacks_array,$role_id [list]
    }

    db_foreach role_callbacks {} -column_array row {
        set role_id $row(role_id)

        lappend role,${role_id}(callbacks) "$row(impl_owner_name).$row(impl_name)"
        lappend role,${role_id}(callback_ids) $row(impl_id)

        lappend callback_impl_names,${role_id}(${row(contract_name)}$row(impl_name)
        set callbacks_array,${role_id}($row(impl_id)) [array get row]
    } 
    if { [info exists row] } {
        unset row
    }

    foreach role_id $role_ids {
        set role,${role_id}(callback_impl_names) [array get callback_impl_names,$role_id]
        set role,${role_id}(callbacks_array) [array get callbacks_array,$role_id]
    }

    # Build up the master role_data array
    foreach role_id $role_ids {
        set role_data($role_id) [array get role,$role_id]
    }

    set role_data(role_ids) $role_ids

    return [array get role_data]
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
<fullquery name="workflow::role::get_all_info_not_cached.role_info">
    <querytext>
        select role_id,
               workflow_id,
               short_name,
               pretty_name,
               sort_order
        from   workflow_roles
        where  workflow_id = :workflow_id
        order by sort_order
    </querytext>
</fullquery>

<fullquery name="workflow::role::get_all_info_not_cached.role_callbacks">
    <querytext>
        select c.role_id,
               impl.impl_id,
               impl.impl_owner_name,
               impl.impl_name,  
               ctr.contract_name,
               c.sort_order
        from   workflow_roles r,
               workflow_role_callbacks c,
               acs_sc_impls impl,
               acs_sc_bindings bind,
               acs_sc_contracts ctr
        where  r.workflow_id = :workflow_id
        and    c.role_id = r.role_id
        and    impl.impl_id = c.acs_sc_impl_id
        and    bind.impl_id = impl.impl_id
        and    ctr.contract_id = bind.contract_id
        order  by r.role_id, c.sort_order
    </querytext>
</fullquery>
packages/workflow/tcl/role-procs.xql

[ hide source ]
Show another procedure: