Examples: Query property (DocumentCollection - Java)

This agent demonstrates a formula that gets the query for a document collection.

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();
      DocumentCollection dc = db.getAllDocuments();
      printquery(dc);
      dc.FTSearch("blue");
      printquery(dc);
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
  public void printquery(DocumentCollection d) {
    try {
      System.out.println("Search query:");
      if (d.getQuery().length() != 0)
        System.out.println("\t[ " + d.getQuery() + " ]");
      else
        System.out.println("\tNo search query");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}