Examples: DisplayComment property

This agent displays the comment for every doclink in the Body item of the current document.

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)) {
        do {
          RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement();
          String comment = rtlink.getDisplayComment();
          if (comment.length() > 0)
            System.out.println(rtlink.getDisplayComment());
          else
            System.out.println("No display comment");
        } while (rtnav.findNextElement()); 
      }
      else
        System.out.println("No doclinks in Body");

    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}