例: getPrevSibling method (MIMEEntity - Java™)

次のエージェントは、最初の分岐の最下位レベルにある MIME エンティティすべてを逆順で取得します。

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here)
      // Do not convert MIME to rich text
      session.setConvertMIME(false);
      DocumentCollection dc = agentContext.getUnprocessedDocuments();
      Document doc = dc.getFirstDocument();
      while (doc != null) {
        MIMEEntity mime = doc.getMIMEEntity();
        if (mime != null) {
          // Drill down to end of first branch
          MIMEEntity child = mime.getFirstChildEntity();
          while (child != null) {
            mime = child;
            child = mime.getFirstChildEntity();
          }
          MIMEEntity sibling = mime.getNextSibling();
          while (sibling != null) {
            mime = sibling;
            sibling = mime.getNextSibling();
          }
          while (mime != null) {
            System.out.println(mime.getContentAsText());
            mime = mime.getPrevSibling();
          }
        }
        else
        {
          System.out.println("Not MIME - " + 
          doc.getItemValueString("Subject"));
        }
        doc = dc.getNextDocument(doc);
      }
      // Restore conversion
      session.setConvertMIME(true);
     
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}