次の例は、すべての最上位レベルエントリを最後から最初の順に取得します。
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.gotoLast()) {
do { entry = nav.getCurrent(); }
while (nav.gotoParent());
int n = 0;
boolean first = true;
do {
if (first) first = false;
else entry = nav.getCurrent();
System.out.println("Last category minus " + n + "
has " +
entry.getDescendantCount() + " descendants");
n++; }
while (nav.gotoPrevSibling()); }
} catch(Exception e) {
e.printStackTrace();
}
}
}