Examples: Parent property (DocumentCollection - Java)

This agent demonstrates a function that gets the parent database of a document collection.

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();
      DocumentCollection dc = db.getAllDocuments();
      parentdb(dc);
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
  public void parentdb(DocumentCollection d) {
    try {
      Database db = d.getParent();
      System.out.println("Parent database is \"" +
      db.getTitle() + "\" (" + db.getFileName() + ")");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}