Friday, April 15, 2011

Getting WCM data from IBM's seedlist application.

Using Seedlist 1.0 server, we can retrieve WCM data, the following is IBM's document on how to retrieve WCM data using seedlist REST API

Seedlist REST API

If you are using Dojo to call the API you probably will use xhrGet method, and you can handle the result as XML data (setting handleAs: "xml").

The question is how to retrieve the value of a field.

First of all, we need to get the values from each WCM document. This  can be done by:

data.documentElement.children["<number>"].nodeName.   If the nodeName is "atom:entry" then the children is a  document item. Here is the sample  data.documentElement.children["9"].nodeName

Once we already have the document information, we need to get the specific property from the content item, here is how
console.log("data.documentElement.children["<number>"].children["<number>"].nodeName. The value of nodeName should be "wplc:field". This will indicate that the object is a property of the document.

To know the name of the property you need to use the following statement
data.documentElement.children["<number>"].children["<number>"].attributes[0].nodeValue.  The value of nodeValue is the name of the property

Lastly you need to get the real value of the property by

data.documentElement.children["<number>"].children["<number>"].textContent.  The statement will result on the value of the specific property.

Sample (to get "Name" property of a specific content):

If the value of data.documentElement.children["9"].children["17"].nodeName == "wplc:field" then
   if the value of data.documentElement.children["9"].children["17"].attributes[0].nodeValue == "Name" then
        The value of "Name" is data.documentElement.children["9"].children["17"].textContent

If the statement above is not true then we need to loop through to another array element.

This is based on my test on WebSphere Portal 7.





Friday, February 25, 2011

Changing portal page to use a layout template

If you create a portal page from portal administration user interface:


the chances are you will not be able to use the "PageBuilder2" feature to add new portlet into the page (using "Actions" - "Customize").  To enable the page to use the feature you need to do the following:
1. Export the page definition into xml file
2. Update the xml file by adding the following parameter for the specific <content node>


            <parameter name="com.ibm.portal.layout.template.expiration" type="string" update="set"><![CDATA[1297730961223]]></parameter>
            <parameter name="com.ibm.portal.layout.template.file.name.html" type="string" update="set"><![CDATA[layout.html]]></parameter>
            <parameter name="com.ibm.portal.layout.template.lastmodified" type="string" update="set"><![CDATA[1297644561353]]></parameter>
            <parameter name="com.ibm.portal.layout.template.markup" type="string" update="set"><![CDATA[html]]></parameter>
            <parameter name="com.ibm.portal.layout.template.ref" type="string" update="set"><![CDATA[dav:fs-type1/layout-templates/3ColumnCenter]]></parameter>

into the <content-node> stanza for the specified portal page.

3. We also need to update the type of the content node to "staticpage"

<content-node action="update" active="true" allportletsallowed="true" content-parentref="Z6_020K9B1A0823E0IE07U5O500O0" create-type="explicit" domain="rel" objectid="Z6_020K9B1A0GIU80IE2099SD20H6" ordinal="600" type="staticpage">

4. Re-import the xml file

Hope this helps..

Friday, February 18, 2011

Using SAP extension in WebSphere Portlet Factory and WebSphere Application Server Community Edition

I have WebSphere Portlet Factory 7.0 running on Ubuntu Linux 10.10. I also used WAS CE  version 2.1.1.4 as the test environment.

I have to do the following to allow SAP extension

  • Get the SAPJCo from SAP administrator
  • Install the SAPJCO according to the documentation provided by SAP for linux environment
  • Add class path variable into /etc/environment:
           CLASSPATH="/opt/sapjco/sapjco.jar"
  • Add path to the /opt/sapjco folder. (This is also done in /etc/environment file).  The following is the content of my /etc/environment file
                  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/sapjco"
                      LD_LIBRARY_PATH="/opt/sapjco"
                        CLASSPATH="/opt/sapjco/sapjco.jar"
      • Add "LD_LIBRARY_PATH=/opt/sapjco" at the end of /etc/bash.bashrc file
      • Restart your system
      • Follow the instruction in http://publib.boulder.ibm.com/infocenter/wpfhelp/v6r1m0/index.jsp?topic=/com.bowstreet.designer.doc/get_start/sap_getting_started.htm
      After the above steps, I am able to do a "Test Connection" from the builder, however, when trying to test the application, I got "noclassdeffounderror" for the jco class. In order to fix that, I have to update geronimo.sh file and add /opt/sapjco, into $EXT_DIRS variable.

      Restart your server after that. Then you should be able to test the model