IBM Support

How can I implement request and response filters in Business Workflow Automation Case plug-ins?

How To


Summary

How can I implement request and response filters in Business Workflow Automation Case plug-ins?

Objective

The implementation of request and response filters in Case plug-ins changed in Business Workflow Automation and Cloud Pak for Business Automation. This technote describes the request and response filter implementation differences in custom plug-ins, which are developed for legacy Case Manager and the Case functionality in Business Workflow Automation and Cloud Pak for Business Automation.

Steps

In legacy Case Manager plug-ins, these snippets are samples for implementing request and response filters:
public class RequestFilter extends PluginRequestFilter {
               /**
               * Returns the names of the services that are extended by this filter.
               *
                * @return A <code>String</code> array that contains the names of the services.
               */
               public String[] getFilteredServices() {
                              return new String[] { "/p8/getWorkItems", "/p8/getNextWorkItems" };
               }
 
public class FilterTest extends PluginResponseFilter {

               /**
               * Returns an array of the services that are extended by this filter.
               *
                * @return A <code>String</code> array of names of the services. These are
               *         the servlet paths or Struts action names.
               */
               public String[] getFilteredServices() {
                              return new String[] { "/p8/getWorkItems", "/p8/getNextWorkItems"};
               }
In Business Workflow Automation Case and Cloud Pak for Business Automation Case plug-ins, these snippets are samples for implementing request and response filters:
public class RequestFilter extends PluginRequestFilter {
               /**
               * Returns the names of the services that are extended by this filter.
               *
                * @return A <code>String</code> array that contains the names of the services.
               */
               public String[] getFilteredServices() {
                              return new String[] { "/plugin/GetMergedWorkListService"};
               }
 
public class FilterTest extends PluginResponseFilter {

               /**
               * Returns an array of the services that are extended by this filter.
               *
                * @return A <code>String</code> array of names of the services. These are
               *         the servlet paths or Struts action names.
               */
               public String[] getFilteredServices() {
                              return new String[] { "/plugin/GetMergedWorkListService" };
               }
Explanation:
In Business Workflow Automation and Cloud Pak for Business Automation, we no longer invoke the /p8/getWorkItems and /p8/getNextWorkItems endpoints. Instead, we invoke the ICMAPIPlugin/GetMergedWorkListService, since we now return p8 and bpm merged work items for the federated in-baskets.
The request and response filters have to act on the icm api plugin service /GetMergedWorkListService endpoint.
In addition, the ICMAPIPlugin writes out to the response directly and bypasses Content Navigator's framework. Consequently, no response filters are triggered by Content Navigator. In order to trigger response filters, the plug-in must call PluginResponseUtil.writeJSONResponse().
JSONObject result = onExecute(domain, objStore, repositoryId, resourceRequest);
logger.logDebug(this, methodName,"Result JSON: "+result.toString());
JSONResponse jsr = new JSONResponse();
Iterator resultit = result.entrySet().iterator();
while (resultit.hasNext()) {
   Map.Entry pairs = (Map.Entry)resultit.next();
   jsr.put(pairs.getKey(), pairs.getValue() );
}
PluginResponseUtil.writeJSONResponse(request, response, jsr, callbacks, getId());

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SS8JB4","label":"IBM Business Automation Workflow"},"ARM Category":[{"code":"a8m0z000000cwF5AAI","label":"Case Management-\u003ECase App Development"}],"ARM Case Number":"TS014731537","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
24 November 2023

UID

ibm17080119