JAVA/CORBA CLASSES


Examples: addDocument method
This agent combines two document collections putting the result in the first collection.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
 public void NotesMain() {
   try {
     Session session = getSession();
     AgentContext agentContext = session.getAgentContext();
     // (Your code goes here)
     Database db = agentContext.getCurrentDatabase();
     if (db.isFTIndexed()) db.updateFTIndex(false);
     else db.updateFTIndex(true);
     DocumentCollection dc1 = db.getAllDocuments();
     DocumentCollection dc2 = db.getAllDocuments();
     dc1.FTSearch("blue");
     dc2.FTSearch("red");
     Document doc = dc2.getFirstDocument();
     while (doc != null) {
       // Make sure it's not already there before adding
       if (dc1.getDocument(doc) == null)
         dc1.addDocument(doc);
       doc = dc2.getNextDocument(); }
     doc = dc1.getFirstDocument();
     while (doc != null) {
       System.out.println(doc.getItemValueString("Subject"));
       doc = dc1.getNextDocument(); }
   } catch(NotesException e) {
     System.out.println(e.id + " " + e.text);
     e.printStackTrace();
   }
 }
}

See Also