次のエージェントは、現在のデータベースの ACL 内の各エントリが持つアクセスレベルを出力します。
import lotus.domino.*;
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();
String lev = null;
ACLEntry entry = acl.getFirstEntry();
do {
switch(entry.getLevel()) {
case ACL.LEVEL_NOACCESS:
lev = "no"; break;
case ACL.LEVEL_DEPOSITOR:
lev = "depositor"; break;
case ACL.LEVEL_READER:
lev = "reader"; break;
case ACL.LEVEL_AUTHOR:
lev = "author"; break;
case ACL.LEVEL_EDITOR:
lev = "editor"; break;
case ACL.LEVEL_DESIGNER:
lev = "designer"; break;
case ACL.LEVEL_MANAGER:
lev = "manager"; break; }
System.out.println
(entry.getName() + " has " + lev + " access"); }
while ((entry = acl.getNextEntry(entry)) != null);
} catch(Exception e) {
e.printStackTrace();
}
}
}