JAVA/CORBA CLASSES


Examples: getParentEntity method
This agent gets the preamble for the child at the end of the first or only branch of a multipart entity.

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 bottom of first branch
         MIMEEntity child = mime.getNextEntity(MIMEEntity.SEARCH_DEPTH);
         while (child != null) {
           mime = child;
           child = mime.getNextEntity(MIMEEntity.SEARCH_DEPTH);
         }
         mime = mime.getParentEntity();
         if (mime != null) {
           String preamble = mime.getPreamble();
           if (preamble.equals("")) preamble = "No preamble";
           System.out.println("Preamble: " + preamble);
         }
         else System.out.println("No parent");
       }
       else
       {
         System.out.println
           ("Not MIME - " + doc.getItemValueString("Subject"));
       }
       doc = dc.getNextDocument(doc);
     }
     // Restore conversion
     session.setConvertMIME(true);
   
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also