JAVA/CORBA CLASSES
Examples: Working with view entries and navigators
1. This agent gets all the entries in a view of type category.
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();
System.out.println("Categories:");
ViewEntry entry = nav.getFirst();
while (entry != null) {
if (entry.isCategory())
System.out.println
("\tPosition " + entry.getPosition('.') +
" has " + entry.getDescendantCount() +
" descendants");
entry = nav.getNext(); }
} catch(Exception e) {
e.printStackTrace();
}
}
}
2. This agent gets all the entries in a view of type document.
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("Documents:");
ViewEntry entry = vec.getFirstEntry();
while (entry != null) {
System.out.println
("\tPosition " + entry.getPosition('.') + "\t" +
entry.getDocument().getItemValueString("Subject"));
entry = vec.getNextEntry(); }
} catch(Exception e) {
e.printStackTrace();
}
}
}
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary