AquaLogic User Interaction Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Editing Portlets and Portlet Templates Using IDK Remote APIs

To modify settings for a portlet or portlet template object from a remote application, use the IPortlet and IPortletTemplate interfaces in the IDK.

The IPortlet* interfaces allow you to set the name, description and alignment for a portlet or portlet template. You can also edit Administrative settings for a portlet or portlet template, or modify CommunityPortlet settings for a portlet. To edit an existing portlet or portlet template, follow the steps below.
  1. Create a session with the portal. For details, see Initiating a PRC Session to Use IDK Remote APIs.
  2. Retrieve an IPortletManager or IPortletTemplateManager object by calling IRemoteSession.getPortletManager or getPortletTemplateManager.
  3. Retrieve an existing portlet or portlet template using IPortletManager.getPortlet or IPortletTemplateManager.getPortletTemplate. (To query for the portlet or portlet template ID, execute a standard object query.)
  4. Edit the portlet or portlet template as shown in the sample code below.
This example demonstrates how to change the alignment, name and description, and edit a administrative setting for a portlet template. To make the same changes to a portlet, replace all instances of "portletTemplate" with "portlet".

Java

public static void editPortletTemplate(IPortletTemplate portletTemplate)
 throws PortalException, MalformedURLException, RemoteException
{
 portletTemplate.setAlignment(Alignment.Narrow);
 portletTemplate.setName("IDK Test Document EDITED"); 
 portletTemplate.setDescription("Edited by IDK example"); 
 portletTemplate.save();
}

public static void addAdminSetting(IPortletTemplate portletTemplate,
String settingName, String settingValue)
 throws PortalException, MalformedURLException, RemoteException
{
 portletTemplate.addAdminSetting(settingName, settingValue);
 portletTemplate.save();
}

.NET (C#)

public static void EditPortletTemplate(IPortletTemplate portletTemplate)
 throws PortalException, MalformedURLException, RemoteException
{
 portletTemplate.SetAlignment(Alignment.Narrow);
 portletTemplate.SetName("IDK Test Document EDITED"); 
 portletTemplate.SetDescription("Edited by IDK example"); 
 portletTemplate.Save();
}

public static void AddAdminSetting(IPortletTemplate portletTemplate,
string settingName, string settingValue)
{
 portletTemplate.AddAdminSetting(settingName, settingValue);
 portletTemplate.Save();
}

.NET (VB)

Public Shared Sub EditWebLinkDocument(ByVal portletTemplateManager As IPortletTemplate)

 portletTemplate.SetAlignment(Alignment.Narrow)
 portletTemplate.SetName("IDK Test Document EDITED")
 portletTemplate.SetDescription("Edited by IDK example")
 portletTemplate.Save()

EndSub

Public Shared Sub AddAdminSetting(ByRef portletTemplateManager As IPortletTemplate, 
ByVal settingName As String, ByVal settingValue As String)

 portletTemplate.AddAdminSetting(settingName, settingValue)
 portletTemplate.Save()

EndSub

  Back to Top      Previous Next