JAVA/CORBA CLASSES


Examples: ParentView property
This agent demonstrates a function that gets the parent view given a Document object.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
 public void NotesMain() {
   try {
     Session session = getSession();
     AgentContext agentContext = session.getAgentContext();
     // (Your code goes here)
     Database db = agentContext.getCurrentDatabase();
     View view = db.getView("By Category");
     Document doc = view.getFirstDocument();
     DocumentCollection dc = db.getAllDocuments();
     Document doc2 = dc.getFirstDocument();
     printViewName(doc);
     printViewName(doc2);
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
 
 public void printViewName(Document d) {
   
   try {
     View view = d.getParentView();
     if (view == null)
       System.out.println(
               "Document did not come from a view.");
     else
       System.out.println("Document came from \"" +
                view.getName() + "\" view.");
   } catch(Exception e) {
     e.printStackTrace();
   }
   
 }
}

See Also