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();
}
}
}
Glosario
¿Desea opinar sobre la Ayuda?
Ayuda sobre la Ayuda
Abrir la Ayuda en pantalla completa
Glosario
¿Desea opinar sobre la Ayuda?
Ayuda sobre la Ayuda
Abrir la Ayuda en pantalla completa