JAVA/CORBA CLASSES


Examples: renameRole method
This agent appends "Role" to the name of each role. For example, [Supervisor] becomes [SupervisorRole]. The code takes into account the brackets returned by the Roles property.

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();
     ACL acl = db.getACL();
     Vector roles = acl.getRoles();
     String role;
     for (int i=0; i<roles.size(); i++) {
       role = (String)roles.elementAt(i);
       role = role.substring(1, role.length()-1);
       acl.renameRole((String)roles.elementAt(i),
       "[" + role + "Role]"); }
     acl.save();
   } catch(Exception e) {
     e.printStackTrace();
   }
 }
}

See Also