次のエージェントは、[readers] フィールドに名前を追加します。
import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Agent agent = agentContext.getCurrentAgent();
Database db = agentContext.getCurrentDatabase();
View view = db.getView("By Category");
Vector readers = view.getReaders();
readers.addElement(agent.getComment());
setReaders(readers);
System.out.println("Contents of $Readers:");
for (int i=0; i<readers.size(); i++)
System.out.println("¥t" + readers.elementAt(i));
} catch(Exception e) {
e.printStackTrace();
}
}
}