internal package Foswiki::Plugins::WorkflowPlugin::ControlledTopic internal package Foswiki::Plugins::WorkflowPlugin::ControlledTopic A thin layer over the meta for a topic that carries meta-information about the workflow in an easy-to-access way, and provides operations that support the plugin.
ClassMethod new($workflow, $web, $topic) $workflow - pointer to Workflow object
$web - web name
$topic - topic name
ClassMethod load($web, $topic [, $rev]) $web - web name
$topic - topic name
$rev - optional topic revision to load
Will die if it detects anything wrong with the load
ObjectMethod getCurrentStateName() → $statename Get the name of the current state of the workflow in this topic
ObjectMethod getCurrentState() → \%state Get the row of the workflow state table for the current state of this topic
ObjectMethod getForm() → $formname Get the name of the currently attached form.
ObjectMethod getLast($state) → \%history Get the history record stored from the last time the topic transitioned to the given state. Transition records contain at least state and date
ObjectMethod getLastBefore($date) → \%history Get the last history record stored from before the given date.
ObjectMethod setState($statename) Set the current state. Note does not record history, doesn't change the form.
ObjectMethod setForm($formname) Set the current form.
ObjectMethod haveNextState($action) → $boolean Return true if a new state is available from the current state using this action
ObjectMethod canEdit() → $boolean Determine if workflow allows editing for the current user.
ObjectMethod canView() → $boolean Determine if workflow allows viewing for the current user.
ObjectMethod canTransition($action) → $boolean $action - the action to test
ObjectMethod changeState($action[, $comment [,$breaklock]]) → $form $action - the action from the current state
$comment - comment accompanying the state change
$breaklock - if true, stomp over any lease on the topic
@return the name of the new form, if the form has changed, undef otherwise
ObjectMethod notifyTransition($transition [, %options]) $transition - reference to a transition that must exist in the workflow object for this controlled topic.
%options can include: default_template - required to tell what temaplte to use
template - alternative to the default_template
ObjectMethod save($lockdown) lockdown can be used to lock the topic for changes after save.
StaticMethod handleSave($meta) beforeSaveHandler - check if the temporaryGrant flag is set, and if not remove any temporary grant from the meta.
ObjectMethod fork(\@forks [,$lockdown]) → $string \@forks - array of hashes each containing web, topic for the topics being created
$lockdown - if true, will lock down this topic for changes after the cloning is complete
If any of the clone topic names are AUTOINC, will modify the @$forks to reflect the actual topic name used.
Returns alist of the topics created.
Will throw WorkflowException if there's a problem (or Error if there's a deeper problem)ObjectMethod expandMacros($text) → $expandedText