例: IsCategory property

次のエージェントは、ビュー内の分類された列の数を表示します。

import lotus.domino.*;
import java.util.Vector;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

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

      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      View view = db.getView("By category");
      Vector vcs = view.getColumns();
      int counter = 0;
      for (int i=0; i<vcs.size(); i++) {
        ViewColumn vc = (ViewColumn)vcs.elementAt(i);
        if (vc.isCategory()) counter++;
      }
      if (counter == 0)
        System.out.println("View contains no categorized views");
      else if (counter == 1)
        System.out.println("View contains 1 categorized view");
      else
        System.out.println("View contains " + counter +
          " categorized views");
        
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}