JAVA/CORBA CLASSES


Examples: EmbeddedObjects and HasEmbedded properties
This agent finds documents with embedded objects and prints the names of those objects.

import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
 public void NotesMain() {
   try {
     Session session = getSession();
     AgentContext agentContext = session.getAgentContext();
     // (Your code goes here)
     Database db = agentContext.getCurrentDatabase();
     DocumentCollection dc = db.getAllDocuments();
     Vector v = null;
     Document doc = dc.getFirstDocument();
     while (doc != null) {
       if (doc.hasEmbedded()) {
         System.out.println("\"" +
         doc.getItemValueString("Subject") +
         "\" has embedded objects.");
         v = doc.getEmbeddedObjects();
         if (v.isEmpty())
           System.out.println(
                 "\tEmbedded object is an attachment.");
         else for (int i=0; i<v.size(); i++) {
           EmbeddedObject eo = (EmbeddedObject)v.elementAt(i);
           System.out.println
           ("\t" + eo.getName() + " of " + eo.getClassName());
           }
         }
       doc = dc.getNextDocument(doc); }
 
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also