Tuesday 20 September 2011

Important method of com.ibm.wps.pb.utils.portlet. PortletUtils in Websphere portal server 6.1.5

PortletUtils is a utility class which is provided by websphere portal server. With help of JSR286, it provides some method which really useful. 

getPortletDefinitionId(PortletConfig portletconfig)
            String portletUniqueName = "";
            ObjectID objID = PortletUtils.getPortletDefinitionId(getPortletConfig());
             if(null != objID) {
                                    portletUniqueName = objID.getUniqueName();
            }
getPortletDefinitionId(javax.portlet.PortletRequest portletrequest)
String portletUniqueName = "";
            ObjectID objID = PortletUtils.getPortletDefinitionId(request)
             if(null != objID) {
                                    portletUniqueName = objID.getUniqueName();
            }
getHttpServletRequest(javax.portlet.PortletRequest portletrequest)
http://localhost:10039/wps/myportal/!ut/p/b1/pZBNC4JAEEB_Uczsuu6ux61w3RQpK8q9xBIigh-XCPr3aXR1PTi3gfdm4IGFkkjGqOCCCLiD7d27qd2rGXrXTrvlj51WCRMZogwlQaOSq-DnPZVIR6CcB3RBV_q4yscT8_k6wwVfBT_fqOKQp5qg1Jyiia5qK9IjQSbgBtb7YirgB_AP4MwoXLhwCf3AVCFPhq6CcsTEfM0Ayraq3fMDnW3jOI5MYzbxF-V0wxc!/dl4/d5/L2dJQSEvUUt3QS80SmtFL1o2X0NHQUg0N0wwMDg1ODEwSUFIVTc2U0QyMEEz/?test=sample
HttpServletRequest req=PortletUtils.getHttpServletRequest(request);
System.out.println("req.getParameter('test'):"+req.getParameter("test"));  // sample is printed.

getHttpServletResponse(javax.portlet.PortletResponse portletresponse)
HttpServletResponse req=PortletUtils.getHttpServletRequest(response);

getUser(javax.portlet.PortletRequest portletrequest)
User user= PortletUtils. getUser (request);

getPageId(HttpServletRequest httpservletrequest)
String pageuniquename = "";
                        ObjectID objID = PortletUtils.getPageId(req);
                         if(null != objID) {
                                     pageuniquename = objID.getUniqueName();
                        }

Sunday 18 September 2011

Unsupported features In Websphere portal server 7.0


Ø      Exchange, Domino, and POP3 are no longer supported protocols in the Common Mail portlet.
Ø      RSS portlet and IBM Feed Reader portlet are no longer shipped.
Ø      The Common Calendar portlet is no longer being shipped.
Ø      Document Manager-With this version of WebSphere Portal, Document Manager is no longer available. If you need to keep using a document library, then you will need to move your document library to a IBM Lotus® Quickr server.
Ø      Workflow for composite applications is no longer supported in this version.
Ø      Integration with WebSphere Process Server using the WebSphere Process Server Client and the My Processes and My Tasks portlets is being deprecated. It will be no longer supported in future releases.Instead, the integration with Process Server can be achieved using the  IBM WebSphere Portal Unified Task List portlet, which simplifies the system setup and improves consumability.
Ø      The following collaborative portlets are no longer included with WebSphere Portal:
·        My Lotus QuickPlaces
·        Inline QuickPlace
·        Domino Document Manager
·        Lotus Web Conferencing
Ø      The following legacy sample portlets are no longer provided:
·        SPFLegacyBlank.war
·        SPFLegacyClock.war
·        SPFLegacyCommandManager.war
·        SPFLegacyEditMode.war
·        SPFLegacyFileUpload.war
·        SPFLegacyLookupAction.war
·        SPFLegacyMailReader.war
·        SPFLegacyMultipleServletContexts.war
·        SPFLegacyStockQuote.war
·        SPFLegacyTiles.war
·        SPFLegacyTransformation.war
Ø      The Microsoft Exchange 2000 portlet application is no longer included. This portlet application contained the following portlets:
·        MS Exchange 2000 Mail Portlet
·        MS Exchange 2000 Calendar Portlet
·        MS Exchange 2000 Tasks Portlet
·        MS Exchange 2000 Contacts Portlet
·        MS Exchange 2000 Notes Portlet
Ø      The transcoding technology previously provided with WebSphere Portal has been discontinued with this version.
Ø      The following browsers are no longer supported in this version:
·        Mozilla
·        Netscape
Ø      The JACL syntax for the Portal Scripting Interface has been replaced by Jython syntax in WebSphere Portal version 7.0. The JACL syntax is still supported, but this support will be discontinued in the future.
Ø      HP UX is no longer supported in version 7.0.

Saturday 17 September 2011

Interaction between widgets and portlets by shared render parameters


In client side rendering mode, the portlet concept of public render parameters is mapped to the shared item set concept defined in the iWidget specification.

