JAVA/CORBA CLASSES


Examples: freeTimeSearch method
This application finds the first 60-minute time slot available for three people.

import java.util.*;
import lotus.notes.*;
class free extends NotesThread
{
 public static void main(String argv[])
   {
       free t = new free();
       t.start();
   }
 public void runNotes()
   {
   try
     {
       Session s = Session.newInstance();
       DateRange window = s.createDateRange();
       window.setStartDateTime(s.createDateTime("Today"));
       window.setEndDateTime(s.createDateTime("Tomorrow"));
       Vector names = new Vector(3);
         names.addElement("Roberta Person");
         names.addElement("Kerry Ordway");
         names.addElement("Marybeth May");
       Vector freetime = s.freeTimeSearch
       (window, 60, names, true);
       if (freetime == null) System.out.println("No time
         slots");
       else for (int i=0; i<freetime.size(); i++)
       {
         DateRange dr = (DateRange)freetime.elementAt(i);
         DateTime sdt = dr.getStartDateTime();
         DateTime edt = dr.getEndDateTime();
         System.out.println("Start = " + sdt.getLocalTime());
         System.out.println("  End = " + edt.getLocalTime());
       }  
     }
   catch (Exception e)
     {
       e.printStackTrace();
     }
   }
}

See Also