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

Querying Collaboration Folders and Documents Using IDK Remote APIs

To query existing Collaboration documents and folders from a remote application, use the IDocumentManager interface in the IDK.

The PRC Collaboration API allows you to query existing folders or documents in a given project or folder. Results can be filtered in a variety of ways.
  • To query for existing folders in a parent folder, use IDocumentManager.queryFolders using the parent folder instance. To return all folders in a project, get the top level document folder for the project using getTopLevelFolder, then query the top level document folder for all the document folders it contains.
  • To query for existing documents in a folder, use IDocumentManager.queryDocuments using the folder instance.
  • To query for existing documents in a project, use IDocumentManager.queryDocuments using the project instance.
For any of these queries, the IDocumentFolderFilter/IDocumentFilter interfaces allow you to set the following search options:
Maximum Results Sets the maximum number of results returned. The default is to return all results.
Order-By Fields and Sort Order Sets the fields to be displayed with an order-by functionality (name or last modified date), and sets the sort order (ascending or descending). The following fields support the order-by option for documents: name, author, project, parent folder, content type, size (bytes), timestamp, last modified, last check in user, check out user.
Security Enables or disables the security filter that applies security to the result set with respect to the user that submitted the query. If the filter is enabled, the query result will only include objects for which the querying user has appropriate permission. The default is false (disabled); all objects matching the query criteria will be returned.
Result Filter: Checkin Status Documents only. Limits queries by document status (checked in or checked out).
To query for folders or documents in a folder or project, follow the steps below.
  1. Create a PRC session. For details, see Initiating a PRC Session to Use IDK Remote APIs.
  2. Get the Document Manager.
  3. Get the ID of the parent folder or project. To query all the folders in a project, get the top level document folder for the project using getTopLevelFolder.
  4. Create a query filter and execute the query as shown in the code samples below.
The examples below query a project for all checked-out documents and order results by size and then last-modified date.

Java

...

//create a query filter
IDocumentFilter filter = manager.createDocumentFilter();

//set to only search for checked-out documents
filter.filterType = DocumentFilterTypes.checkedOutByCurrentUser;

//order results by size, then last modified date
DocumentQueryOrder sizeOrder = new DocumentQueryOrder(DocumentFolderAttribute.NUMBYTES, true);
DocumentQueryOrder lastModifiedOrder = new DocumentQueryOrder(DocumentFolderAttribute.LASTMODIFIED, true);
DocumentQueryOrder[] orders = new DocumentQueryOrder(sizeOrder, lastModifiedOrder);
filter.setQueryOrders(orders);

//perform the query
IDocument[] foundDocuments = manager.queryDocuments(project, filter);

...

.NET (C#)

...

//create a query filter
IDocumentFilter filter = documentManager.CreateDocumentFilter();

//set to only search for checked-out documents
filter.FilterType = DocumentFilterTypes.CheckedOutByCurrentUser;

//order results by size, then last modified date
DocumentQueryOrder sizeOrder = new DocumentQueryOrder(DocumentAttributes.NumBytes, true);
DocumentQueryOrder lastModifiedOrder = new DocumentQueryOrder(DocumentAttributes.LastModified, true);
DocumentQueryOrder[] orders = new DocumentQueryOrder(sizeOrder, lastModifiedOrder);
filter.QueryOrders = orders;

//perform query
IDocument[] foundDocuments = documentManager.QueryDocuments(project, filter);

...

.NET (VB)

...

'create a query filter
dim filter As IDocumentFilter = documentManager.CreateDocumentFilter()

'set to only search for checked-out documents
filter.FilterType = DocumentFilterTypes.CheckedOutByCurrentUser;

'order results by size, then last modified date
dim sizeOrder As DocumentQueryOrder = new DocumentQueryOrder(DocumentAttributes.NumBytes, true)
dim lastModifiedOrder As DocumentQueryOrder = new DocumentQueryOrder(DocumentAttributes.LastModified, true)
dim orders As DocumentQueryOrder[] = new DocumentQueryOrder(sizeOrder, lastModifiedOrder)
filter.QueryOrders = orders

'perform query
dim foundDocuments As IDocument[] = documentManager.QueryDocuments(project, filter)

...

  Back to Top      Previous Next