HomeSite Administration Page 2 - Connect Lotus Domino Server through Standalone Application with CORBA
Start Working with Documents - Administration
This article discusses Lotus Domino Notes, especially how to access to the documents stored in it with CORBA. This feature allow developers to write standalone applications that will use documents of Lotus. Moreover, the developer won't have to learn CORBA because the Lotus Domino Server has already mapped all interfaces, so we are pure users of an API. This article assumes you already have installed a Lotus Domino Server, configured the IIOP properly, and that you know how to create nsf database files.
We have to create the document and call the method replaceItemValue, where the first argument is the name of the field, and the second, its content. The content argument is a class java.lang.Object. This is because in single value fields, we pass a String, but in multiple values fields we can put a java.util.Vector with all the Strings we want to save.
Furthermore, we have the ability of attach files. Note: the files must be resident in Lotus Domino Server, not in the client application. A good solution can be to upload them beforehand with FTP. When the file is already attached in the server, we must do this:
RichTextItem body = doc.createRichTextItem("Body"); body.embedObject(EmbeddedObject.EMBED_ATTACHMENT ,"", "c:inetpubftproot22572.txt", "22572.txt");
We will use RichTextItem class. This class has methods to transform the data into XML, copy attachments, consult its content ...
What we do in the code is to create in field called Body, a RichTextItem, and in this case we paste a file that is located in c:inetpubftproot22572.txt in the SERVER.
Document class has a lot of methods to interact with a Lotus Document. It's simple, and by consulting javadoc, you will be able to execute all operations against Domino.
The last thing you must do is to save a document. This is obvious but it easy to forget.