例: ビューやフォルダのプロパティにアクセスする (Java™)

次のエージェントは、現在のデータベースにあるすべてのビューとフォルダのプロパティを取得します。

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();
      Vector views = db.getViews();
      for (int i=0; i<views.size(); i++) {
        View view = (View)views.elementAt(i);
        System.out.println
        (view.getName() + " with " +
        view.getColumnCount() + " columns in ¥"" +
        view.getParent().getTitle() + "¥"");
        ViewEntryCollection entries = 
            view.getAllEntries();
        System.out.println
        ("¥tNumber of document entries = " + 
            entries.getCount());
        Vector columnNames = view.getColumnNames();
        Vector columns = view.getColumns();
        for (int j=0; j<columns.size(); j++) {
          String columnName = 
          ((String)columnNames.elementAt(j)).trim();
          if (columnName.length() == 0) columnName = 
                "No Name";
          ViewColumn column = 
                (ViewColumn)columns.elementAt(j);
          System.out.println
          ("¥t[" + columnName + "] has width of " + 
                 column.getWidth()); }
        Vector aliases = view.getAliases();
        for (int j=0; j<aliases.size(); j++)
          System.out.println
          ("¥tAlias ¥"" + aliases.elementAt(j) + "¥"");
        System.out.println
        ("¥tUniversal ID: " + view.getUniversalID());
        System.out.println
        ("¥tCreated: " + view.getCreated());
        System.out.println
        ("¥tLast modified: " + view.getLastModified());
        System.out.println
        ("¥tDefault view? " + view.isDefaultView());
        System.out.println
        ("¥tAuto update? " + view.isAutoUpdate());
        System.out.println
        ("¥tFolder? " + view.isFolder());
        System.out.println
        ("¥tCalendar? " + view.isCalendar());
        System.out.println
        ("¥tConflict? " + view.isConflict());
        System.out.println
        ("¥tModified? " + view.isModified());
        System.out.println
        ("¥tProtect readers? " + view.isProtectReaders());
        System.out.println
        ("¥tCategorized? " + view.isCategorized());
        System.out.println
        ("¥tHierarchical? " + view.isHierarchical());
        Vector readers = view.getReaders();
        for (int j=0; j<readers.size(); j++)
          System.out.println
          ("¥tReader ¥"" + readers.elementAt(j) + "¥"");
        switch (view.getBackgroundColor()) {
          case RichTextStyle.COLOR_BLACK :
          System.out.println(
             "¥tBackground color is black"); break;
          case RichTextStyle.COLOR_WHITE :
          System.out.println(
             "¥tBackground color is white"); break;
          default :
          System.out.println(
             "¥tBackground color not black or white"); }
        System.out.println
        ("¥tHeaderLines = " + view.getHeaderLines());
        System.out.println
        ("¥tRowLines = " + view.getRowLines());
        String spacing = null;
        switch (view.getSpacing()) {
          case View.SPACING_DOUBLE : spacing = 
               "double"; break;
          case View.SPACING_ONE_POINT_25 : spacing = 
               "1.25"; break;
          case View.SPACING_ONE_POINT_50 : spacing = 
               "1.5"; break;
          case View.SPACING_ONE_POINT_75 : spacing = 
               "1.75"; break;
          case View.SPACING_SINGLE : spacing = 
               "single"; break;
          default : spacing = "unknown";
          }
        System.out.println
        ("¥tSpacing = " + spacing);
        System.out.println
        ("¥tTopLevelEntryCount = " + 
              view.getTopLevelEntryCount()); }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}