JAVA/CORBA CLASSES


Examples: DateFmt, TimeDateFmt, TimeFmt, and TimeZoneFmt properties
This agent prints the column formatting information associated with dates and times.

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();
     View view = db.getView("All Documents");
     Vector columns = view.getColumns();
     for (int i=0; i<columns.size(); i++) {
       ViewColumn column = (ViewColumn)columns.elementAt(i);
       String tdf = null;
       switch (column.getTimeDateFmt()) {
         case ViewColumn.FMT_DATE : tdf = "Date only"; break;
         case ViewColumn.FMT_DATETIME : tdf = "Date and
           time"; break;
         case ViewColumn.FMT_TIME : tdf = "Time only"; break;
         case ViewColumn.FMT_TODAYTIME : tdf = "Today
           and time"; break; }
       String df = null;
       switch (column.getDateFmt()) {
         case ViewColumn.FMT_MD : df = "MD"; break;
         case ViewColumn.FMT_YM : df = "YM"; break;
         case ViewColumn.FMT_YMD : df = "YMD"; break;
         case ViewColumn.FMT_Y4M : df = "Y4M"; break; }
       String tf = null;
       switch (column.getTimeFmt()) {
         case ViewColumn.FMT_HM : tf = "HM"; break;
         case ViewColumn.FMT_HMS : tf = "HMS"; break;
         default : tf = "not a time format"; }
       String zf = null;
       switch (column.getTimeZoneFmt()) {
         case ViewColumn.FMT_ALWAYS : zf = "always"; break;
        case ViewColumn.FMT_NEVER : zf = "never"; break;
        case ViewColumn.FMT_SOMETIMES : zf = "sometimes"; break;
        default : zf = "not zoned"; }
       System.out.println(column.getPosition() +
       " " + tdf + " " + df + " " + tf + " " + zf); }
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also