JAVA/CORBA クラス


例:HasChildren プロパティ
次のエージェントは、アウトライン内のエントリをすべて取得します。子エントリは、再帰関数を使用してレベルを下げて区別します。

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();
Outline outline = db.getOutline("DiscOutline");
System.out.println("*** " + outline.getName() + " ***");
OutlineEntry entry = outline.getFirst();
while (entry != null) {
System.out.println(entry.getLabel());
if (entry.hasChildren()) printChild(outline, entry);
entry = outline.getNextSibling(entry);
}
} catch(Exception e) {
e.printStackTrace();
}
}
void printChild(Outline outline, OutlineEntry entry) {
try {
entry = outline.getNext(entry);
String tabs = "";
for (int i=0; i<entry.getLevel(); i++)
tabs = tabs + "\t";
while (entry != null) {
System.out.println(tabs + entry.getLabel());
if (entry.hasChildren()) printChild(outline, entry);
entry = outline.getNextSibling(entry);
}
} catch(Exception e) {
e.printStackTrace();
}
}
}

関連項目