例: markAllUnread 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.getAllReadDocuments();
      System.out.println("View has " +
      vec.getCount() + " read entries");     
      view.markAllUnread();
      view.refresh();
      vec = view.getAllReadDocuments();
      System.out.println("View has " +
      vec.getCount() + " read entries after markAllUnread");    


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