次のエージェントは、現在のデータベースの最大のインターネットレベルを出力します。
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;
int ilev = acl.getInternetLevel();
if (ilev < ACL.LEVEL_DESIGNER)
acl.setInternetLevel(ilev + 1);
acl.save();
switch(acl.getInternetLevel()) {
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(
"Maximum internet access is " + lev + " access");
} catch(Exception e) {
e.printStackTrace();
}
}
}