例: ViewEntry class

次のエージェントは、ビュー内の全エントリのプロパティの値を出力します。

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();
      String typeCol = null;
      ViewEntry tmpentry;
      ViewEntry entry = nav.getFirst();
      while (entry != null) {
        if (entry.isCategory()) typeCol = "category";
        else if (entry.isDocument()) typeCol = "document";
        else if (entry.isTotal()) typeCol = "total";
        System.out.println("Entry at position" + 
        entry.getPosition('.') + " is a " + typeCol);
        System.out.println("¥tIndent level: " + 
          entry.getIndentLevel());
        System.out.println
        ("¥tColumn indent level: " + 
          entry.getColumnIndentLevel());
        System.out.println("¥tNote ID: " + entry.getNoteID());
        if (entry.isDocument()) {
          System.out.println
          ("¥tUniversal ID: " + entry.getUniversalID());
          System.out.println
          ("¥tFT search score: " + entry.getFTSearchScore());
          if (entry.isConflict())
            System.out.println("¥tConflict document");
          System.out.println("¥tSubject: ¥"" +
          entry.getDocument().getItemValueString("Subject") +
            "\""); }
        if (entry.getParent() instanceof ViewNavigator)
          System.out.println("¥tParent is ViewNavigator");
        else if (entry.getParent() instanceof 
          ViewEntryCollection)
          System.out.println("¥tParent is 
          ViewEntryCollection");
        else System.out.println("¥tParent is View");
        System.out.println("¥tSibling count: " + 
        entry.getSiblingCount());
        System.out.println("¥tChild count: " + 
        entry.getChildCount());
        System.out.println
        ("¥tDescendant count: " + entry.getDescendantCount());
        if (entry.isValid()) System.out.println("¥tEntry is 
        valid");
        else System.out.println("¥tEntry is deletion stub");
        tmpentry = nav.getNext(); 
      entry.recycle();
      entry = tmpentry;
      }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}