Content Management and Capture

Content Management and Capture

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
Expand all | Collapse all

ICN Search Templates List Customization

  • 1.  ICN Search Templates List Customization

    Posted Tue November 10, 2020 04:42 PM

    Hi,

    I have a ICN desktop. There are many search templates in the repository of this desktop. I have enabled Search Feature for this desktop. After I log-in to the desktop it shows all the search templates by default. My requirement is to show only few search templates based on the logged-in user. User and search template mapping is stored in configuration file.

    Please let me know how to achieve this.

    Regards,

    Ravi



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 2.  RE: ICN Search Templates List Customization
    Best Answer

    Posted Wed November 11, 2020 02:58 AM

    Hi Ravi,

    You may create a response filter to limit the number of search templates. Here is an example.

    public class SamplePluginGetSearchTemplatesResponseFilter extends PluginResponseFilter { public String[] getFilteredServices() { return new String[] { "/p8/getSearchTemplates", "/cm/getSearchTemplates" }; } public void filter(String serverType, PluginServiceCallbacks callbacks, HttpServletRequest request, JSONObject jsonResponse) throws Exception { JSONArray rows = (JSONArray) jsonResponse.get("rows"); int maxCount = 10; // <<<<<<< count per user JSONArray newRows = new JSONArray(); for (int i = 0; i < rows.size() && i < maxCount; i++) { newRows.add(rows.get(i)); } jsonResponse.put("rows", newRows); } }

    Refer to SamplePlugin.

    Regards,

    Angie



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 3.  RE: ICN Search Templates List Customization
    Best Answer

    Posted Wed November 11, 2020 09:21 AM

    Hi Angie,

    Perfectly working. Thanks a alot!



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration