JAVA/CORBA クラス


例:lockProvisional メソッド
次のエージェントは、「Guys」グループのすべてのメンバーに対して「Main」という名前のビューをロックしようとします。ビューがまだロックされていない場合、またはロックされているが有効なユーザーが 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 view and lock
       // Not locked if return is false or exception thrown
       View view = db.getView("Main");
       if (view.lockProvisional("Guys"))
         System.out.println("View locked");
       else
         System.out.println("View not locked");
     }
     else
       System.out.println("Design locking not enabled");

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

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

関連項目