queryGroupWorkItems
command, as outlined in the overview
section of this tutorial.
step3
directory.GroupWorkListHandler.start
to
GroupWorkListHandler.java
.GroupWorkListHandler.java
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.init()
method, create an instance of the
GroupWorkListViewer
class 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 WebClient.properties
instead.queryGroupWorkItems
method, add the line to query
the worklist OID from the HTTP request. The name of this parameter is
id
.GroupWorkListHandler
inherits from the GenericCommandHandler
class,
this queryGroupWorkItems
method will be called automatically
whenever the Web Client's servlet 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)
as well as externally (that is, through an HTTP request). What is the reason
why the external method cannot be invoked internally also?queryGroupWorkItems
, query
the work items on the list with OID workListOID
. Then, add the
condition when new work items should be transferred to the user's worklist.
Finally, add the call to perform the work item transfer.return viewer.queryGroupWorkItemsResponse(context);and the approach used in the template file:
return builtin.render("queryGroupWorkItems", context);?
GroupWorkListViewer.start
to
GroupWorkListViewer.java
.GroupWorkListViewer.java
and check the new constructor
and the enhanced init()
method. Note that the constructor
takes a GroupWorkListHandler
object as parameter. Therefore,
the GroupWorkListViewer
class can no longer be used in the
DefaultViewer
setting, which requires the class specified to
have a default (that is, non-argument) constructor.logonResponse
method, add the call to create the group
list if it does not 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. Note that
this will result in a call to the Viewer's
queryGroupWorkItemsResponse
method. Add the signature for
this method.GroupWorkList.jsp
JSP from step 2. In addition to
the 'Refresh' and 'Logoff' buttons, work item methods, such as
transferItem
, cancelWorkItem
were offered.
Since GroupWorkListViewer
inherits from the
JSPViewer
class, the response pages, which are created for
these commands are also inherited. Therefore, it is necessary
to override the appropriate xxxResponse
methods to
make sure that the restricted worklist is displayed instead of whatever page
JSPViewer
would create. Add the implementation of the
transferItemResponse
method.GroupWorkList.start
to
GroupWorkList.jsp
.GroupWorkList.jsp
and add 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. This helps to avoid name clashes with any future
built-in commands, which are always called first. That is, if a
queryGroupWorkItems
command was added to the servlet's
BuiltinHandler
, the GroupWorkListHandler
's
command would no longer be called. Adding the "x-" prefix to custom
commands helps to avoid the problem.groupListOID
parameter to
GroupWorkListHandler.queryGroupWorkItems
.GroupWorkList.jsp
to the
<MQWFDir>/WebClient/webpages/forms
directory.jc step3\*.javato compile your files.
<MQWFDir>/WebClient/WebClient.properties
file
and change the line reading
DefaultViewer=com.ibm.workflow.servlet.sample.GroupWorkListViewerback to
#DefaultViewer=com.ibm.workflow.servlet.client.DefaultViewerThen, 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
).