Examples: AdministrationServer property (ACL - Java)

  1. This agent displays the administration server for the current database.
    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();
          ACL acl = db.getACL();
          if (acl.getAdministrationServer().equals(""))
            System.out.println("No administration server");
          else
            System.out.println("Administration server = " +
              acl.getAdministrationServer());
    
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  2. This view action toggles the administration server for the current database.
    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();
          ACL acl = db.getACL();
          String server = "server1/East/Acme";
          if (acl.getAdministrationServer().equals(""))
            acl.setAdministrationServer(server);
          else
            acl.setAdministrationServer("");
          acl.save();
    
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }