Previous Topic

Book Contents

Book Index

Next Topic

Writing a Class

Write a class that holds some general information about the activity.

The System needs some information about the new activity. For example, you must specify if the new activity is a user activity or a system activity.

Furthermore, the system must know which activity, input and output parameters should be available. The activity parameters are edited during the creation of the meta workflow, while the input and output arguments, which are carried from/to the node by the incoming and outgoing transitions, are set at runtime.

You declare all this information in a specific class, which implements the interface MetaMetaInfo. Normally, such classes are located in package de.usu.s3.workflow.meta.activities. The easiest way to implement such a class is to copy and adapt the class BasicMetaActivity or one of its subclasses (BasicMetaCondition, BasicMetaExternalActivity, BasicMetaSystemActivity, BasicMetaUserActivity).

To define the input and output arguments, you can call the methods initializeInputArguments(INPUT_ARGS) and initializeOutputArguments (OUTPUT_ARGS) with an Array of String Arrays. Each String Array must contain exactly two strings. One holds the argument type and the other is intended for the argument name.

To define the parameters you have to fill the appropriate maps of the base class like in the following example:

The first block of code assigns the activity parameter names to the default values.

activityDefaultParams.put(MAIL_TEXT_INPUT_ARG,

 "Insert the mail text here... ");

activityDefaultParams.put(MAIL_ADDRESS_INPUT_ARG, "somebody@nowhere.com");

activityDefaultParams.put(MAIL_SUBJECT_INPUT_ARG, "no subject");

activityDefaultParams.put(MAIL_MODE_ARG,

 de.usu.s3.gui.mail.MailModel.AUTOMATIC);

The second code block defines the parameter types. These types are used by the default editor for the given parameters. An activity may return another name than de.usu.s3.workflow.meta.activities.-

AdvancedDefaultActivityParamEditor in the method

getParamEditorClassName to indicate that this class should be used as an editor.

The editor class must meet the following two requirements:

• It must implement the interface de.usu.s3.workflow.meta.metamodel.-

Activity ParamEditor

• In addition, it must extend the class de.gebit.trend.gui.GbasicPanel.

activityParamTypes.put(MAIL_ADDRESS_INPUT_ARG,

 ActivityInitParams.PARAM_TYPE_STRING);

activityParamTypes.put(MAIL_SUBJECT_INPUT_ARG,

  ActivityInitParams.PARAM_TYPE_STRING);

activityParamTypes.put(MAIL_TEXT_INPUT_ARG,

  ActivityInitParams.PARAM_TYPE_STRING);

activityParamTypes.put(MAIL_MODE_ARG,

  ActivityInitParams.PARAM_TYPE_MAIL_MODE);

Finally, the third block defines the order in which the parameters occur in the editor. This block is not necessary if a different editor is used. The order of the parameters may vary during different starts of the editor if the block is absent.

activityDefaultParamOrder = new java.util.ArrayList();

activityDefaultParamOrder.add(MAIL_ADDRESS_INPUT_ARG);

activityDefaultParamOrder.add(MAIL_SUBJECT_INPUT_ARG);

activityDefaultParamOrder.add(MAIL_TEXT_INPUT_ARG);

activityDefaultParamOrder.add(MAIL_MODE_ARG);

An activity class must be connected with the class that is providing the Meta information. This is done by calling setMetaInfo(String aMetaMetaNodeClassName) (i.e. the name of class which provides the meta information) in the activity class and by implementing the method getImplementationClass() in the meta class.

See Also

Writing New Activities

Description of the Activities

Writing an Activity Class

Extending the Properties Files

Writing an Editor

Assigning the New Activity