JAVA/CORBA CLASSES


Examples: deleteEntry method
This agent deletes all the entries from a view entry collection that represent response documents. The agent takes care to get the next entry before deleting the current entry.

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.getAllEntries();
     System.out.println("All documents count = " + vec.getCount());
     ViewEntry entry = vec.getFirstEntry();
     while (entry != null) {
       ViewEntry thisEntry = entry;
       entry = vec.getNextEntry();
       if (thisEntry.getDocument().isResponse())
         vec.deleteEntry(thisEntry);
     }
     System.out.println("All main documents count = " + vec.getCount());
     entry = vec.getFirstEntry();
     while (entry != null) {
       System.out.println(entry.getDocument().getItemValueString("Subject"));
       entry = vec.getNextEntry();
     }
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also