ShowTable of Contents
IBM® Lotus® Quickr® is team collaboration software that can help you access and interact with the people, information, and project materials you need to perform your work, and is available for both the IBM Lotus Domino® server and the WebSphere® Portal server. Here we use Lotus Quickr on WebSphere Portal
as a content repository to store the information in documents.
IBM FileNet® P8 Platform
is a next-generation, unified enterprise foundation for the integrated FileNet P8 products. It includes a comprehensive set of content and process management business services that can be consumed and deployed in a service-oriented architecture.
Using IBM Eclipse for development
You can use Apache Abdera Representational State Transfer (REST) API with any JavaTM
Development Kit version 1.4 for downloading script on Quickr for WebSphere. For information about the Apache Abdera REST services, refer to the developerWorks® article,“Introducing IBM Lotus Quickr REST services
For uploading script you can use IBM FileNet P8 Content API with Development Kit 1.4. For more information about the FileNet API, refer to the article, “Writing great code with the IBM FileNet P8 APIs...
Manually uploading documents to IBM FileNet is tedious and time consuming but, by using the scripts, we can upload documents to FileNet quickly and easily. The basic idea of our implementation is to download the documents in bulk from Lotus Quickr and then to upload the documents to the IBM FileNet in bulk, using the scripts in a short span of time.
We will look at the code implementation of the script and how to easily transfer the copies of documents in bulk from one repository (Lotus Quickr) to another repository (IBM FileNet) step by step, using the API's.
Downloading documents from the Quickr Library
Let’s start with the download code. In Lotus Quickr the documents are organized in a library, so to download all documents we need to retrieve all the library content. Quickr services are available to read the Atom RSS Feeds.
A client object is created with the UserID and password to authenticate the client, which can perform any operation on the service document. To do that we need to send the request in the form of URL, that is, an introspection URL to perform HTTP operations like GET, POST, PUT, and DELETE on the service document. (See the product documentation link above for more information.) A sample introspection URL is
The RequestURL to download all documents from a library is
You can also append ‘?pagesize=50’ to this URL, to filter only 50 Documents; if you don't specify the page size, it will take the default page size value of 10.
The code to download is shown in listing 1.
Listing 1. Code to download
Here, “client” Object refers to the Apache Abdera client object through which we can send the request URL to the Quickr server. This in turn returns the “ContentResponse” and, if the response status is successful, then it's iterated to get the documentobject.
The ContentrequestURL is obtained from the documentobject entry1.getContentSrc(), which in turn returns the RequestURL of each document.
To download the document along with its metadata, we write all the metadata into a file (here it is FilenetConnector.txt), using the java OutputStreamWriter class and using the code shown in listing 2.
Listing 2. Code to write document metadata to a file
//creating the file
BufferedWriter runwriter = new BufferedWriter(new
//Writing the documentdownloadpath,documentname,updateddate,version to the
Downloading a particular document from Lotus Quickr
To download a particular document from the Quickr Library, you need to know the documentId (the documentId is the unique ID of each document available in the Quickr Library), to pass it in the request URL. The RequestURL to download the particular document is
When you pass this RequestURL to the code, the response will give you only one entry (as this request is for only one document), and with that you are able to download the document.
For example, is we are going to download a document such as “Basics of unix.doc” from the Training Library in the Quickr, then we need to pass the documentId of “Basics of unix.doc” in the above request URL.
As an exercise, you can try downloading the document from the particular folder in a library in Lotus Quickr, once you done with the above sample work.
The Java file that downloads all documents from the Quickr Library is in the attached .zip file,
DownloadallDoc.java. It downloads all documents from the Training library (see figure 1).
To download the files, run the code in the command prompt as follows:
Java DownloadallDoc http:///dm/atom
argument 1 is the Quickr Atom URL,Figure 1. All Documents view in Quickr Training library
arguments 2 & 3 are the userid & password to authenticate the user.
Uploading documents to IBM FileNet
Now let’s discuss how to upload the documents to IBM FileNet. The code reads the FilenetConnector.txt file and, from each line, it picks up the document path and the metadata of the document.
The FileNet API refers to each document as Document Object (com.filenet.api.core.Document), which includes the ‘Document Reservation’ object and ‘Content Reservation’ object.
The document metadata are set as properties in the ‘Document Reservation’ object, and the actual document is stored in the ‘Content Reservation’ object of the FileNet Document object. Finally, the ‘Document Reservation’ object is checked in to the FileNet.
The document reservation object is something we need to create, if the document is going to be uploaded to FileNet the first time. If we are going to check in different versions of the already existing document in FileNet, then we can use the document reservation of the existing version in FileNet.
Let’s examine the upload process in detail. Uploading a document to FileNet involves a few steps of code, as shown in the following listings:
Listing 3. Step 1: Authenticate and create the connection to FileNet
Listing 4. Step 2: Get the ObjectStore
* This method create session in the filenet engine .
private void createCESession()
// Get the connection and default domain
conn = Factory.Connection.getConnection(strURI);
subject = UserContext.createSubject(conn, strUserName, strPassword, "FileNetP8WSI");
uc = UserContext.get();
domain = Factory.Domain.getInstance(conn, null);
System.out.println("Exception connecting to P8 " + e.getMessage());
objStore = Factory.ObjectStore.fetchInstance(domain, "DocumentLibrary", null);
where “DocumentLibrary” is the ObjectStore name, and objStore is like a main folder under which documents are organized in the folder structure. FileNet may contain many ObjectStores.
Listing 5. Step 3: Read FilenetConnector.txt file line by line
Listing 6. Step 4: Method for checking whether the document already exists in the folder
BufferedReader input = new BufferedReader(new FileReader(fileImport) );
String line = null;
while ((line = input.readLine()) != null)
// read the documentpath and metadata
Listing 7. Step 5: Check in and save the document to IBM FileNet
* @param strDocTitle
* @param aFolder
private Document checkExists(String strDocTitle, Folder aFolder)
DocumentSet docSet = aFolder.get_ContainedDocuments();
Iterator it = docSet.iterator();
Document doc = (Document)it.next();
String strName = doc.get_Name();
After running the code, you can determine the status of the uploaded document by checking the log file for any errors in /QuickrDoc/FileNetConnector.txt.
The Java file to upload the documents to Quickr, UploadtoFileNet.java, is in the attached zip file. The file picks up the document from the path /QuickrDoc/ to the folder, ‘Folder1’, in the ‘DocumentLibrary’ in IBM FileNet.
The following parameters should be replaced with the values appropriate for your FileNet server:
- <Propertyname_DocLatestVersion>,<Document Classtype>
To upload a document, run the code in the command prompt:
Java UploadtoFileNet import
Figure 2 shows a sample view of the FileNet repository, in which you can see ‘Folder1’ under the Document Library. The folders without names have been hidden for security purposes.
Figure 2. Example of the IBM FileNet repository
Figure 3 shows the sample view of the FileNet repository after we upload the ‘Basics of unix.doc’ document.
Figure 3. Example of FileNet with uploaded document
In this article, we demonstrated how to migrate documents from IBM Lotus Quickr to IBM FileNet using the REST API and FileNet API. You can create your own script based on your requirements, for example, to download files of a particular type such as video files, text files, or Excel files, and then can upload them to FileNet.
Quickr Web services is also available to perform operations on Lotus Quickr, but many of the operations are just read only, so you could use a combination of Quickr REST API and Web services, to make use of the best features in each.
developerWorks Lotus Quickr product page:
IBM Support Techdoc: “Product Documentation for FileNet P8 Platform”:
developerWorks article, “Introducing IBM Lotus Quickr Web services:
About the author
is a Senior System Engineer for IBM INDIA PVT LTD., currently working as a Java Application Developer. Her experience includes work in J2EE Applications in CORE Banking domain, WebSphere Portal applications, and with IBM tools such as Lotus Quickr. You can reach her at firstname.lastname@example.org