次のエージェントは、ビューから階層の 3 レベル下までのエントリをすべて取得します。
import lotus.domino.*;
public class JavaAgent extends AgentBase {
String getEntryType(ViewEntry entry) {
String t = null;
try {
if (entry.isCategory()) t = "category";
else if (entry.isDocument()) t = "document";
else if (entry.isTotal()) t = "total"; }
catch (Exception e) {
e.printStackTrace(); }
return t; }
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();
int n = 0;
if (nav.gotoFirst()) do {
// Print 1st-level entries flush left
n++;
System.out.println("Entry # " + n + " is a " +
getEntryType(nav.getCurrent()));
if (nav.gotoChild()) { do {
// Print 2nd-level entries one tab in
n++;
System.out.println("¥tEntry # " + n + " is a " +
getEntryType(nav.getCurrent()));
} while (nav.gotoNextSibling());
if (nav.gotoChild()) { do {
// Print 3rd-level entries two tabs in
n++;
System.out.println("¥t¥tEntry # " + n + " is a " +
getEntryType(nav.getCurrent()));
} while (nav.gotoNextSibling());
nav.gotoParent(); }
nav.gotoParent(); }
} while (nav.gotoNextSibling());
} catch(Exception e) {
e.printStackTrace();
}
}
}