JAVA/CORBA CLASSES


Examples: HasChildren property
This agent gets all the entries in an outline. It separates the children by dropping levels through a recursive function.

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();
     Outline outline = db.getOutline("DiscOutline");
     System.out.println("*** " + outline.getName() + " ***");
     OutlineEntry entry = outline.getFirst();
     while (entry != null) {
       System.out.println(entry.getLabel());
       if (entry.hasChildren()) printChild(outline, entry);
       entry = outline.getNextSibling(entry);
       }
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
 void printChild(Outline outline, OutlineEntry entry) {
   try {
     entry = outline.getNext(entry);
     String tabs = "";
     for (int i=0; i<entry.getLevel(); i++)
       tabs = tabs + "\t";
     while (entry != null) {
       System.out.println(tabs + entry.getLabel());
       if (entry.hasChildren()) printChild(outline, entry);
       entry = outline.getNextSibling(entry);
       }
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also