Examples: IsValid property

This agent checks on whether a document on a server is still valid.

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();
    }
  }
}