Examples: Query property (Agent - Java)

This agent prints the name and query of every agent in the current database.

import lotus.domino.*;
import java.util.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = 
           session.getAgentContext();
      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      Vector agents = db.getAgents();
      Enumeration e = db.getAgents().elements();
      while (e.hasMoreElements()) {
        Agent agent = (Agent)e.nextElement();
        String an = agent.getName();
        String aq = agent.getQuery();
        if (aq.equals("")) aq = "None";
        System.out.println(an + " - " + aq);
        }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}