例: getChild and getNextSibling methods

次のエージェントは、キー「Internet」でソートされた列の最初の文書を取得して、そのすべての返答文書を第 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");
      Document doc = view.getDocumentByKey("Internet");
      System.out.println
      ("Project name: " + doc.getItemValueString("Subject"));
      Document tmpresponse;
      Document tmprtor;
      Document response = view.getChild(doc);
      Document rtor;
      while (response != null) {
        System.out.println
        ("¥t" + response.getItemValueString("Subject"));
        rtor = view.getChild(response);
        while (rtor != null) {
          System.out.println
          ("¥t¥t" + rtor.getItemValueString("Subject"));
          tmprtor = view.getNextSibling(rtor); 
          rtor.recycle();
          rtor = tmprtor;
        }
        tmpresponse = view.getNextSibling(response); 
        response.recycle();
        response = tmpresponse;
      }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}