JAVA/CORBA CLASSES


Examples: Count property
This agent gets a count of all entries in a view plus counts of all entries in each category.

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");
     view.setAutoUpdate(false);
     
     // Create navigator for entire view and get count
     ViewNavigator nav = view.createViewNav();
     System.out.println("View has " + nav.getCount() + " entries");
     
     // Get each entry that is a category
     ViewEntry entry = nav.getFirst();
     while (entry != null) {
       if (entry.isCategory()) {
         Vector values = entry.getColumnValues();
         // Do not process uncategorized
         if (values.size() > 0) {
           String cat = (String)values.firstElement();
           // Create navigator for category and get count
           ViewNavigator nav2 = view.createViewNavFromCategory(cat);
           System.out.println
           ("\"" + cat + "\" has " + nav2.getCount() + " entries");
         }
       }
       entry = nav.getNext(entry);
     }

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

See Also