Examples: getItemValue method, getItemValueDouble, getItemValueInteger, and getItemValueString
This agent gets text, rich text, numeric integer, numeric double, multi-value text, multi-value numeric, and date-time item values.
import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
DocumentCollection dc = db.getAllDocuments();
Document doc = dc.getFirstDocument();
while (doc != null) {
// Get text item with one value
System.out.println("[ " +
doc.getItemValueString("Subject") + " ]");
// Get rich text item rendered to plain text
System.out.println(doc.getItemValueString("Body"));
// Get numeric item with one integer value
System.out.println(doc.getItemValueInteger("integer"));
// Get numeric item with one decimal value
System.out.println(doc.getItemValueDouble("double"));
// Get text item with multiple values
Vector sM = doc.getItemValue("stringMultiple");
for (int i=0; i<sM.size(); i++)
System.out.println((i+1) + ": " + sM.elementAt(i));
// Get numeric item with multiple integer values
// - must convert from double
Vector iM = doc.getItemValue("integerMultiple");
Double d;
for (int i=0; i<iM.size(); i++) {
d = (Double)iM.elementAt(i);
System.out.println((i+1) + ": " + d.intValue()); }
// Get date-time item
Vector dM = doc.getItemValue("dateTime");
if (dM.size() > 0) {
DateTime dt = (DateTime)dM.elementAt(0);
System.out.println(dt.getLocalTime()); }
doc = dc.getNextDocument(); }
} catch(Exception e) {
e.printStackTrace();
}
}
}