For portlets that do not provide custom iWidget markup this mapping is automatically performed by the portlet wrapper and transparent for the used portlets. Public render parameters are stored in a shared item set called public-render-parameters. iWidgets can access or modify the parameters by accessing this special shared item set. Similarly to the portlet model, iWidgets can access a parameter value by providing the complete qname for the parameter or a local parameter name that is mapped to a full parameter qname in the widget definition xml file.
If the value of a public render parameter is a single String object, the value in the shared item set is of the javascript type string. If the value of a public render parameter is a String array, then the value in the shared item set is a json array that contains the different values.

In this example, public render parameter name in RenderParameter Portlet is shared with RenderParameter Widget

Define Render Parameter Portlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" id="com.ibm.renderparameterportlet.RenderParameterPortlet.a499e19623">
      <portlet>
            <portlet-name>RenderParameterPortlet</portlet-name>
            <display-name xml:lang="en">RenderParameterPortlet</display-name>
            <display-name>RenderParameterPortlet</display-name>
            <portlet-class>com.ibm.renderparameterportlet.RenderParameterPortlet</portlet-class>
            <init-param>
                  <name>wps.markup</name>
                  <value>html</value>
            </init-param>
            <expiration-cache>0</expiration-cache>
            <supports>
                  <mime-type>text/html</mime-type>
                  <portlet-mode>view</portlet-mode>
            </supports>
            <supported-locale>en</supported-locale>
            <resource-bundle>com.ibm.renderparameterportlet.nl.RenderParameterPortletResource</resource-bundle>
            <portlet-info>
                  <title>RenderParameterPortlet</title>
                  <short-title>RenderParameterPortlet</short-title>
                  <keywords>RenderParameterPortlet</keywords>
            </portlet-info>
             <supported-public-render-parameter>myname</supported-public-render-parameter>
      </portlet>
      <default-namespace>http://RenderParameterPortlet/</default-namespace>
      <public-render-parameter>
      <identifier>myname</identifier>
      <qname xmlns:x="http://ibm.com/params">x:name</qname>
      </public-render-parameter>
</portlet-app>

Support Render Parameter in Portlet
      public void processAction(ActionRequest request, ActionResponse response) throws PortletException, java.io.IOException {
            if( request.getParameter(FORM_SUBMIT) != null ) {
                        response.setRenderParameter("myname",request.getParameter(FORM_TEXT));
            }
      }
Retrieve of Render Parameter in widget
RenderParameterWidget.xml
<?xml version="1.0" encoding="UTF-8" ?>
<iw:iwidget id="RenderParameterWidget" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget"
supportedModes="view" lang="en" iScope="RenderParameterWidgetScope">
<iw:resource src="RenderParameterWidget.js" id="renderId" />

<iw:itemSet id="public-render-parameters" private="false">
       <iw:item id="namevalue" alias="{http://ibm.com/params}name" readOnly="false" />
</iw:itemSet>

<iw:content mode="view">
                  <![CDATA[
                  <div>Hello World</div> <div id="displayname"></div>
                  ]]>
</iw:content>

</iw:iwidget>
RenderParameterWidget.js
dojo.declare("RenderParameterWidgetScope", null,{
      /*
      THE FOLLOWING STUBS ARE EVENT HANDLERS FOR PRE-DEFINED EVENTS.
      THEY CAN BE OVERRIDDEN BY SPECIFYING ANOTHER EVENT HANDLER
      IN THE <iwidget> ELEMENT OF THE XML
      Eg: <iw:iwidget onLoad="myLoadHandler" />
      */

      /*
      This event signals that the page has finished loading, including any
         invocations of requires().
      As a simple notification, it carries no predefined payload
      */
      onLoad:function() {
      },

      /*
      This event signals that the iWidget is about to be unloaded (commonly
         due to a page transition). This notification is intended to allow the
      iWidget to store any transient data such that it can
      be recovered by future uses of the iWidget
      */
     onUnload:function() {
     },
    
     /*
      This event signals that the mode for the iWidget has changed to VIEW
     */
     onView:function() {
       if(this.iContext.getShareableItemSet("public-render-parameters",false).getItemValue("namevalue"))
      {
       var selectedValue=this.iContext.getShareableItemSet("public-render-parameters",false).getItemValue("namevalue");
       var element=this.iContext.getElementById("displayname");
       element.innerHTML=selectedValue;
      }
     },
    
     /*
      This event signals that the mode for the iWidget has changed to EDIT
     */
     onEdit:function() {
     },    

     /*
      This event signals that the size for the iWidget has changed
     */
     onSizeChanged:function(/*com.ibm.mashups.iwidget.IEvent*/ event) {
        var newWidth = event.payload.newWidth;
        var newHeight = event.payload.newHeight;
     },

     /*
      This event can be generated by either the iWidget, supplying a new
         value for its "navigational state", or by the iContext, signaling
         that some user action has changed the iWidget's "navigational state"
         to a previously defined value.
        */
     onNavStateChanged:function(/*com.ibm.mashups.iwidget.IEvent*/ event) {
     
     }
    
});

ScreenShots:




click to download portlet and widget files