Examples: getAllEntriesByKey method

  1. This example gets all document entries in the category "Spanish leather" in the By Category view of the current database.
    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();
          View view = db.getView("By Category");
          ViewEntryCollection vec =
          view.getAllEntriesByKey("Spanish leather", false);
          System.out.println("Number of entries found = " + 
            vec.getCount());
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  2. This example gets all document entries in the category "Boots" and the subcategory "Spanish leather" in the By Category view of the current database.
    import lotus.domino.*;
    import java.util.Vector;
    public class JavaAgent extends AgentBase {
      public void NotesMain() {
        try {
          Session session = getSession();
          AgentContext agentContext = 
            session.getAgentContext();
          // (Your code goes here) 
          Database db = agentContext.getCurrentDatabase();
          View view = db.getView("By Category");
          Vector v = new Vector();
          v.addElement("Boots");
          v.addElement("Spanish leather");
          ViewEntryCollection vec =
          view.getAllEntriesByKey(v, false);
          System.out.println("Number of entries = " + 
            vec.getCount());
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }