Examples: getFirstEntry and getNextEntry methods (ACL - Java)

This agent looks for an ACL entry that matches the agent comment disregarding case.

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();
      if (agent.getComment().equals("")) {
        System.out.println("Comment not specified"); }
      else {
        Database db = agentContext.getCurrentDatabase();
        ACL acl = db.getACL();
        boolean gotIt = false;
        ACLEntry entry = acl.getFirstEntry();
        do {
          if 
           (entry.getNameObject().getCommon().
            equalsIgnoreCase(agent.getComment())) {
            gotIt = true;
            break; } }
        while ((entry = acl.getNextEntry(entry)) != null);
        if (gotIt)
          System.out.println
          (agent.getComment() + " is in the ACL");
        else
          System.out.println
          (agent.getComment() + " is not in the ACL"); }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}