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 Documents in the Directory Using Oracle WebCenter Interaction Development Kit (IDK) Remote APIs

To create new remote documents in the portal Directory from a remote application, use the IRemoteDocument and IWebLinkDocument interfaces in the Oracle WebCenter Interaction Development Kit (IDK).

The IWebLinkDocument interface can only be used for HTML pages. To create a remote document of another type, use IRemoteDocument and set the content type. To create a new document, 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 IDocumentManager object by calling IRemoteSession.getDocumentManager.
  3. Create the document, as shown in the sample code below.
    1. Create a new method to create a new Web Link document.
    2. Create the document with the specified parameters: the folder ID, Content Source ID, and the URL to the html page.
      • There are two ways to retrieve a folder ID: (1) Use the PRC search API to perform a search for document folder objects, or (2) Let the user select a folder by using a pt:treeLink tag with classID = 17. (There is no Object Manager for document folders.). For details on tags, see con_tags.html.
      • This example uses the standard World Wide Web Content Source (ID 104). To query for available Content Sources, execute a standard object query using ObjectClass.DataSource.
    3. Override the document name.
    4. Save the document.
    5. Return the newly created document ID.
This example demonstrates how to create a new Web Link document (HTML page). The implementation of IRemoteDocument is identical to the sample code shown below with one exception: you must set the Content Type. To query for available Content Types, execute a standard object query using ObjectClass.DocumentType.

Java

public static void createWebLinkDocument(IDocumentManager documentManager, int folderID, String URL)
 throws PortalException, MalformedURLException, RemoteException
{
 IWebLinkDocument webLinkDocument =
  documentManager.createWebLinkDocument(folderID,104, URL);// 104 is WWW Content Source
 webLinkDocument.setOverrideName("EDK Test Document"); // overrride intrinsic name
 int documentID = webLinkDocument.save();
 return documentID;
}

.NET (C#)

public static void CreateWebLinkDocument(IDocumentManager documentManager, int folderID, string URL)
 throws PortalException, MalformedURLException, RemoteException
{
 IWebLinkDocument webLinkDocument =
  documentManager.CreateWebLinkDocument(folderID,104, URL);// 104 is WWW Content Source
 webLinkDocument.SetOverrideName("EDK Test Document"); // overrride intrinsic name
 int documentID = webLinkDocument.Save();
 return documentID;
}

.NET (VB)

Public Shared Function CreateWebLinkDocument( _
 ByVal documentManager As IDocumentManager, ByVal folderID As Integer, ByVal URL As String)As Integer

 Dim webLinkDocument As IWebLinkDocument =
  documentManager.CreateWebLinkDocument(folderID,104, URL)' 104 is WWW ContentSource
 webLinkDocument.SetOverrideName("EDK Test Document")' overrride intrinsic name
 Dim documentID As Integer = webLinkDocument.Save()
 Return documentID

EndFunction

  Back to Top      Previous Next