[an error occurred while processing this directive]
> developer > web app development
Writing and Using a Custom Activity with the exteNd Director Workflow System
by Erik Dasque, Product Manager, Novell
Date Created: 2002-02-08 14:31:00.000
  Introduction
introduction
Workflow is the computer automation of much or all of a business process. Workflow controls the routing of work from user to user according to procedural rules. Work is expressed as a dynamic set of documents (data) associated with data that characterizes the set of documents (metadata). Taken together, the data and metadata are called a workitem. Users act on the information in the workitem, accomplish tasks, update workitem information, and trigger the continuation of the workitem in the workflow.

The workflow process in Novell exteNd Director has undergone major architectural changes with version 3.0. It is now comprised of the following elements:

  • Workflow engine - The routing logic layer, responsible for taking the workflow process instance from activity to activity through links.
  • Workflow queue - The data persistence layer, responsible for handling workitems creation/update/delete.
  • An extensive library of routing controls (links), including:
    • sequence link
    • exclusive OR, routing based on a simple expression of test against the workitem documents elements values
    • OR, routing based on a simple expression of test against the workitem documents elements values
    • AND (split)
    • rules-based routing control
  • Automatic- and UI-based activities, including:
    • start
    • finish
    • merge
  • Administrative workflow components
  • Sample workflow components
And with exteNd Director 3.0, you can create applications that incorporate advanced workflow capabilities within a J2EE development model and deploy them on multiple application servers, including exteNd Application Server 3.7.4, BEA Weblogic 6.1, and IBM Websphere 4.0.

Now, let's walk through a workflow process creation that includes a custom activity.

Provided that you've already made the changes required for the sample workflow demo, follow these instructions:

  • Change the workflow subsystem production mode (WorkflowService/ProductionMode) to 'false' (%PROJECT_DIR%\library\WorkflowService\WorkflowService-conf\config.xml).
  • Build the application and deploy it to the application server so that it includes the changes made to the workflow production mode.
  • Create a new workflow activity (New->Workflow->Workflow Activity, Classname : 'DoesNothing', package name 'test', do not create UI classes).
  • Un-comment the generated code in the 'invoke' method (using option 1) and replace "// Your work here....." by:
  •  System.out.println("==>      The DoesNothing custom Automatic Activity has been invoked");
  • Compile the custom activity (Project->Compile).
  • Create the following workflow process in the workflow editor:
    • Create a new workflow process (New->Workflow->Workflow Process).
    • You will now see a start activity (green). 
    • Add an automatic activity labeled 'EboAutomaticActivityUI' by clicking on the button that looks like a computer, then click in the center of the workflow worksheet.

    • Add a finish activity labeled 'EboFinishActivityUI' by clicking on the 'EboSimpleDestinationUI', then drag and draw a link in between the start activity and the automatic activity.
    • Do the same thing between the automatic activity and the finish activity.
    • Change the tool to the arrow tool (select), select the automatic activity, then right click to get to the properties panel.
    • In the properties panel (selection tab) change the name to 'MyAutoActivity'. Next, select the class name (classpath in this early release screen shot) to point to the only available activity, which is the test 'DoesNothing' activity class that was built and compiled earlier.

    • In the properties panel (workflow tab) change the name to 'MyFirstWorkflow'.

    • If you are not happy with your layout, you can ask the workflow editor to layout your process definition automatically by typing: Ctrl-Shift-L.
    • Save the file as 'MyFirstWorkflow.xml'.
  • Start your engine and queue (http://localhost/dbname/ns/Portal/main/comp/WorkflowEngineAdmin?btnStartAll=Start+All).
  • Start your process (http://localhost/dbname/ns/Portal/main/comp/WorkflowStartProcess), or use the component you previously added in your sample user 'MyPortal' layout by selecting it and clicking on start.
As the workflow process is started and your 'CustomActivity' is invoked, you should see something similar to the following in your console:
EboWfLog|-1|19:34:55:986|client0|EboEngine(c373e9ea6980cdf88f7a8750967f3209)



                - creating new process: [c373e9ea6abf50cc8f6b02ff9540af67]



EboWfLog|-1|19:34:56:757|client0|EboEngine(c373e9ea6980cdf88f7a8750967f3209)



                - starting process: [c373e9ea6abf50cc8f6b02ff9540af67]



EboWfLog|-1|19:34:58:229|client0|com.sssw.wf.activity.EboStartActivity(c373e9ea6abf50cd8f6b02ff9540af67)



                - starting message: [c373e9ea705899ab8f6a0000864ec29d]



EboWfLog|-1|19:34:58:620|client0|com.sssw.wf.activity.EboStartActivity(c373e9ea6abf50cd8f6b02ff9540af67)



                - notifying departure of msg: [c373e9ea705899ab8f6a0000864ec29d]



EboWfLog|-1|19:34:58:870|client0|com.sssw.wf.activity.EboProcessNode(c373e9ea6abf50ce8f6b02ff9540af67)



                - processing msg:[c373e9ea705899b38f6a0000864ec29d]



==> The DoesNothing custom Automatic Activity has been invoked



EboWfLog|-1|19:35:01:123|Thread-15|EboProcess(c373e9ea6abf50cc8f6b02ff9540af67)



                - forwarding message: [c373e9ea705899b38f6a0000864ec29d]



EboWfLog|-1|19:35:01:293|Thread-15|com.sssw.wf.activity.EboFinishActivity(c373e9ea6abf50cf8f6b02ff9540af67)



                - processingmsg: [c373e9ea705899bf8f6a0000864ec29d]



EboWfLog|-1|19:35:01:334|Thread-15|com.sssw.wf.activity.EboFinishActivity(c373e9ea6abf50cf8f6b02ff9540af67)



                - notifying completion of process: [MyFirstWorkflow]
Similarly, you can create a more complex flow including more advanced links and automatic or UI activities. exteNd Director provides a wealth of functionality (content management, search, user and directory services, a portal webtier, a rules engine, security, and more) all within a pure J2EE framework for building applications that are deployable on multiple application servers (including exteNd Application Server 3.7.4, BEA Weblogic 6.1, and IBM Websphere 4.0). Click this link for more information about programming workflow with exteNd Director. And to learn more about other exciting Director features, don't hesitate to download an evaluation of the product and explore the online documentation.