JAVA/CORBA CLASSES


Examples: gotoEntry method
This agent gets Document objects using a full-text search, then gets the associated entries in a view.

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();
     Agent agent = agentContext.getCurrentAgent();
     String searchString = agent.getComment();
     View view = db.getView("By Category");
     view.setAutoUpdate(false);
     ViewNavigator nav = view.createViewNav();
     db.updateFTIndex(true);
     int count = view.FTSearch(searchString, 0);
     if (count == 0)
       System.out.println("Nothing found");
     else {
       System.out.println(count + " found");
       Document doc = view.getFirstDocument();
       ViewEntry entry = null;
       while (doc != null) {
         System.out.println(doc.getItemValueString
         ("Subject"));
         if (nav.gotoEntry(doc)) {
           entry = nav.getCurrent();
           System.out.println("Position in \"By Category\
           " is " +
           entry.getPosition('.')); }
         else
           System.out.println("Not in \"By Category\" view");
         doc = view.getNextDocument(doc); } }
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also