Implementing a task

A task can be added on the fly during runtime. You implement a task class and put that class under Swordfish_installed_directory/custom directory. Then it will be automatically loaded when you open flow designer.

To implement a task, a task class must implement TaskHandler and define an TaskDefinition java annotation.

TaskHandler interface

Signature

Description

Used when extra additional initialization is required for a task

Parameters

props - input attributes defined in flow.

Return

boolean value.

  • True - initialization succeeded

  • False - initialization failed

Signature

Description

Main method of a task

Parameters

  • flowId - flow id

  • taskId - task id

  • transactionId - transaction id

  • tasks - tasks executed previously

  • requestData - collection of output data from previous tasks

Return

boolean value.

  • True - succeeded

  • False - failed

Signature

Description

Returns the result of task execution. This result contains the input and output data of the task execution

Parameters

Return

TaskResult may contain error information, if it failed.

Signature

Description

Used when an additional finalization is required of a task

Parameters

Return

boolean value.

  • True - succeeded

  • False - failed

TaskDefinition annotation

Attributes

Name
Description

name

Task name displayed in flow designer

description

Task description

arguments

Number of input attribute. For display purpose only.

html

custom html page for input/output attributes

type

task type. For display purpose only

icon

path of task icon. ex) images/task.png

fields

input attribute list

outs

output attribute list

test

whether test page is provided

testLink

custom html page for testing

custom

True if custom html page is provided for input attibutes

customPage

The class path of the html page

ex) com/ism/was/flow/handler/html/ftptransfer-task.html

FieldDefinition

Attributes

Name
Description

name

Attribute name displayed in property editor

label

Label of attribute

help

Help message

width

Not used. For display purpose only. HTML text box

height

Not used. For display purpose only. HTML text box

rows

For display purpose only. HTML textarea

cols

For display purpose only. HTML textarea

selectFrom

Used only when option list of HTML select is from a class invocation

options

Available values of the attribute. HTML select

labels

For display purpose only. HTML select

Example implementation - Wait Task

Last updated