例: addEntry method

次のエージェントは、ビューエントリコレクションに 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();
      db.updateFTIndex(true);
      View view = db.getView("By Category");
      view.setAutoUpdate(false);
      ViewEntryCollection vec = view.getAllEntries();
      ViewEntry entry = null;
      Document doc = db.createDocument();
      doc.appendItemValue("Subject", "New subject");
      doc.save(true, true);
      vec.addEntry(doc);
      ViewEntry tmpentry;
      entry = vec.getFirstEntry();
      while (entry != null) {
        System.out.println(entry.getDocument().getItemValueString
        ("Subject
        tmpentry = vec.getNextEntry();
        entry.recycle();
        entry = tmpentry;
      }
   } catch(NotesException e) {
      System.out.println(e.id + " " + e.text);
      e.printStackTrace();
    }
  }
}