Examples: Parent property (ACLEntry - Java)

This agent prints the title of every database in the local Notes® directory that contains the ACL entry specified as the agent comment.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = 
          session.getAgentContext();
      // (Your code goes here) 
      Agent agent = agentContext.getCurrentAgent();
      ACL acl;
      ACLEntry entry;
      String n;
      DbDirectory dir = session.getDbDirectory(null);
      Database db = 
          dir.getFirstDatabase(DbDirectory.DATABASE);
      while (db != null) {
        db.open();
        acl = db.getACL();
        if (acl != null) {
          entry = acl.getFirstEntry();
          while (entry != null) {
            n = entry.getNameObject().getCommon();
            if (n.equals(agent.getComment()))
              System.out.println
              (n + " is in the database \"" +
              entry.getParent().getParent().getTitle() + 
                     "\"");
          entry = acl.getNextEntry(entry); }}
      db = dir.getNextDatabase(); }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}