JAVA/CORBA CLASSES


Examples: FormUsers property
This agent prints the contents of $FormUsers for the form specified as the agent comment, then adds the current user's name.

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)
     Agent agent = agentContext.getCurrentAgent();
     Database db = agentContext.getCurrentDatabase();
     Form form = db.getForm(agent.getComment());
     Vector users = form.getFormUsers();
     if (users.size() != 0) {
       System.out.println
       ("$FormUsers for " + form.getName());
       for (int j=0; j<users.size(); j++)
         System.out.println
         ("  " + users.elementAt(j)); }
     else
       System.out.println
       ("No $FormUsers for " + form.getName());
     users.addElement(session.getUserName());
     form.setFormUsers(users);
     System.out.println
     (session.getUserName() + " added");
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also