xowf::Context proc require (public)

 xowf::Context[i] require [ -new ] obj

Defined in /var/www/openacs/packages/xowf/tcl/xowf-procs.tcl

Create the workflow context for an object if needed.

Switches:
-new (optional, defaults to "false")
Discard an existing context and create a fresh one.
Parameters:
obj (required)
Workflow object.
Returns:
The initialized workflow context, or the existing context.

Testcases:
create_workflow_with_instance
Source code:
#
# Make sure, the context object for workflow '$obj exists. The
# flag "-new" can be used to make sure, a new and fresh context is
# available.
#
#:log "START-require"
#
set ctx $obj-wfctx
if {$new && [nsf::is object $ctx]} {
  $ctx destroy
}

if {![nsf::is object $ctx]} {
  set wfContextClass [$obj wf_property workflow_context_class [self]]

  regsub -all \r\n [$obj wf_property workflow_definition] \n workflow_definition
  $wfContextClass create $ctx  -object $obj  -workflow_definition $workflow_definition  -destroy_on_cleanup
  $ctx initialize_context $obj
}

#:log "END-require ctx <$ctx>"
return $ctx
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: