例: markAllRead method (View - Java™)

次のエージェントは、すべてを既読にする前後に、ビュー内の未読文書の数を表示します。

import lotus.domino.*;

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("All");
      ViewEntryCollection vec = view.getAllUnreadDocuments();
      System.out.println("View has " +
      vec.getCount() + " unread entries");     
      view.markAllRead();
      view.refresh();
      vec = view.getAllUnreadDocuments();
      System.out.println("View has " +
      vec.getCount() + " unread entries after markAllRead");    


    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}