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

Managing Collaboration Documents Using IDK Remote APIs

To check in and check out Collaboration documents from a remote application, use the IDocumentManager interface in the IDK.

Only one person can check out a document at a time. To check out a document, the current user must have at least WRITE access to the document.
Checking in a document saves a new version of the document, increments the current version number, and makes a new entry in the document's history. When you check in a document, you can set the following properties:
Check in comment Required. A string that will be added as the first check in comment for the new document.
Input stream Required. An InputStream from which the contents of the new document can be read.
Language The ISO 639-1 language code for the content in the document (for example, en for english). If null, the language is set to that of the current user.
Keep checked out If set to true, the document will be checked in and automatically checked out again. The default is false.
To check out or check in documents, follow the steps below.
  1. Initiate a PRC session. This example retrieves a login token using the IPortletContext; you can also use IRemoteSession. (For details, see Initiating a PRC Session to Use IDK Remote APIs.)
  2. Get the Document Manager.
  3. Get the document ID and retrieve the document.
    • To check out the document, pass in the document instance.
    • To check in the document, pass in the document instance, the check in comment, the input stream, language (optional) and whether or not the file should be checked out again as shown in the code samples below.

Java

...

IRemoteSession remoteSession = portletContext.getRemotePortalSession();
IDocumentManager documentManager = remoteSession.getCollaborationFactory().getDocumentManager();

//get the document
IDocument checkedOutDocument = documentManager.getDocument(documentID);

//Open an inputstream for the document contents - this can be any InputStream
InputStream fileInputStream = new FileInputStream("c:\\myNewDocument.doc");

//Check in the new version
documentManager.checkInDocument(checkedOutDocument, "updated version of the document", fileInputStream, "en", false);

...

.NET (C#)

...

remoteSession = portletContext.GetRemotePortalSession();
documentManager = remoteSession.GetCollaborationFactory().GetDocumentManager();

//get the document
IDocument checkedOutDocument = documentManager.GetDocument(documentID);

//open an inputstream for the document contents - this can be any readable Stream
Stream fileInputStream = File.OpenRead("c:\\MyNewDocument.doc");

//check in the new version
documentManager.CheckInDocument(checkedOutDocument, "updated version of the document", fileInputStream, "en", false);

...

.NET (VB)

...

dim documentManager As IDocumentManager
dim remoteSession As Plumtree.Remote.PRC.IRemoteSession
remoteSession = portletContext.GetRemotePortalSession()
documentManager = remoteSession.GetCollaborationFactory().GetDocumentManager()

'get the document
IDocument checkedOutDocument = documentManager.GetDocument(documentID)

'Open an inputstream for the document contents - this can be any readable Stream
dim fileInputStream As Stream = File.OpenRead("c:\\MyNewDocument.doc")

'Check in the new version
documentManager.CheckInDocument(checkedOutDocument, "updated version of the document", fileInputStream, "en", false)

...

  Back to Top      Previous Next