Adding extension activities to the flow-editor palette

Extension activities are a means to encapsulate reusable functionality for IBM® WebSphere® sMash Assemble flow. Custom extension activities can also be added to the flow-editor palette.

Adding an extension activity

To add a extension activity to the flow editor with following steps:

  1. Create an extension activity. See Writing extensions in the Assemble flow language and Writing extensions in Groovy for details.
  2. Add the metadata for your extension activity. Such metadata is not only used by the flow engine for validation, but it also directs the tooling to display the extension activity and validate during build-time. See Defining the validation rule for a extension activity for details.

After that, the extension activity has been added to the flow editor, and you can find it in the All activities category.

Specify the icon for extension activity

To specify an icon for the extension activity, create a ActivityName.png icon file in the following directory of your application: public/tooling/icon-activity/. The file name of activity icon must be in lower case.

Adding a help document for the extension activity

To add a help document for your activity, put the ActivityName.html file in the following path: public/tooling/assemble/resources/help/activity/ActivityName.html.

Adding a custom category to the palette

You can create a custom category to be listed in the palette and you can use it to classify your extension activities. To do this, put the CustomCategoryName.json file under the following directory: public/tooling/categories/. The following example creates a category file for the feed category:

{
	"name" : "Feed Activities",
	"description" : "Activities for feed manipulation",
	"item" : [
		{
			"name" : "feed",			
			"type": "feed"
		},
		{
			"name" : "aggregateFeeds",		
			"type": "aggregateFeeds"
		}
	]
}

Example

For example, you would use the following steps to create the extension activity: myActivity .

  1. Add the myActivity activity, then add the meta data of the activity in the zero.config file as shown in the following example:
    /config/activity/metadata/myActivity = {
    	"attributes" : [
    		{"name":"message"},
    		{"name":"outputUri", "required":false}
    	],
    	"inputOccurrence" : "0..*", 
    	"withoutOutput" : false
    }
    
  2. Run the tooling. When you drag it to the canvas, the required attribute message is displayed, as shown in the following graphic.

    The message attribute is displayed.

    All attributes of the myActivity activity are shown in the property view, as the following graphic shows.

    The attributes of the activity you added are shown in the property view.

  3. Add the icon for the myActivity activity by putting the icon file in the following path: public/tooling/icon-activity/myActivity.png.
  4. Add the help document for myActivity by putting the icon file in the following path: public/tooling/assemble/resources/help/activity/myActivity.html.
  5. Create a custom category as shown in the following example:
    {
    	"name" : "My activities",
    	"description" : "My activities",
    	"item" : [
    		{
    			"name" : "myActivity",			
    			"type": "myActivity"
    		}
    	]
    }
    
  6. Save the content in the previous example to a file named My activities.json and put it under the following directory: public/tooling/categories/.
  7. Refresh the tooling and the My activities category is shown as in the following graphic:

    The My activities category is shown.

Version 1.1.0.0.21442