Examples: removeEntry method

This agent removes all entries that are not at the top level.

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");
      int count = 0;
      OutlineEntry tmpentry;
      OutlineEntry entry = outline.getFirst();
      while (entry != null) {
        OutlineEntry thisEntry = entry;
        tmpentry = outline.getNext(entry);
        entry.recycle();
        entry = tmpentry;
        if (thisEntry.getLevel() > 0) {
          System.out.println(thisEntry.getLabel() + " ... is 
            being removed");
          outline.removeEntry(thisEntry);
          count++;
          }
        }
      outline.save();
      System.out.println(count + " outline entries removed");
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}