JAVA/CORBA クラス


例:UserType プロパティ、IsGroup プロパティ、IsPerson プロパティ、IsServer プロパティ
次のエージェントは、エージェントのコメントで指定した ACL エントリのユーザータイプを出力し、そのエントリがユーザー、サーバー、グループのどれに対するものかを出力します。

import lotus.domino.*;
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();
ACL acl = db.getACL();
ACLEntry entry = acl.getEntry(agent.getComment());
if (entry != null) {
String ut = null;
switch (entry.getUserType()) {
case ACLEntry.TYPE_MIXED_GROUP :
ut = "mixed group"; break;
case ACLEntry.TYPE_PERSON :
ut = "person"; break;
case ACLEntry.TYPE_PERSON_GROUP :
ut = "person group"; break;
case ACLEntry.TYPE_SERVER :
ut = "server"; break;
case ACLEntry.TYPE_SERVER_GROUP :
ut = "server group"; break;
case ACLEntry.TYPE_UNSPECIFIED :
ut = "unspecified"; break; }
System.out.println("User type is " + ut);
if (entry.isPerson())
System.out.println("Is a person");
if (entry.isServer())
System.out.println("Is a server");
if (entry.isGroup())
System.out.println("Is a group"); }
} catch(Exception e) {
e.printStackTrace();
}
}
}

関連項目