Examples: FTIndexFrequency property (Database - Java)

This agent cycles the update frequency for a database with a full-text index.

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();
      if (db.isFTIndexed())
      {
        if (db.getFTIndexFrequency() == Database.FTINDEX_DAILY)
        {
          db.setFTIndexFrequency(Database.FTINDEX_HOURLY);
          System.out.println("Index frequency set to hourly");
        }
        else if (db.getFTIndexFrequency() == Database.FTINDEX_HOURLY)
        {
          db.setFTIndexFrequency(Database.FTINDEX_IMMEDIATE);
          System.out.println("Index frequency set to immediate");
        }
        else if (db.getFTIndexFrequency() == Database.FTINDEX_IMMEDIATE)
        {
          db.setFTIndexFrequency(Database.FTINDEX_SCHEDULED);
          System.out.println("Index frequency set to scheduled");
        }
        else
        {
          db.setFTIndexFrequency(Database.FTINDEX_DAILY);
          System.out.println("Index frequency set to daily");
        }
      }
      else
      {
        System.out.println("Database not full-text indexed");
      }

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