例: getPos and gotoPos methods

次のエージェントは、ビューにある各最上位レベルエントリの最初の子エントリを取得します。

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;
      String t = null;
      String ns = null;
      int n = 1;
      // Goto top-level entry
      while (nav.gotoPos(ns.valueOf(n), '.')) {
        // Get first child entry
        entry = nav.getPos(ns.valueOf(n) + ".1", '.');
        if (entry != null) {
          if (entry.isCategory()) t = "category";
          else if (entry.isDocument()) t = "document";
          else if (entry.isTotal()) t = "total";
          System.out.println("Entry #" + n + ".1 is a " + t); }
        n++; } 
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}