次のエージェントは、メモリ内文書の [Subject] フィールドの値を出力します。
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Document doc = agentContext.getDocumentContext();
System.out.println
(doc.getItemValueString("Subject"));/
} catch(Exception e) {
e.printStackTrace();
}
}
}
import lotus.domino.*;
import java.io.PrintWriter;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Document doc = agentContext.getDocumentContext();
PrintWriter pw = getAgentOutput();
pw.println("<H2>" + doc.getItemValueString("Subject") +
"</H2>");
} catch(Exception e) {
e.printStackTrace();
}
}
}
import lotus.domino.*;
import java.io.PrintWriter;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Document doc = agentContext.getDocumentContext();
System.out.println(doc.getItemValueString("Remote_Addr"));
PrintWriter pw = getAgentOutput();
pw.println("<H2>IP address is " +
doc.getItemValueString("Remote_Addr") + "</H2>");
} catch(Exception e) {
e.printStackTrace();
}
}
}
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Document doc = agentContext.getDocumentContext();
Database db = agentContext.getCurrentDatabase();
Document profile =
db.getProfileDocument("(AccessCounterProfile)", null);
String numStr =
profile.getItemValueString("Access_counter");
String numStr2;
if (numStr.equals(" ") || numStr.equals("")) {
numStr2 = new String("1");
}
else {
Integer numInt = new Integer(numStr);
int num = numInt.intValue() + 1;
Integer numInt2 = new Integer(num);
numStr2 = new String(numInt2.toString());
}
profile.replaceItemValue("Access_counter", numStr2);
profile.save(false, false);
doc.replaceItemValue("Access_counter", numStr2);
} catch(Exception e) {
e.printStackTrace();
}
}
}