次のエージェントは、ビュー内の「Category 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("Category 2");
ViewNavigator nav = view.createViewNavFrom(doc);
int n = 0;
String t = null;
ViewEntry tmpentry;
ViewEntry entry = nav.getFirst();
while (entry != null) {
n++;
if (entry.isCategory()) t = "category";
else if (entry.isDocument()) t = "document";
else if (entry.isTotal()) t = "total";
System.out.println("Entry #" + n + " is a " + t);
tmpentry = nav.getNext();
entry.recycle();
entry = tmpentry;
}
} catch(Exception e) {
e.printStackTrace();
}
}
}