JAVA/CORBA CLASSES


Examples: updateFTIndex method
This agent updates the full-text index of the current database if the index has not been updated in the last two days.

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();
     String title = db.getTitle();
     DateTime lastDT = db.getLastFTIndexed();
     DateTime nowDT = session.createDateTime("Today");
     nowDT.setNow();
     int daysSince =
         nowDT.timeDifference(lastDT) / 86400;
     if (daysSince > 2) {
       System.out.println("Database \"" + title +
               "\" was last full-text indexed " +
                daysSince + " days ago");
       System.out.println("Updating");
       db.updateFTIndex(true); }
     else
       System.out.println("Database \"" + title +
            "\" was full-text indexed less
             than two days ago");
       
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also