JAVA/CORBA CLASSES
Examples: IsAutoUpdate property
1. This agent displays the entry count of an uncategorized view before and after creating a document that appears in the view. The count is incremented because the view is automatically refreshed by navigation over the new 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("All");
System.out.println("Entries = " + view.getTopLevelEntryCount());
Document doc = db.createDocument();
doc.appendItemValue("Form", "Main Topic");
doc.appendItemValue("Subject", "New document");
doc.save();
view.setAutoUpdate(true); /* not necessary except for IIOP */
doc = view.getFirstDocument();
while(doc != null) {
doc = view.getNextDocument(doc);
}
/* Entry count is incremented because the view was auto refreshed */
System.out.println("Entries = " + view.getTopLevelEntryCount());
} catch(Exception e) {
e.printStackTrace();
}
}
}
2. This agent displays the entry count of an uncategorized view before and after creating a document that appears in the view. The count is the same because the view is not automatically refreshed.
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("All");
System.out.println("Entries = " + view.getTopLevelEntryCount());
Document doc = db.createDocument();
doc.appendItemValue("Form", "Main Topic");
doc.appendItemValue("Subject", "New document");
doc.save();
view.setAutoUpdate(false); /* default for IIOP */
doc = view.getFirstDocument();
while(doc != null) {
doc = view.getNextDocument(doc);
}
/* Entry count is incremented because the view was auto refreshed */
System.out.println("Entries = " + view.getTopLevelEntryCount());
} catch(Exception e) {
e.printStackTrace();
}
}
}
3. This agent turns off automatic updating 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");
// Turn off auto-update before proceeding
view.setAutoUpdate(false);
System.out.println
("Auto-update is " + view.isAutoUpdate());
// Work in view
// ...
} catch(Exception e) {
e.printStackTrace();
}
}
}
Véase también
IsAutoUpdate property
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