All Nuxeo CMF documentation versions

Nuxeo Case Management Framework (CMF) 5.5
Nuxeo Case Management Framework (CMF) 1.x

Case Management 5.5

This documentation relates to an old version of the Nuxeo Platform (5.5). You may want to check the User Guide for the latest version of the Nuxeo Platform.
Skip to end of metadata
Go to start of metadata

We have seen in Content Routing documents what a step document is and how to bind it to an operation chain. In this section, we will create a step that creates a task for a user.
How a task is persisted depends on the application. Here are two possible solutions:

  • A Nuxeo DM application might choose to use jBPM to create and manage task.
  • A Nuxeo DM application could create some Task document and persist it somewhere hidden in the repository.

CMF implementation of tasks is based on this second solution and uses a particular type of CaseLink to create a Task (ActionableCaseLink). We will walk through the steps required for task implementation in CMF.

What is a task in Nuxeo CMF ?

CMF is a framework that manages cases. A task in CMF is something to do on a case. A user sees a case in a mailbox via a case link that points to the case. We use this case link to materialize the task. A task is just an extended case link that will persist, on top of the case link metadata, the metadata related to the task. This particular type of case link is called an ActionableCaseLink.

To implement the task, we need at least to know:

  • who should do the task,
  • what should be done,
  • what is the due date,
  • what should happen when the due date is passed.

In CMF, the 'who' is a mailbox. A task is given to a mailbox, anyone who can access the mailbox can do the task.
The 'what should be done' value is selected from a drop-down list on the task (the values of the list being defined in cm_routing_task_type vocabulary).
The user will select the due date using a calendar widget.
To define what should happen when the due date is passed, we add an automatic validation field. If the due date is passed and the automatic validation is set to true, then the task is automatically validated. The AutomaticActionCaseLinkValidatorListener will find such tasks and validate them.

We will use a step to get the information from the user and an operation chain to automatically create the task.

Creating the task step

Information on the step

Now that we know what information are needed for the task, we need to get them from the user. This is done by enabling the user to create a task step, on which he will fill in the needed information.

  1. We add the routing_task schema.
  2. We create the GenericDistributionTask document type. It allows a user to create a task in a generic mailbox.

CMF includes three other types of step documents by default:

  • DistributionTask, that allows a user to create a task for any mailbox;
  • PersonalDistributionTask, that allows a user to create a task for a personal mailbox;
  • DistributionStep, that distributes a case to a mailbox but without creating a task.

We add the ecm type for GenericDistributionTask and the generic_mailboxes_routing_task layout. This is 'classic' Nuxeo configuration. The distribution_mailbox widget is used for a user to select one mailbox. It is an interesting example on passing property (mailboxSuggestionSearchType) to the xhtml of the widget to allow better reuse of the same file.

Information on the task

The task, and therefore the  ActionableCaseLink, will hold the same information as the step. It also need to keep the ID of the step so it can resume the route when the task is done. The actionable_case_link schema provides this information.

The task is created by an automation chain, when the step is run.

Mapping between task and step

ActionableCaseLink

Value taken from

dueDate

Step due date

label

Step label

documentId

Context: the ID of the document being processed. It is in the context of the operation.

stepId

Step: The id of the step, it will be used for the validation/refusal operation chain to resume the documentRoute

actionnable

Configuration: The value true/false is passed in the configuration of this operation

validate chain

Configuration: The value is passed in the configuration of this operation

refuse chain

Configuration: The value is passed in the configuration of this operation

Creating the operation chain that creates the task

When a route reaches a step, the operation chain of the step is run and the document is passed in the context. To create a task in CMF, we need to:

  1. create an actionable case link,
  2. set the value on the case link using the value on the step,
  3. set the step ID value on the case link,
  4. do the distribution using the newly created case link.

The chain is contributed using the chains contribution.

In the three task operation chains implemented by default, we use 3 operations. These operations pass values between each user by putting and object in the context of the chain. The key for those objects can be found in the CaseConstants class or in the DocumentRoutingConstants.

  • The CreateCaseLink operation creates a new case link and puts it in the context.
  • The Mapping operation sets the values of the case link using step information and operation parameter.
  • The distribution operation distribute the case using the created case link.

Running the step

When the step is run, the task operation chain is run to create the task. The user can then see the task in his/her mailbox, and can validate or refuse the task. Validation and refusal can each have a different operation chain.
To help you implement this validate/refusal behavior, we provide some helper classes:

  • ActionableObject enables to implement an interface for objects that can be validated or refused.
  • ActionableValidator is a helper class that can validate or refuse an object and restart the route. It calls the appropriate operation chain, gets the step ID and sets the step to "Done", then resumes the route.

RELATED TOPICS
Document types
Content Automation
Content Routing documents
Route processing and lifecycle

Labels