Oracle WebCenter Interaction Web Service Development Guide

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

Creating Portlets and Portlet Templates Using Oracle WebCenter Interaction Development Kit (IDK) Remote APIs

To manipulate portlet and portlet template objects in Oracle WebCenter Interaction Administration from a remote application, use the IPortlet* interfaces in the Oracle WebCenter Interaction Development Kit (IDK).

Creating portlets and portlet templates is very similar; if you create a portlet from a portlet template, it inherits the settings and properties from the template. There is no further relationship between the two objects; changes in a template are not reflected in individual portlet instances made from that template. To create a new portlet or portlet template, follow the steps below.
  1. Create a session with the portal. For details, see Initiating a PRC Session to Use Oracle WebCenter Interaction Development Kit (IDK) Remote APIs.
  2. Retrieve an IPortletManager IPortletTemplateManager object by calling IRemoteSession.getPortletManager or getPortletTemplateManager.
  3. Create the portlet or portlet template as shown in the sample code below.
    1. Create a new method to create a new portlet template or portlet.
    2. Create the portlet template object using the parent folder ID and the web service ID (to create a portlet, you would provide the portlet template ID).
      • There are three ways to retrieve an administrative folder ID: (1) Use PRC search to perform a search for administrative folder objects, (2) Query for an existing portlet or portlet template and use its parent folder ID (available from the IPortlet or IPortletTemplate object), or (3) Let the user select a folder by using a pt:treeLink tag with classID = 20. (There is no Object Manager for administrative folders.) For details on tags, see con_tags.html.
      • To query for the web service ID, execute a standard object query using ObjectClass.WebService.
    3. Set the name and description for the portlet template or portlet object.
    4. Save the portlet template or portlet.
    5. Return the ID for the newly created portlet template or portlet.
This example demonstrates how to create a new portlet template based on a web service. To create a new Portlet, replace all instances of "PortletTemplate" with "Portlet" and pass in a Portlet Template ID instead of the Web Service ID.

Java

public static int createPortletTemplate(IPortletTemplateManager portletTemplateManager,
int parentfolderID, int webserviceID)
    throws PortalException, MalformedURLException, RemoteException
{
    IPortletTemplate portletTemplate = portletTemplateManager.createPortletTemplate(parentFolderID, webserviceID);
    portletTemplate.setName("IDK Test Template");
    portletTemplate.setDescription("Created in IDK example");
    int portletTemplateID = portletTemplate.save();
    return portletTemplateID;
}

.NET (C#)

public static int CreatePortletTemplate(IPortletTemplateManager portletTemplateManager,
int parentfolderID, int webserviceID)
{
    IPortletTemplate portletTemplate = portletTemplateManager.CreatePortletTemplate(parentFolderID, webserviceID);
    portletTemplate.SetName("IDK Test Template");
    portletTemplate.SetDescription("Created in IDK example");
    int portletTemplateID = portletTemplate.Save();
    return portletTemplateID;
}

.NET (VB)

Public Shared Function CreatePortletTemplate( _
    ByVal portletTemplateManager As IPortletTemplateManager, ByVal parentfolderID
As Integer, ByVal webserviceID As Integer) As Integer

    Dim portletTemplate As IPortletTemplate = portletTemplateManager.CreatePortletTemplate(parentfolderID,webserviceID)
    portletTemplate.SetName("IDK Test Template");
    portletTemplate.SetDescription("Created in IDK example");
    Dim portletTemplateID As Integer = portletTemplateID = portletTemplate.Save()

    Return portletTemplateID

End Function

  Back to Top      Previous Next