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

Querying Object Properties Using Oracle WebCenter Interaction Development Kit (IDK) Remote APIs

To query the properties of a specific portal object from a remote application, use the instance of IObjectQueryRow that represents the portal object.

To query the properties of a specific portal object, 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 Object Manager for the type of object you are querying. For details, see Retrieving Object Managers Using Oracle WebCenter Interaction Development Kit (IDK) Remote APIs.
  3. Use the Object Manager to query for the object. For details, see Querying Objects Using Oracle WebCenter Interaction Development Kit (IDK) Remote APIs.
    Note: You must include the properties you want to query in the propsToReturn parameter when you query for the object.
  4. Use the instance of IObjectQueryRow that represents the portal object to query for object properties or for custom properties. The code below uses the getValue call to retrieve object property values. The IObjectQueryRow interface also provides methods that cast the requested property to a known data type. Attempting to retrieve a property as an incorrect data type will result in an exception.
    Note: If you attempt to retrieve a property that was not specified as a field in the propsToReturn parameter in the query for the object, a PropertyNotRequestException will be thrown.
The following sample code demonstrates how to query the object properties of a specific community. This example prints out most of the standard properties available on community objects, including generic object properties and all community-specific properties (all fields in CommunityProperty).

Java

public static void printCommunityProperties(IObjectQueryRow communityObject) throws
PropertyNotRequestedException
{
    System.out.println("Object ID is " + communityObject.getID());
    System.out.println("Created Date is " + communityObject.getCreated());
    System.out.println("Description is " + communityObject.getDescription());
    System.out.println("Name is " + communityObject.getName());
    System.out.println("Last Modified Date is " + communityObject.getLastModified());
    System.out.println("Owner ID is " + communityObject.getOwner());
    System.out.println("Parent folder ID is " + communityObject.getParentFolderID());
 
    if(communityObject.getObjectClass() == ObjectClass.Community) //only one instance so reference comparison is ok
    {
        System.out.println("Template ID is " + communityObject.getValue(CommunityProperty.CommunityTemplateID));
        System.out.println("Footer ID is " + communityObject.getValue(CommunityProperty.FooterID));
        System.out.println("Header ID is " + communityObject.getValue(CommunityProperty.HeaderID));
        System.out.println("MandatoryTabOrder is " + communityObject.getValue(CommunityProperty.MandatoryTabOrder));
        System.out.println("OwnerInfo is " + communityObject.getValue(CommunityProperty.OwnerInfo));
        System.out.println("SiteMapRoot ID is " + communityObject.getValue(CommunityProperty.SiteMapRootID));
    }
    else System.out.println("Not a community object!");
}

.NET (C#)

public static void PrintCommunityProperties(IObjectQueryRow communityObject)
{
    Console.Out.WriteLine("Object ID is " + communityObject.GetID());
    Console.Out.WriteLine("Created Date is " + communityObject.GetCreated());
    Console.Out.WriteLine("Description is " + communityObject.GetDescription());
    Console.Out.WriteLine("Name is " + communityObject.GetName());
    Console.Out.WriteLine("Last Modified Date is " + communityObject.GetLastModified());
    Console.Out.WriteLine("Owner ID is " + communityObject.GetOwner());
    Console.Out.WriteLine("Parent folder ID is " + communityObject.GetParentFolderID()); 

    if(communityObject.GetObjectClass() == ObjectClass.Community) //only one instance so reference comparison is ok
    {
        Console.Out.WriteLine("Template ID is " + communityObject.GetValue(CommunityProperty.CommunityTemplateID));
        Console.Out.WriteLine("Footer ID is " + communityObject.GetValue(CommunityProperty.FooterID));
        Console.Out.WriteLine("Header ID is " + communityObject.GetValue(CommunityProperty.HeaderID));
        Console.Out.WriteLine("MandatoryTabOrder is "+ communityObject.GetValue(CommunityProperty.MandatoryTabOrder));
        Console.Out.WriteLine("OwnerInfo is " + communityObject.GetValue(CommunityProperty.OwnerInfo));
        Console.Out.WriteLine("SiteMapRoot ID is " + communityObject.GetValue(CommunityProperty.SiteMapRootID));
    }
    else Console.Out.WriteLine ("Not a community object!");
}

.NET (VB)

Public Shared Sub PrintCommunityProperties(ByVal communityObject As IObjectQueryRow) 

    Console.Out.WriteLine("Object ID is " & communityObject.GetID())
    Console.Out.WriteLine("Created Date is " & communityObject.GetCreated())
    Console.Out.WriteLine("Description is " & communityObject.GetDescription())
    Console.Out.WriteLine("Name is " & communityObject.GetName())
    Console.Out.WriteLine("Last Modified Date is " & communityObject.GetLastModified())
    Console.Out.WriteLine("Owner ID is " & communityObject.GetOwner())
    Console.Out.WriteLine("Parent folder ID is " & communityObject.GetParentFolderID()) 

    If communityObject.GetObjectClass() = ObjectClass.Community Then 'only one instance so reference comparison is ok
        Console.Out.WriteLine("Template ID is " & communityObject.GetValue(CommunityProperty.CommunityTemplateID))
        Console.Out.WriteLine("Footer ID is " & communityObject.GetValue(CommunityProperty.FooterID))
        Console.Out.WriteLine("Header ID is " & communityObject.GetValue(CommunityProperty.HeaderID))
        Console.Out.WriteLine("MandatoryTabOrder is " & communityObject.GetValue(CommunityProperty.MandatoryTabOrder))
        Console.Out.WriteLine("OwnerInfo is " & communityObject.GetValue(CommunityProperty.OwnerInfo))
        Console.Out.WriteLine("SiteMapRoot ID is " & communityObject.GetValue(CommunityProperty.SiteMapRootID))
    Else
        Console.Out.WriteLine("Not a community object!")
    End If
EndSub

To query for custom properties of an object, use the IExtendedData interface. This example prints out all the custom properties available on a portal object by enumerating through the available properties and printing out their name and value. To retrieve property IDs, use the standard object manager object querying method with ObjectClass.Property, and use the ID on the object returned to query for the properties you need.

Java

public static void printCustomProperties(IObjectQueryRow portalObject)
    throws PortalException, MalformedURLException, RemoteException
{
    IExtendedData customProperties = portalObject.getExtendedData();

    Enumeration propertyNames = customProperties.getNames();
    String propertyName;

    while(propertyNames.hasMoreElements())
    {
        propertyName = (String)propertyNames.nextElement();
        System.out.println("Property "+ propertyName + " is "+ customProperties.getValue(propertyName));
    }
}

.NET (C#)

public static void PrintCustomProperties(IObjectQueryRow portalObject)
{
    IExtendedData customProperties = portalObject.GetExtendedData(); 

    IEnumerator propertyNames = customProperties.GetNames();
       string propertyName;       

    while(propertyNames.MoveNext())
    {
        propertyName = (string)propertyNames.Current;
        Console.WriteLine("Property " + propertyName + " is " + customProperties.GetValue(propertyName));
    }
}

.NET (VB)

Public Shared Sub PrintCustomProperties(ByVal portalObject As IObjectQueryRow) 

    Dim customProperties As IExtendedData = portalObject.GetExtendedData() 
    Dim propertyNames As IEnumerator = customProperties.GetNames()
    Dim propertyName As String 

    While propertyNames.MoveNext() 

        propertyName = propertyNames.Current
        Console.WriteLine("Property " & propertyName & " is " & customProperties.GetValue(propertyName))

    End While
EndSub

  Back to Top      Previous Next