例: IsValid 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 = session.getDatabase(
                     "NotesUA1", "dbexamples");
      DocumentCollection dc = db.getAllDocuments();
      // For testing, open db on another computer and delete a
      // document while this program is sleeping
      sleep(12000);
      Document doc = dc.getFirstDocument();
      while (doc != null) {
        if (doc.isValid())
          System.out.print(
                doc.getItemValueString("Subject"));
        else
          System.out.println("[Deletion stub]");
        doc = dc.getNextDocument(doc); }
  
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}