Examples: IsAutoUpdate property
- 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 tmpdoc; 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) { tmpdoc = view.getNextDocument(doc); doc.recycle(); doc = tmpdoc; } /* Entry count is incremented because the view was auto refreshed */ System.out.println("Entries = " + view.getTopLevelEntryCount()); } catch(Exception e) { e.printStackTrace(); } } }
- 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 tmpdoc; 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) { tmpdoc = view.getNextDocument(doc); doc.recycle(); doc = tmpdoc; } /* Entry count is incremented because the view was auto refreshed */ System.out.println("Entries = " + view.getTopLevelEntryCount()); } catch(Exception e) { e.printStackTrace(); } } }
- 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(); } } }