例: makeResponse method

次のエージェントは、新規作成文書を既存文書の返答文書にします。

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 rdoc = db.createDocument();
        rdoc.appendItemValue("Form", "Response");
        rdoc.appendItemValue("Subject", 
                 "Response to Test appendItemValue");
        rdoc.makeResponse(doc);
        if (rdoc.save())
          System.out.println("Document saved");
        else
          System.out.println("Something went wrong"); }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}