例: remove method (RichTextSection - Java™)

次のエージェントは、リッチテキストアイテム内のすべてのセクションを削除します。

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_SECTION)) {
        do {
          RichTextSection rtsection = (RichTextSection)rtnav.getElement();
          rtsection.remove();
        } while (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_SECTION));
        doc.save(true, true);
      }
      else
        System.out.println("Body does not contain any sections");

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