Examples: IsPublic property

This agent counts the number of shared and private agents in the current database.

import lotus.domino.*;
import java.util.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = 
          session.getAgentContext();
      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      Vector agents = db.getAgents();
      Enumeration e = db.getAgents().elements();
      int sharedAgents = 0, privateAgents = 0;
      while (e.hasMoreElements()) {
        Agent agent = (Agent)e.nextElement();
        String an = agent.getName();
        if (agent.isPublic())
          sharedAgents++;
        else
          privateAgents++;
        }
      System.out.println(sharedAgents + 
          " agents are shared");
      System.out.println(privateAgents + 
          " agents are private");
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}