loading table of contents...

4.1. Defining Workflows

A useful notation for defining workflows are activity diagrams as specified by the Unified Modeling Language (UML). CoreMedia Workflow definitions are based on activity diagrams. They have to be converted to a CoreMedia CMS specific XML format for the workflow engine.

After presenting a small example, the notation of activity diagrams is presented and the translation into the CoreMedia Workflow XML is shown.

Figure 4.1, “Activity diagram of a simple workflow” describes the following simple workflow with an activity diagram:

A resource is created by one user (an editor) and approved and published by another user (the chief editor). More precisely, the users fill the roles editor and chief editor, respectively. The workflow "edit and publish resource" consists of the following tasks:

  • A user of the role editor creates and edits a document.

  • A user of the chief editor role now has to read the resulting document and judge whether to approve or disapprove it.

  • If the document is approved, the chief editor is requested to publish it.

  • If the resource is not approved, the resource has to be changed again by the first user.

Activity diagram of a simple workflow

Figure 4.1. Activity diagram of a simple workflow


In the following you will find a description of the UML elements used for the definition of workflows and their mapping to the XML format used by CoreMedia Workflow. The details of the XML elements are given in the Section 6.2, “XML Element Reference”, the workflow XML reference.

In the CoreMedia Workflow, a workflow is defined in a file using XML syntax. A formal description of the syntax of this XML file can be found in the corresponding DTD coremedia-workflow.dtd which is located in the zipped xml folder of the lib/cap-schema-bundle-<version>.jar file. In principle, the workflow file must obey the DTD, but cannot be validated against the DTD in all cases. The reason is that CoreMedia Workflow XML can be customized by using your own extensions. It is not possible to capture all future extensions in a static DTD, so the DTD only describes the basis for CoreMedia Workflow XML.

In the following sections the important syntactical concepts of the workflow description are explained. The elements of the workflow definition can be seen as elements of a programming language. The following table shows this correlation (not all XML elements are included):

Syntax element of programming language

respective elements of the workflow definition

variable

Variable,AggregationVariable

expression, comparator, function

Equal, NotEqual, Greater, GreaterEqual, Less, LessEqual, And, Or, Implies, Not, ForAll, Exists, Let, Get, Read, Length, IsEmpty, NotEmpty, IsFolder, IsDocument, IsDocumentVersion

data type

value classes: Blob, Boolean, Content, ContentType, Date, Document, Folder, Group, Integer, String, Timer, User

flow control

Fork, Join, If, Choice, Switch, Case

precondition, postcondition

PreCondition, PostCondition

procedure

Action, EntryAction, ExitAction

sub program

ForkSubprocess, JoinSubprocess

Table 4.1. Workflow elements vs. programming language