Domino Code Fragment
Code Name* Accessing Notes agents | Date* 04/19/2000 | Source (or email address if you prefer)* Rlatulippe@romac.com IP address:. | |
Description* This example sends a memo to the managers of the current database containing the name and comment of each agent in the database. | Type* Java | Categories* Design Configuration, (Misc) |
Implementation: | Required Client: | Server: |
Limitations: | Comments: |
public class accessing1agent extends AgentBase
{
public void NotesMain()
{
try
{
Session s = getSession();
AgentContext ac = s.getAgentContext();
Database db = ac.getCurrentDatabase();
Document doc = db.createDocument();
RichTextItem rti = doc.createRichTextItem("Body");
Vector agents = db.getAgents();
for (int i = 0; i < agents.size(); i++)
{
Agent agent = (Agent) agents.elementAt(i);
if (agent.isPublic() & agent.isEnabled())
{
rti.appendText(agent.getName());
rti.addTab(2);
rti.appendText(agent.getComment());
rti.addNewLine(1);
}
}
doc.appendItemValue("Subject",
"Public agent summary for " + db.getTitle());
doc.send(false, db.getManagers());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}