Examples: getFirstEntry and getNextEntry methods (ViewEntryCollection
- Java™)
- This example gets all the entries in a view entry collection first
to last.
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");
view.setAutoUpdate(false);
ViewEntryCollection vec = view.getAllEntries();
ViewEntry tmpentry;
ViewEntry entry = vec.getFirstEntry();
while (entry != null) {
System.out.println("Entry is at position " +
entry.getPosition('.'));
tmpentry = vec.getNextEntry();
entry.recycle();
entry = tmpentry;
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
- This example gets the second and next to last entries in a view
entry collection.
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");
view.setAutoUpdate(false);
ViewEntryCollection vec = view.getAllEntries();
ViewEntry entryFirst = vec.getFirstEntry();
ViewEntry entryLast = vec.getLastEntry();
System.out.println("Second entry is at position " +
vec.getNextEntry(entryFirst).getPosition('.'));
System.out.println("Next to last entry is at
position " +
vec.getPrevEntry(entryLast).getPosition('.'));
} catch(Exception e) {
e.printStackTrace();
}
}
}
Have feedback?
Google Analytics is used to store comments and ratings. To provide a comment or rating for a topic, click Accept All Cookies or Allow All in Cookie Preferences in the footer of this page.