Workflow

Purpose

Access and control of workflow adapter behaviour.

Methods

Binding name: workflow


Method: Map localeText ( stepXml, ConfigXpath )

Reads a workflow step i18n format into a Map. The ConfigXpath syntax is not standard XPath but a variant supported by Apache Configuration. Typically this method is used from the work item enhancement script as specified in the step XML.

<WorkItem transformer="AwfWorkItemEnhancer"/>

Method: List<String> stepNames

Returns a list of all workflow step names.


Method: List<Map> assignees(String stepName)

Returns a list of workflow users who have been identified as assignees for the requested workflow step.


Method: List<Map> uncheckedAssignees(String stepName)

Returns a list of workflow users who have the correct location within an organisation tree but have not yet been identified as assignees for the requested workflow step, i.e: there permissions have not been validated.


Method: syncAssignees(Closure itemNotifier)

Will synchronise all open and active work items and Messages with the current XML workflow step definition assignees.

This is useful when a large number of work items exist and new assignee team members are added/removed. Otherwise, active work item visibility rules will not reflect the current organisational structure.

The itemNotifier closure is optional but allows display of per item messages and the pacing** of the sync process. This closure should return true. Returning anything else will terminate the sync process.

** Pacing can be performed by inserting a sleep() statement of the desired duration within the supplied closure.

Note

If the calculated assignees have not changed since the method was called previously, this method will do nothing.

Step Ids

Transformer generated workflow steps will be skipped by this process. Please use syncInlineAssignees() instead.


Method: syncInlineAssignees(Closure itemNotifier)

Will synchronise all open and active work items and Messages with the work item embedded (inline) XML workflow step definition assignees. This method will enumerate all open and active work items, parsing the embedded workflow step XML and resolving the assignee definition in each. The new assignee(s) will be used to replace current assignees in the work item and linked Message. Unlike the syncAssignees() method call, each call to this method will reevaluate all work items every time.

Note

This method can result in a lot of processing as all serialized step definitions must be re-evaluated.

Examples

def statusMap = workflow.localeText stepXml, "StatusLabels/Label[@name=REVIEWED']"
pipeline.put 'ReviewedStatus', statusMap, 'application/b2box.i18n'
workflow.stepNames().each() { 

    def stepName = "${it}" 

    println stepName 

    workflow.assignees(stepName).each() {
        println "${it}" 
    }

    workflow.uncheckedAssignees(stepName).each() {
        println "${it}" 
    }
}

workflow.syncInlineAssignees(){id, msg ->
    println "----> Syncing work item: " + id + ", Message: " + msg
    true
}