Examples: UserType, IsGroup, IsPerson, and IsServer properties

This agent prints the user type of the ACL entry specified in the agent comment, and prints whether the entry is for a person, server, or group.

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();
      Database db = agentContext.getCurrentDatabase();
      ACL acl = db.getACL();
      ACLEntry entry = acl.getEntry(agent.getComment());
      if (entry != null) {
        String ut = null;
        switch (entry.getUserType()) {
          case ACLEntry.TYPE_MIXED_GROUP :
            ut = "mixed group"; break;
          case ACLEntry.TYPE_PERSON :
            ut = "person"; break;
          case ACLEntry.TYPE_PERSON_GROUP :
            ut = "person group"; break;
          case ACLEntry.TYPE_SERVER :
            ut = "server"; break;
          case ACLEntry.TYPE_SERVER_GROUP :
            ut = "server group"; break;
          case ACLEntry.TYPE_UNSPECIFIED :
            ut = "unspecified"; break; }
        System.out.println("User type is " + ut);
        if (entry.isPerson())
          System.out.println("Is a person");
        if (entry.isServer())
          System.out.println("Is a server");
        if (entry.isGroup())
          System.out.println("Is a group"); }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}