Previous Topic

Book Contents

Book Index

Next Topic

Writing an Activity Class

A new activity class should be derived from the class

 de.usu.s3.workflow.activities.BasicWorkflowAcitivity

The method execute() must be implemented and it is this method which will be called from the workflow engine at runtime.

To access the input values the input map is used.

The programmer can access parameters in the following way:

String code = (String) params.getParam(de.usu.s3.workflow.meta.activities.RunScript.CODE_PARAM_KEY);

To assign values to the outgoing transitions the programmer assigns the value to the output map.

During execution of an activity, the corresponding node is in the state EXECUTING. To change the node of the activity to the state DONE the programmer simply calls done().

If an error occurs during the execution the programmer may call the method cancel() to stop the execution of a ACTIVE node.

An activity can start as many of its own database transactions as necessary. However, the workflow engine automatically passes one transaction to the activity. All business objects that are passed to the input are loaded through this transaction. This transaction will then be committed (or aborted) by the engine. This depends on whether the node has already reached the state DONE.

In certain situations, more than one node need to user the same transaction (for example, the Deep Copy workflow). The engine ensures that the same transaction is passed to all other activities, which are connected via the transitions that have a flag Keep current transaction set to TRUE.

See Also

Writing New Activities

Description of the Activities

Writing a Class

Extending the Properties Files

Writing an Editor

Assigning the New Activity