例: Priority property (Replication - Java™)

次のエージェントは、エージェントのコメントに基づいて複製の優先順位を変更します。

import lotus.domino.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here) 
      Agent agent = agentContext.getCurrentAgent();
      Database db = agentContext.getCurrentDatabase();
      Replication replication = db.getReplicationInfo();
      if (agent.getComment().equals("")) {
        replication.setPriority
         (Replication.CNOTES_REPLCONST_PRIORITYMED);
        System.out.println("Priority is medium"); }
      else if (agent.getComment().equalsIgnoreCase("HIGH")) {
        replication.setPriority
         (Replication.CNOTES_REPLCONST_PRIORITYHIGH);
        System.out.println("Priority is high"); }
      else if (agent.getComment().equalsIgnoreCase("LOW")) {
        replication.setPriority
         (Replication.CNOTES_REPLCONST_PRIORITYLOW);
        System.out.println("Priority is low"); }
      else if (agent.getComment().equalsIgnoreCase("MEDIUM")) {
        replication.setPriority
          (Replication.CNOTES_REPLCONST_PRIORITYMED);
        System.out.println("Priority is medium"); }
            
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}