Domino Code Fragment
Code Name* LogAction method | Date* 04/29/2024 | Source (or email address if you prefer)* Rlatulippe@romac.com IP address:.3.144.87.149 | |
Description* This agent logs actions to a mail memo. It performs a full text search on the current database, and logs one action for each document that matches the full text search query. Each time the logAction method is called, it adds a new line to the Body item of the mail memo. For example, if FTSearch returns a collection of three documents, the body of the mail memo looks like this: 10/25/97 12:26:37 PM Botany Agent starting 10/25/97 12:26:42 PM Document Petals placed in folder. 10/25/97 12:26:44 PM Document Stems placed in folder. 10/25/97 12:26:46 PM Document Leaves placed in folder. | Type* Java | Categories* (Misc) |
Implementation: | Required Client: | Server: |
Limitations: | Comments: |
public class logactionagent extends AgentBase
{
public void NotesMain()
{
try
{
Session s = getSession();
Log log = s.createLog("Botany Agent");
Vector v = new Vector();
v.addElement(s.getUserName());
log.openMailLog(v, "Log for botany agent");
AgentContext ac = s.getAgentContext();
Database db = ac.getCurrentDatabase();
DocumentCollection dc = db.FTSearch("botany", 0);
Document doc;
for (int j=0; j<dc.getCount(); j++)
{
doc = dc.getNthDocument(j+1);
doc.putInFolder("Botanist's Delight");
log.logAction("Document " +
doc.getItemValue("Subject") +
" placed in folder.");
}
log.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}