{"id":37,"date":"2017-05-13T21:48:40","date_gmt":"2017-05-13T19:48:40","guid":{"rendered":"http:\/\/xoupix.fr\/wordpress\/?p=37"},"modified":"2017-05-14T18:36:26","modified_gmt":"2017-05-14T16:36:26","slug":"ibm-content-navigator-plugin","status":"publish","type":"post","link":"https:\/\/blog.xoupix.fr\/index.php\/2017\/05\/13\/ibm-content-navigator-plugin\/","title":{"rendered":"IBM Content Navigator plugin"},"content":{"rendered":"<p>Here we go with the first article on this site ! It&#8217;s about creating \/ modifying a Content Navigator plugin.<br \/>\n<!--more--><\/p>\n<h1><strong>The plugin main class<\/strong><\/h1>\n<p>Each IBM Content Navigator plugin will define it&#8217;s own main class, defining several methods inherited from com.ibm.ecm.extension.Plugin java class. The first thing to do\u00a0after declaring a new class is to modify the &#8220;applicationInit&#8221; method.<\/p>\n<p><em>Just a precision about this class. The based java package related to this class must be the same with the\u00a0WebContent resource folder !<\/em><\/p>\n<h2>The applicationInit method&#8230;<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">@Override\r\npublic void applicationInit(HttpServletRequest request,\r\n        PluginServiceCallbacks callbacks) throws Exception {\r\n    \/\/ TODO specify some instantiation here\r\n}<\/pre>\n<p>This method will be called after loading the plugin in the IBM Content Navigator administration page.<\/p>\n<p>This method provides 2 parameters :<\/p>\n<ul>\n<li>a basic HttpServletRequest object, from any applicative server &#8220;javax.servlet.http&#8221; package,<\/li>\n<li>a\u00a0PluginServiceCallbacks object, from Content Navigator API &#8220;com.ibm.ecm.extension&#8221; package (more informations about this specific object in the\u00a0<a href=\"https:\/\/www.ibm.com\/support\/knowledgecenter\/SSEUEX_2.0.3\/com.ibm.javaeuc.doc\/com\/ibm\/ecm\/extension\/PluginServiceCallbacks.html\">official IBM Content Navigator API documentation<\/a><\/li>\n<\/ul>\n<p>In this specific method, you can do anything related to your plugin initialization (loading configuration, initializing cached objects, and so on&#8230;).<\/p>\n<h1>&#8230;\u00a0The generic methods&#8230;<\/h1>\n<h2>The gedId method<\/h2>\n<p>This method define the plugin Identifier name.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">@Override\r\npublic String getId() {\r\n    return \"PluginID\";\r\n}<\/pre>\n<h2>\u00a0getName, getVersion and getCopyright\u00a0methods<\/h2>\n<p>Those methods are only used in the Content Navigator administrative view, when you load the plugin.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">@Override\r\npublic String getVersion() {\r\n    return \"1.0\";\r\n}\r\n\r\n@Override\r\npublic String getCopyright() {\r\n    return \"Some copyright here\";\r\n}\r\n\r\n@Override\r\npublic String getName(Locale locale) {\r\n    return \"Plugin name\";\r\n}<\/pre>\n<h2>\u00a0&#8230; And the useful methods !<\/h2>\n<h3>Quick introduction<\/h3>\n<p>This part defines each &#8220;functionality&#8221; provided by the Content Navigator API to tune your plugin. I will specify some of these, and write some other posts next weeks.<\/p>\n<h3>The request filter<\/h3>\n<p>A request filter is a specific development triggered before executing an action. For example, if I add a request filter listening to &#8220;\/p8\/addItem&#8221; Content Navigator event, this code will be executed before handling the default action process.<\/p>\n<h4>Sample<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">@Override\r\npublic PluginRequestFilter[] getRequestFilters() {\r\n    return new PluginRequestFilter[0];\r\n}<\/pre>\n<h3>The response filter<\/h3>\n<p>Same spirit as the request filter, but executed after the default action process, and before handling data on Content Navigator side.<\/p>\n<h4>Sample<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">@Override\r\npublic PluginResponseFilter[] getResponseFilters() {\r\n    return new PluginResponseFilter[0];\r\n}<\/pre>\n<h3>The plugin action<\/h3>\n<p>This method returns a specific list of actions that this plugin will add to the main toolbar of the web client<\/p>\n<h4>sample<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">@Override\r\npublic PluginAction[] getActions() {\r\n    return new PluginAction[0];\r\n}<\/pre>\n<p>There is a lot more of customisation, I will write down other papers in the next days !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here we go with the first article on this site ! It&#8217;s about creating \/ modifying a Content Navigator plugin.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-ibm-content-navigator"],"_links":{"self":[{"href":"https:\/\/blog.xoupix.fr\/index.php\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.xoupix.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.xoupix.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.xoupix.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.xoupix.fr\/index.php\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":14,"href":"https:\/\/blog.xoupix.fr\/index.php\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":86,"href":"https:\/\/blog.xoupix.fr\/index.php\/wp-json\/wp\/v2\/posts\/37\/revisions\/86"}],"wp:attachment":[{"href":"https:\/\/blog.xoupix.fr\/index.php\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.xoupix.fr\/index.php\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.xoupix.fr\/index.php\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}