Wednesday, September 20, 2006

Edit_Defaults Mode in Websphere Portal 6.0.

Its nice to post after long time with one interesting topic.which is nothing but edit_defaults mode in JSR 168.I think lots of portlet developers having idea about view, edit,help & config mode.But some more modes are avaialble in JSR 168.Among this one of the interesting mode is Edit_Defaults .I explored some basic things of Edit_Defaults in websphere portal 6.0 & Through this post i just want to share what ever i learn about Edit_Defaults mode.

At first let us see what is edit defaults mode ?


  • Edit Defaults mode is one of the portlet mode available in JSR 168(Portlet API) .
  • This mode is created to share some default preference values to all the users. (i.e., If admin set some preference values by using this edit defaults mode then this values will be a default preference values for all other users.)
  • Any time admin can change others preference values by using this shared settings option.(i.e., if any body selected some theme if admin changes the theme by using this edit defaults mode then automatically it will reflect for all other users.)
  • This mode will be applicable only for portal admin not for all users.
what are the things we need to do for getting this mode ?
  • You need make the following entry in portlet.xml

<portlet-app>

<portlet>...<supports><mime-type>text/html</mime-type><portlet-mode>edit</portlet-mode><portlet-mode>edit_defaults</portlet-mode></supports>...</portlet>

<custom-portlet-mode><description xml:lang="en">edit_defaults mode</description><portlet-mode>edit_defaults</portlet-mode></custom-portlet-mode>

</portlet-app>

You need to override doDispatch() of Generic Portlet. Sample code

// Added for Edit_Default_Mode

private static final PortletMode EDIT_DEFAULT_MODE = new PortletMode("edit_defaults");

protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException {if( !WindowState.MINIMIZED.equals(request.getWindowState()) ){

PortletMode mode = request.getPortletMode();

if( EDIT_DEFAULT_MODE.equals(mode) ) {

// System.out.println("Inside edit default mode condition : Bala S Murugan ::: ); doCustomConfigure(request, response);return;}}super.doDispatch(request, response);

}

Well once you create your portlet with edit_defaults mode then after deploying in websphere portal 6.0.If you login as a portal admin then you will see a new link "EDIT SHARED SETTINGS" in your portlet title bar.Where This "EDIT SHARED SETTINGS" is nothing but Edit_Defaults in Websphere 6.0.

1 comment:

Its Me said...

nice artical about edit_defaults mode in JSR 168.