例: IsPublic property

次のスクリプトは、現在のデータベースの共有エージェントと個人エージェントの個数を計算します。

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();
    }
  }
}