次のエージェントは、新しく作成された文書に既存文書の全アイテムをコピーします。
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();
DocumentCollection dc = db.search("Subject =
¥"Test appendItemValue¥"");
if (dc.getCount() == 1) {
Document doc = dc.getFirstDocument();
Document docCopy = db.createDocument();
doc.copyAllItems(docCopy, false);
docCopy.replaceItemValue("Subject",
"Copy of test appendItemValue");
if (docCopy.save())
System.out.println("Document saved");
else
System.out.println("Something went wrong"); }
} catch(Exception e) {
e.printStackTrace();
}
}
}