例: IsNewNote property

次のエージェントは、新規作成文書を保存する前と保存した後の IsNewNote の機能を示します。

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();
      Document doc = db.createDocument();
      doc.appendItemValue("Form", "Main Topic");
      doc.appendItemValue("Subject", "New document 1");
      doc.appendItemValue("Categories", "New documents");
      isitnew(doc);
      System.out.println("... saving ...");
      doc.save();
      isitnew(doc);
  
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
  
  public void isitnew(Document doc) {
    try {
      if (doc.isNewNote())
        System.out.println("¥"" +
        doc.getItemValueString("Subject") +
        "¥" has not been saved yet");
      else
        System.out.println("¥"" +
        doc.getItemValueString("Subject") +
        "¥" has been saved");
    } catch(Exception e) {
      e.printStackTrace();
    }
    }
}