Examples: Authors and IsResponse properties
This agent counts the number of response douments of which the current user is an author.
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)
Database db = session.getDatabase(
"FrenchFry", "notesua\\progwork");
DocumentCollection dc = db.getAllDocuments();
Vector authors;
int count = 0;
Document doc = dc.getFirstDocument();
while (doc != null) {
if (!doc.isResponse()) {
authors = doc.getAuthors();
if (authors.contains(session.getUserName()))
count++; }
doc = dc.getNextDocument(doc); }
System.out.println(session.getUserName() +
" is author on " +
count + " main documents");
} catch(Exception e) {
e.printStackTrace();
}
}
}