JAVA/CORBA CLASSES


Examples: getFieldType method
This agent displays the types of all the fields in the "form1" form.

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();
     Form form1 = db.getForm("form1");
     Vector fields = form1.getFields();
     for (int i=0; i<fields.size(); i++) {
       String field = (String)(fields.elementAt(i));
       String type;
       switch (form1.getFieldType(field)) {
         case Item.AUTHORS : type = "Authors"; break;
         case Item.DATETIMES : type = "Date-time"; break;
         case Item.NAMES : type = "Names"; break;
         case Item.NUMBERS : type = "Number"; break;
         case Item.RICHTEXT : type = "Rich text"; break;
         case Item.READERS : type = "Readers"; break;
         case Item.SIGNATURE : type = "Signature"; break;
         case Item.TEXT : type = "Text or text list"; break;
         default : type = "Other";
       }
       System.out.println(field + " (" + type + ")");
     }

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

See Also