JAVA/CORBA クラス


例:getItemValueDateTimeArray メソッド
次のエージェントは「Times」という日時アイテムの値を取得します。このエージェントは、値のそれぞれの要素が DateTime オブジェクトまたは DateRange オブジェクトのどちらであるかを確認します。

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)
     DocumentCollection dc = agentContext.getUnprocessedDocuments();
     if (dc.getCount() > 0) {
       Document doc = dc.getFirstDocument();
       Vector times = doc.getItemValueDateTimeArray("Times");
       for (int j=0; j<times.size(); j++) {
         Object time = times.elementAt(j);
         if (time.getClass().getName().endsWith("DateTime")) {
           System.out.println("Local time = " +
             ((DateTime)time).getLocalTime());
         }
         else if(time.getClass().getName().endsWith("DateRange")) {
           System.out.println("Local time start and end = ");
           System.out.println("\t" +
             ((DateRange)time).getStartDateTime().getLocalTime());
           System.out.println("\t" +
             ((DateRange)time).getEndDateTime().getLocalTime());
         }
       }
     }

   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

関連項目