Technical Blog Post
HelloCMIS - HelloDocument: Creating Folders and Content
With the release of IBM Content Navigator on Cloud, customers are embracing the concept of cloud for managing their documents. With IBM, they know the documents will be secured and hosted in an enterprise class data center.
In the first article we connected to our Navigator on Cloud instance, browsed the folder structure, and executed some simple queries. In this article, we will create a new folder and file a new document from the local file system into the new folder. Although very simple, this example can easily be converted to handle content submitted via a web site
Apache Chemistry makes it easy
Connecting to Navigator on Cloud
OpenCMIS makes heavy use of property Maps as a simple way to collect named value pairs of parameters for operations and this example uses a HashMap. Create a session by adding a number of required SessionParameters into the Map and creating the session as shown below.
Creating a new Folder
As will all objects in a Content Navigator system, the required and optional properties will be determined by the Class of the Object. The base Folder class has a single property – Folder Name – that is required.
We will file the new folder under the root folder and must first get an instance of that root folder. With the root folder obtained, creating a new folder is as simple as calling the createFolder method with the required properties.
File a Document in to the Folder
Creating a document is a little more work than creating a folder but follows the same pattern. Much like creating a Folder, creating a Document requires setting the object properties by way of a HashMap. Once the property HashMap is populated, it is necessary to create the ContentStream that contains information about the document itself as well as an InputStream of the bytes.
Apache Chemistry openCMIS documentation and libraries
CMIS Development Forum - ask questions, get answers.