例: getUserPolicySettings method

次のエージェントは、/Acme のセットアップポリシー文書を取得し、アイテムの一部を表示します。

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here) 
      Document doc = session.getUserPolicySettings(
        "Server1/Acme", "/Acme",
        Session.POLICYSETTINGS_SETUP);
      System.out.println("LocAllCatalogServer = " +
        getName(doc.getItemValueString("LocAllCatalogServer")));
      System.out.println("LocAllDirectoryServer= " +
        getName(doc.getItemValueString("LocAllDirectoryServer")));
      System.out.println("LocAllSametimeServer = " +
        getName(doc.getItemValueString("LocAllSametimeServer ")));

    } catch(Exception e) {
      e.printStackTrace();
    }
  }
  
  String getName(String n) {
    if (n == null || n == "" || n.length() == 0) n = "<None>";
    return n;
  }
}