JAVA/CORBA CLASSES
Examples: getLast and getPrev methods
1. This agent gets all the entries in a view 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");
ViewNavigator nav = view.createViewNav();
int n = 0;
String t = null;
ViewEntry entry = nav.getLast();
while (entry != null) {
if (entry.isCategory()) t = "category";
else if (entry.isDocument()) t = "document";
else if (entry.isTotal()) t = "total";
System.out.println("Last entry minus " + n + " is
a " + t);
n++;
entry = nav.getPrev(); }
} catch(Exception e) {
e.printStackTrace();
}
}
}
2. This agent gets the next to the last entry 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();
View view = db.getView("By Category");
ViewNavigator nav = view.createViewNav();
ViewEntry entry = nav.getPrev(nav.getLast());
if (entry != null) {
String t = null;
if (entry.isCategory()) t = "category";
else if (entry.isDocument()) t = "document";
else if (entry.isTotal()) t = "total";
System.out.println("Next to the last entry is a "
+ t); }
} catch(Exception e) {
e.printStackTrace();
}
}
}
See Also
getLast method
getPrev method
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary