Examples: Parent property (View - Java)

This agent compares the title of the current database with the parent of the current view. They should be the same.

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");
      Database pdb = view.getParent();
      if (db.getTitle().equals(pdb.getTitle()))
        System.out.println
        ("Db title and parent db title are the same");
      else
        System.out.println
        ("Db title and parent db title differ - oops");
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}