The third step of creating a group worklist is to add a custom CommandHandler that implements a new queryGroupWorkItems
command.
The source files for setting up a group worklist are stored in the <MQWFDir>/smp/WebClient/groupwl
directory. To create a CommandHandler:
step3
directory.GroupWorkListHandler.start
file to GroupWorkListHandler.java
.GroupWorkListHandler.java
file, and add
GenericCommandHandler as base class. This is a helper class that implements the
CommandHandler interface and maps servlet commands in HTTP requests to methods that have the same name as the command. Alternatively, you can implement your own dispatching logic by overriding the
execute() method.GroupWorkListViewer
class in the init()
method and pass a pointer to this
as constructor parameter. This constructor will be added to the viewer in a later step.onLogon
method, add a condition so that the groupListOwner
is not assigned to the GroupWorkListViewer
, but uses the default
viewer configured in the WebClient.properties
file instead.queryGroupWorkItems
method, add the line to query the worklist OID from the HTTP request. The name of this parameter is id
.
Because the GroupWorkListHandler
class inherits from the GenericCommandHandler
class, this queryGroupWorkItems
method is called automatically whenever the servlet of the Web client gets a queryGroupWorkItems
command. This is a wrapper method only, and the actual implementation is in an overloaded method. As a result, the command can be invoked internally from the GroupWorkListViewer
class, or externally through an HTTP request.
queryGroupWorkItems
, query the work items on the list with the OID workListOID
. Then, add the condition that defines when new work items are to be transferred to the worklist of the user. Finally, add the call to perform the work item transfer.
Note:
To perform the work item transfer, you can add either of the following method calls to return the response page:
return viewer.queryGroupWorkItemsResponse(context);With this call, you directly call the viewer that you specify for 'viewer'. You can also use the method call as it is used in the template file:
return builtin.render("queryGroupWorkItems", context);With this call, you use the viewer that you have configured for the Web client.
GroupWorkListViewer.start
file to GroupWorkListViewer.java
.GroupWorkListViewer.java
file, then check the new constructor and the enhanced init()
method. Note that the constructor takes a GroupWorkListHandler
object as parameter. Therefore, you can no longer use the GroupWorkListViewer
class in the
DefaultViewer
setting. The DefaultViewer setting requires the specified class to have a default (that is, no-argument) constructor.logonResponse
method, add the call to create the group list if it does not yet exist. Use OWNER='groupListOwner'
as filter, and groupListThreshold
as query threshold.logonResponse
method, call the GroupWorkListHandler
with the appropriate parameters to create the initial worklist for the currently logged-on user. This results in a call to the queryGroupWorkItemsResponse
method of the viewer. Add the signature for this method.When you created the JSP file to display the worklist in step 2 (GroupWorkList.jsp
), a 'Refresh' button, a 'Logoff' button, work item methods, such as transferItem
and cancelWorkItem
were offered. Because the GroupWorkListViewer
inherits from the
JSPViewer
class, the response pages that are created for these commands are also inherited. Therefore, it is necessary to override the appropriate xxxResponse
methods to ensure that the correct worklist is created and displayed by the JSPViewer
transferItemResponse
method.GroupWorkList.start
file to GroupWorkList.jsp
.GroupWorkList.jsp
file, then add the code to create the new 'Refresh' command used by the button. Instead of invoking the built-in queryWorkItems
command, now invoke the new queryGroupWorkItems
command. Use "x-queryGroupWorkItems" as the command string so that you can avoid name clashes with any future built-in commands.
Built-in commands are always called first. If you have added a queryGroupWorkItems
command to the BuiltinHandler
of the servlet, the command of the GroupWorkListHandler
command is no longer called. To avoid this problem, add the "x-" prefix to custom commands.
groupListOID
parameter to GroupWorkListHandler.queryGroupWorkItems
.GroupWorkList.jsp
file to the <MQWFDir>/cfgs/<cfgID>/WebClient/webpages/forms
directory.jc step3\*.java
WebClient.properties
file
and change the line reading
DefaultViewer=com.ibm.workflow.servlet.sample.GroupWorkListViewerto
#DefaultViewer=com.ibm.workflow.servlet.client.JSPViewerThen, change the line reading
#CommandHandler=com.ibm.workflow.servlet.sample.CommandHandlerAdapterto
CommandHandler=com.ibm.workflow.servlet.sample.GroupWorkListHandlerto activate the custom command handler class.
GroupWorkListHandler.sol
,
GroupWorkListViewer.sol
, and GroupWorkList.sol
).