例: getCurrent, gotoFirst, and gotoNext methods

次の例は、ビューの 2 番目のエントリを取得します。

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();
      View view = db.getView("By Category");
      view.setAutoUpdate(false);
      ViewNavigator nav = view.createViewNav();
      ViewEntry entry = null;
      if (nav.gotoFirst())
        if (nav.gotoNext()) {
          entry = nav.getCurrent();
          String t = null;
          if (entry.isCategory()) t = "category";
          else if (entry.isDocument()) t = "document";
          else if (entry.isTotal()) t = "total";
          System.out.println("Entry # 2 is a " + t); }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}