次のエージェントは、現在の文書の Body アイテム内にある、すべての文書リンクで使用できるプロパティを表示します。
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
DocumentCollection dc = agentContext.getUnprocessedDocuments();
Document doc = dc.getFirstDocument();
RichTextItem body = (RichTextItem)doc.getFirstItem("Body");
RichTextNavigator rtnav = body.createNavigator();
if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) {
String idzero = new String("00000000000000000000000000000000");
do {
RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement();
String server = rtlink.getServerHint();
if (server.length() == 0) server = "Local";
System.out.println("Server = " + server);
System.out.println(
"¥tDatabase replica ID = " + rtlink.getDBReplicaID());
String viewunid = rtlink.getViewUnID();
if (!viewunid.equals(idzero))
System.out.println("¥tView UNID = " + viewunid);
String docunid = rtlink.getDocUnID();
if (!docunid.equals(idzero))
System.out.println("¥tDocument UNID = " + docunid);
} while (rtnav.findNextElement());
}
else
System.out.println("No doclinks in Body");
} catch(Exception e) {
e.printStackTrace();
}
}
}