次の例では、現在のデータベースに対する現在のユーザーのアクセスレベルを示すメッセージを出力します。
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();
String title = db.getTitle();
int level = db.getCurrentAccessLevel();
System.out.print("For database ¥"" + title +
"¥" you have ");
switch(level) {
case(ACL.LEVEL_NOACCESS) :
System.out.print("No access"); break;
case(ACL.LEVEL_DEPOSITOR) :
System.out.print("Depositor access"); break;
case(ACL.LEVEL_READER) :
System.out.print("Reader access"); break;
case(ACL.LEVEL_AUTHOR) :
System.out.print("Author access"); break;
case(ACL.LEVEL_EDITOR) :
System.out.print("Editor access"); break;
case(ACL.LEVEL_DESIGNER) :
System.out.print("Designer access"); break;
case(ACL.LEVEL_MANAGER) :
System.out.print("Manager access"); break;
default:
System.out.print("Unknown access"); break; }
System.out.print("¥n");
} catch(Exception e) {
e.printStackTrace();
}
}
}