Examples: IsDocumentLockingEnabled property

  1. This agent displays whether document locking is enabled for the current database.
    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();
    
          if (db.isDocumentLockingEnabled())
            System.out.println("Document locking is enabled");
          else
            System.out.println("Document locking is not enabled");
    
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  2. This agent toggles document locking for the current database.
    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();
    
          db.setDocumentLockingEnabled(!db.isDocumentLockingEnabled());
    
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }