.
HCLSoftware Business Partner
Domino Consulting Services
CRUCIAL Notes Tools
+1
212-599-2048
Domino Consulting Services
CRUCIAL Notes Tools
Domino administration
Notes development
Chat now
.
EN - English
CN - 中文
JP - 日本語
DE - Deutsch
FR - Français
BR - Português
RU - Pу́сский
IT - Italiano
IN - हिन्दी
ES - Español
KR - 한국어
ID - Indonesia
NL - Dutch
TR - Türkçe
SA - العربية
SE - Svenska
NO - Norsk
PL - Polski
TH - ไทย
DK - Dansk
MY - Malay
PH - Filipino
GR - Ελληνικά
FI - Suomi
IL - עברית
IE - Gaeilge
CZ - Čeština
UA - Українська
RO - Română
VN - Tiếng Việt
BD - বাংলা
HU - Magyar
Need a Domino Consultant? Call NotesMail +1 212-599-2048
-
HCLSoftware Business Partner
JAVA/CORBA CLASSES
Examples: refresh method
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 the same because the view is not refreshed after creating the 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();
/* Entry count is the same because the view is not 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 incremented because the view is refreshed after creating the 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.refresh();
/* Entry count is incremented because the view is refreshed */
System.out.println("Entries = " + view.getTopLevelEntryCount());
} catch(Exception e) {
e.printStackTrace();
}
}
}
3. This agent refreshes the view before retrieving a document from it if the view was modified.
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();
// Open view and sleep for 10 seconds
View view = db.getView("By Category");
sleep(10000);
// Meanwhile someone else may have modified the view
view.refresh();
// Do your work
Document getdoc = view.getDocumentByKey("Latest news");
if (getdoc == null)
System.out.println("getdoc is null");
else
System.out.println(getdoc.getItemValueString("Subject"));
} catch(Exception e) {
e.printStackTrace();
}
}
}
See Also
refresh method
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Feedback on
Help
or
Usability
?
Help on Help
All Help Contents