JAVA/CORBA CLASSES


Examples: getNthDocument method
This agent demonstrates a function that gets a document in a document collection specified by number.

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();
     DocumentCollection dc = db.getAllDocuments();
     int N = 3;
     printDocument(dc, N);
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
 void printDocument(DocumentCollection dc, int n) {
   try {
     if (n < 0 || n > dc.getCount())
       System.out.println("N out of range");
     else
       System.out.println("Doc #" + n + ": " +
       dc.getNthDocument(n).getItemValueString("Subject"));
   
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also