JAVA/CORBA クラス


例:gotoEntry メソッド
次のエージェントは、全文検索を使用して Document オブジェクトを取得し、次にビュー内でそのオブジェクトに関連するエントリを取得します。

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();
Agent agent = agentContext.getCurrentAgent();
String searchString = agent.getComment();
View view = db.getView("By Category");
ViewNavigator nav = view.createViewNav();
db.updateFTIndex(true);
int count = view.FTSearch(searchString, 0);
if (count == 0)
System.out.println("Nothing found");
else {
System.out.println(count + " found");
Document doc = view.getFirstDocument();
ViewEntry entry = null;
while (doc != null) {
System.out.println(doc.getItemValueString
("Subject"));
if (nav.gotoEntry(doc)) {
entry = nav.getCurrent();
System.out.println("Position in \"By Category\
" is " +
entry.getPosition('.')); }
else
System.out.println("Not in \"By Category\" view");
doc = view.getNextDocument(doc); } }
} catch(Exception e) {
e.printStackTrace();
}
}
}

関連項目