Examples: openIfModified method

This agent opens the local names.nsf only if it was modified in the past day.

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here) 
      DateTime dt = session.createDateTime("Today");
      dt.setNow();
      dt.adjustHour(-1);
      Database db = session.getDatabase("", "");
      if (db.openIfModified(null, "names", dt))
        System.out.println("Names.nsf opened");
      else
        System.out.println("Names.nsf not opened");

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