JAVA/CORBA クラス


例:getFirstEntry メソッドと getNextEntry メソッド
次のエージェントは、エージェントのコメントと一致する ACL エントリを、大文字小文字に関係なく検索します。

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();
     if (agent.getComment().equals("")) {
       System.out.println("Comment not specified"); }
     else {
       Database db = agentContext.getCurrentDatabase();
       ACL acl = db.getACL();
       boolean gotIt = false;
       ACLEntry entry = acl.getFirstEntry();
       do {
         if
          (entry.getNameObject().getCommon().
           equalsIgnoreCase(agent.getComment())) {
           gotIt = true;
           break; } }
       while ((entry = acl.getNextEntry(entry)) != null);
       if (gotIt)
         System.out.println
         (agent.getComment() + " is in the ACL");
       else
         System.out.println
         (agent.getComment() + " is not in the ACL"); }
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

関連項目