JAVA/CORBA CLASSES


Examples: IsAuthors, IsNames, and IsReaders properties
This agent locates the items of type Authors, Names, and Readers in a document.

import lotus.domino.*;
import java.util.Vector;
import java.util.Enumeration;
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();
     Document doc = dc.getFirstDocument();
     Vector authors = new Vector();
     Vector names = new Vector();
     Vector readers = new Vector();
     if (doc != null) {
       Enumeration items = doc.getItems().elements();
       while (items.hasMoreElements()) {
         Item item = (Item)items.nextElement();
         if (item.isAuthors()) authors.addElement(item);
         if (item.isNames()) names.addElement(item);
         if (item.isReaders()) readers.addElement(item);
         }
         printValues("Authors", authors);
         printValues("Names", names);
         printValues("Readers", readers);
       }
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
 
 void printValues(String name, Vector v) {
   try {
     Enumeration e = v.elements();
     System.out.println(name);
     while (e.hasMoreElements()) {
       Item item = (Item)e.nextElement();
       System.out.println("\t" + item.getName());
       System.out.println("\t\t" + item.getText());
       }
       
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also