JAVA/CORBA CLASSES


Examples: getDocument method
This agent gets all the documents in one collection, noting which ones are also in another 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();
     dc2.FTSearch("blue");
     String izz = "";
     Document tmpdoc;
     Document doc = dc1.getFirstDocument();
     while (doc != null) {
       // Make sure dc2 is not empty before doing getDocument
       if (dc2.getCount() != 0 && dc2.getDocument(doc)
       != null)
         izz = " is blue";
       else izz = " is not blue";
       System.out.println
       (doc.getItemValueString("Subject") + izz);
       tmpdoc = dc1.getNextDocument();
       doc.recycle();
       doc = tmpdoc;
     }
   } catch(NotesException e) {
     System.out.println(e.id + " " + e.text);
     e.printStackTrace();
   }
 }
}

See Also