JAVA/CORBA クラス


例:lockProvisional メソッド
このビューアクションは、「Guys」グループの全メンバーについて、「Main Agent」という名前のエージェントをロックしようとします。そのエージェントがまだロックされていない場合、またはエージェントはロックされているが有効ユーザーが Guys のメンバーである場合は、ロックが正常に終了します。暫定ロックが行われます。

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();

// Design locking must be enabled
if (db.isDesignLockingEnabled()) {
// Get agent and lock
// Not locked if return is false or exception thrown
Agent agent = db.getAgent("Main Agent");
if (agent.lockProvisional("Guys"))
System.out.println("Agent locked");
else
System.out.println("Agent not locked");
}
else
System.out.println("Design locking not enabled");

} catch(NotesException e) {
if (e.id == NotesError.NOTES_ERR_LOCKED)
System.out.println("Agent not locked (exception)");
else
e.printStackTrace();

} catch(Exception e) {
e.printStackTrace();
}
}
}

関連項目