![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Workflow Guide
CHAPTER 6
This chapter describes how to create a Java activity to use in a workflow process. It has these sections:
A Java activity is a Java class that executes within the context of an exteNd Director workflow application. A Java activity allows you to write custom business logic that executes automatically without user intervention.
You can create the Java activity using the Java Activity Wizard, code the resulting Java class template, and add the activity in the Workflow Modeler. The workflow engine automatically forwards work after the Java activity is processed.
To generate the Java activity code template:
With your project open in exteNd Director, select File>New>File.
From the New File dialog, select the Workflow tab and click Java Activity:
Click Finish. The wizard generates the Java source template.
The generated class implements the EbiJavaActivity interface and generates a method stub for the invoke() method. This method supplies the workflow context, and is called when work is forwarded to the Java activity in the workflow process.
The following example shows how to access a scoped path in the Java activity at runtime. This example uses the Session scope. Typically workitems in a workflow are stored in the Flow scope.
import com.sssw.wf.api.*; public void invoke(EbiContext context) { try { // how to get a value from a scopedPath. ( assuming a request var of fname ) com.sssw.fw.api.EbiScopedPath fname = com.sssw.fw.factory.EboScopedPathFactory.createScopedPath( "/Request/param/fname"); String theFirstName = (String)fname.getValue( context ); // how to set a value on a scopedPath. com.sssw.fw.api.EbiScopedPath sessionDoc = com.sssw.fw.factory.EboScopedPathFactory.createScopedPath( "/Session/DOC"); sessionDoc.setValue( context, "mySessionDocValue" ); // how to copy the request Referer into a session variable com.sssw.fw.api.EbiScopedPath from = com.sssw.fw.factory.EboScopedPathFactory.createScopedPath( "/Request/prop/Referer"); com.sssw.fw.api.EbiScopedPath to = com.sssw.fw.factory.EboScopedPathFactory.createScopedPath( "/Session/Referer"); com.sssw.fw.core.EboScopedPathUtil.copy( context, from, to ); } catch (Exception e) { System.out.println(e); } }
Copyright © 2003 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved. more ...