Examples: lockProvisional method (View - Java)

This agent attempts to lock the view named "Main" for all members of the "Guys" group. Locking is successful if the view is not yet locked, or the view is locked but the effective user is a member of Guys. A provisional lock is placed.

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");
          System.out.println("View not locked");
        System.out.println("Design locking not enabled");

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

    } catch(Exception e) {