IBM Support

Making an ICN Custom Plugin Action into an ICM Custom Action

Technical Blog Post


Abstract

Making an ICN Custom Plugin Action into an ICM Custom Action

Body

Hi everyone. I am back with a new small trick that I learned in the last few days.

 

A lot of times one will develop a lot of custom actions using ICN custom plugin to use inside of the IBM Content Navigator interface and then the business will require us to move to using IBM Case Manager, reusing most of the components previously developed for ICN inside of the Case Manager user interface.

 

The problem lies in the idea that the ICM Custom Actions are like the ICN Actions with some extra features and configurations such as putting a label for the action that is different from the name of the action and also putting a message to be attached to the action as a helper. All of that is implemented as a new Action class of ICM inherting from the ICN Action Class and then extending the new features inside this class.  The old way of converting the ICN Custom Action to ICM Custom Actions was to create a bunch of new ICM Actions and use the same code. Instead of all this code duplication, I found that the only main difference is an extra configuration added to the ICN action and then VOILA, the actions show up in ICM Case Builder!

 

Here's how it's done: 

 

Go the the ICN Custom Action Java Class. Here we will overide the implementation of a function in the ICM Custom Java Class called getAdditionalConfiguration().

 

The documentation of this function is as follows :

 /**
 * Returns additional JSON that will appear on the ecm.model.Action
 * JavaScript object for this action. This can be used to provide custom
 * configuration information for the action as needed by plug-in provided
 * JavaScript for the action.
 * 
 * @since 2.0.2
 * @return an instance of JSONObject containing properties that will be
 *         mixed into the ecm.model.Action object. The default
 *         implementation returns an empty JSONObject.
 */  

 

The idea is to formulate the configuration needed by the ICM Custom Action including setting:

  • ICM Compatible to be equal to True
  • Insert 2 properties for the action (label and message)

Once you rebuild and install your plug-in,  you can use this action as a toolbar or menu action inside of the Case Manager widgets.

 

The implementation of the function we are overriding will be as follows : 

 
public JSONObject getAdditionalConfiguration(Locale locale) {
     String jsonString = "{" +
   "\"ICM_ACTION_COMPATIBLE\": true," +
   "\"context\": null," +
   "\"name\": \" Custom Action Name\"," +
   "\"description\": \"Put Action Description\"," +
   "\"properties\": [" +
   "{" +
   "\"id\": \"label\"," +
   "\"title\": \"label\"," +
   "\"defaultValue\": \"\"," +
   "\"type\": \"string\"," +
   "\"isLocalized\": false" +
   "}," +
   "{" +
   "\"id\": \"message\"," +
   "\"title\": \"message\"," +
   "\"defaultValue\": \"\"," +
   "\"type\": \"string\"," +
   "\"isLocalized\": false" +
   "}" +
   "]}";
try {
   return JSONObject.parse(jsonString);
} catch (IOException e) {
   e.printStackTrace();
}
return null;
}

That's it! Thanks and regards.

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSCTJ4","label":"IBM Case Manager"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

UID

ibm11280794