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();
DocumentCollection dc = db.getAllDocuments();
Document doc = dc.getFirstDocument();
while (doc != null) {
if (doc.isResponse()) {
Document pdoc =
db.getDocumentByUNID(doc.getParentDocumentUNID());
String docSubj = doc.getItemValueString("Subject");
String pdocSubj = pdoc.getItemValueString("Subject");
System.out.println("¥"" + pdocSubj +
"¥" has the response ¥"" + docSubj + "¥"");
}
doc = dc.getNextDocument(doc);
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
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();
DocumentCollection dc = db.getAllDocuments();
Document doc = dc.getFirstDocument();
while (doc != null) {
if (doc.isResponse()) {
String docSubj = "";
try {
docSubj = doc.getItemValueString("Subject");
// Deliberately munge UNID
String badUNID = "Z" +
doc.getParentDocumentUNID().substring(1);
Document pdoc = db.getDocumentByUNID(badUNID);
String pdocSubj = pdoc.getItemValueString("Subject");
System.out.println("¥"" + pdocSubj +
"¥" has the response ¥"" + docSubj + "¥"");
} catch(NotesException ne) {
if (ne.id == NotesError.NOTES_ERR_BAD_UNID)
System.out.println("Bad UNID for ¥"" + docSubj + "¥"");
else throw ne;
}
}
doc = dc.getNextDocument(doc);
}
} catch(NotesException ne) {
System.out.println(ne.id + " " + ne.text);
} catch(Exception e) {
e.printStackTrace();
}
}
}