Hi there guys , i am back with a new small trick that i learned in the last few days,
a lot of times one will develop a low 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 and reuse most of the components previously developed for ICN inside of the case manager,
the problem lies in the idea that the ICM Custom Actions are like the ICN Actions with some extra features and configurations like 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 and 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, so the old way of converting the ICN Custom Action to ICM Custom Actions was to create a punch of new ICM Actions and use the same code and that will allow for duplication of the same actions to just use them in ICM Widgets but i found that the only main difference is an extra configuration added to the ICN action and then VOILA !!
It's applied as follows :
Go the the ICN Custom Action Java Class , and 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.
*/
so the idea is to formulate the configuration to be use as ICM Custom Action some we need to put some extra configurations that is :
ICM Compatible to be equal to True
Insert 2 properties for the action : label and message
then you can use this action as a toolbar on menu action inside of the case manager widgets
the implementation of the function 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
تمام
ReplyDelete