Actions

Concept

A Task consists of one or more Actions. Actions can be technical like creating a form, executing a Nashorn script, or finishing the Task. Or they can require user interaction. The main interactive action is waiting for a form to be submitted.

When a new Task is created as a copy of a Task, the Actions belonging to the Task are copied as Actions.

The order in which Actions in a Task are executed is configured using Action Predecessors. These are copied as Action Predecessors after the Task and the Actions have been created.

Action JSON Representation

This example contains two Actions that belong to the same Task.

{
    "actions": {
        "5557e8d9-49c4-46dd-8962-34db13fe6680": {
            "task_uuid": "3a8166d0-ee64-422c-aa11-98a631fa1252",
            "name": "05-AssignAuthority",
            "implementation": "de.ecm4u.faw.api.impl.AssignAuthorityAction",
            "creation_order": 5,
            "params": "classpath:/de/ecm4u/faw/module/simple/actions/05-AssignAuthority-1.0.0.json",
            "module": "simple-module-1.0.0"
        },
        "bd335fd0-ee61-4a4a-ba75-b3d7ee86aa35": {
            "task_uuid": "3a8166d0-ee64-422c-aa11-98a631fa1252",
            "name": "99-TaskFinish",
            "implementation": "de.ecm4u.faw.api.impl.TaskFinishAction",
            "creation_order": 99,
            "params": "classpath:/de/ecm4u/faw/module/simple/actions/99-TaskFinish-1.0.0.json",
            "module": "simple-module-1.0.0"
        }
    }
}

The JSON representation of an Action has seven properites:

  • UUID: The JSON object is keyed by the UUID that identifies the Action.
  • task_uuid: The UUID of the Task this Action belongs to.
  • name: A descriptive name of the Action inside the Task.
  • implementation: The Java class that implements the Action (see below for included implementations).
  • creation_order: The order in which Actions are created as copies of the Actions beloging to a Task.
  • params: The parameters for the Action implementation. This can be an inlined JSON object or a classpath URL pointing to a JSON file included in the Module.
  • module: The module version in which the task fast first included.

Action Predecessor JSON Representation

This example contains an Action Predecessor that makes the first Action above the predecessor of the second.

{
    "actionPredecessors": {
        "8a79a5c0-92a8-4f9b-8cb7-60df61c40ec3": {
            "action_uuid": "bd335fd0-ee61-4a4a-ba75-b3d7ee86aa35",
            "predecessor_uuid": "5557e8d9-49c4-46dd-8962-34db13fe6680",
            "module": "simple-module-1.0.0"
        }
    }
}

The JSON representation of an Action Predecessor has four properites:

  • UUID: The JSON object is keyed by the UUID that identifies the Action.
  • action_uuid: The UUID of the Action that must wait for the predecessor before it can be executed.
  • predecessor_uuid: The UUID of the Action that must be finished before the Action waiting for it can be executed.
  • module: The module version in which the task fast first included.

Parameter Value Resolution

Action Parameters are defined in a JSON object. The key of an item is the name of the parameter, the value of an item is the value of the parameter.

The value can be included verbatim or it can be reference values stored with other objects.

  • prefix $: reference the value of a task, flow or default property. Example: $sys_authority will be resolved to the value of the task property sys_authorty. If no such property exists, the flow property with the same name will be taken.
  • prefix rs:: references the value from the metadata of the default document resource
  • prefix ldrp:default:: references a property of the default document resource
  • prefix cs:: references a value read from the Configuration Service. Example: cs:Defaults:Currency will be resolved to the value of the key Currencyt in the subject Defaults in the Configuration Service.

The action parameter value can be a list of values. Such a list is resolved to the first non null value found.

Pre and Post Hook Scripts

All Actions can optionally run a Textresource script before or after the Action itself is executed. Two special parameters are used to enable these hooks:

  • preHookScript: The name of the script textresource that is run before the Action is executed.
  • postHookScript: The name of the script textresource that is run after the Action is executed.

Include Action Implementations