On Sep 4, 2007, at 7:43 AM, [EMAIL PROTECTED] wrote:

Hello,
I have a quick question on the JetExpress tutorial, which I find
very useful, since I'm new to both Jetspeed and the portlet development.

In the "05. Jetspeed Services" section, there is a code snippet
after the line "Enter the following code into the init(PortletConfig
config) method, replacing whats there:".  I think there should be a
call made to super.init(config) in the beginning of that snippet,
but am I correct?
Without this call, I get "Failed to load portlet
com.bluesunrise.portal.portlets.services.ServicesTutorialPortlet:
java.lang.NullPointerException" message in the portlet window fragment.

Thanks

By the way, at the end of that section, the tutorial instructs me to
implement the undefined methods, but I wasn't quite clear on how to
implement modifyPages().  I looked into the API document, but still
can't figure out how.
Can you give me a pointer to further information on how to use
Jetspeed Services?


Well its supposed to be an exercise, but I can give you a solution if you want I have a real solution but its on my other computer that is on loan right now This is one I just wrote without testing, its not exactly complete but should give you the general idea

    private String modifyPages()
    {
// using the users init param, modify pages with the PageManager service. // If the page doesnt exist, dont create it. Modifications: for user1, create a 1 column collection of 1 portlet, // for user2, create a 2 column collection of 2 portlets, for user3 create a 3 column collection of 3 portets
        int count = 0;
        Iterator users = this.newUsers.iterator();
        while (users.hasNext())
        {
            String username = (String)users.next();
            try
            {
if (!pageManager.folderExists(Folder.USER_FOLDER + username))
                {
Folder folder = pageManager.newFolder (Folder.USER_FOLDER + username);
                    folder.setTitle("Home");
                    pageManager.updateFolder(folder);
Page page = pageManager.newPage (Folder.USER_FOLDER + username + Folder.PATH_SEPARATOR + "home.psml");
                    Fragment root = pageManager.newFragment();
root.setName("jetspeed- layouts::VelocityOneColumn"); Fragment portlet = pageManager.newPortletFragment ();
                    portlet.setName("app::portletname");
                    root.getFragments().add(portlet);
                    page.setRootFragment(root);
                    pageManager.updatePage(page);
                    count++;
                }
            }
            catch (Exception e)
            {
                // ....
                break;
            }
        }
...

Reply via email to