JAVA/CORBA CLASSES
Examples: getLastEntry and getPrevEntry methods
1. This agent gets all the entries in a view entry collection from last to first.
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 entry = vec.getLastEntry();
while (entry != null) {
System.out.println("Entry is at position " +
entry.getPosition('.'));
entry = vec.getPrevEntry(); }
} catch(Exception e) {
e.printStackTrace();
}
}
}
2. This agent gets the next to last and second 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 entryLast = vec.getLastEntry();
ViewEntry entryFirst = vec.getFirstEntry();
System.out.println("Next to last entry is at
position " +
vec.getPrevEntry(entryLast).getPosition('.'));
System.out.println("Second entry is at position " +
vec.getNextEntry(entryFirst).getPosition('.'));
} catch(Exception e) {
e.printStackTrace();
}
}
}
See Also
getLastEntry method
getPrevEntry method
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary