.

HCLSoftware Business Partner
Domino Consulting Services
CRUCIAL Notes Tools
+1 212-599-2048

Domino Consulting Services
CRUCIAL Notes Tools
Domino administration
Notes development

Facebook Twitter YouTube
Chat now       
.
ProductsDownloadsNewsAbout usContact


Need a Domino Consultant? Call NotesMail +1 212-599-2048 - HCLSoftware Business Partner

JAVA/CORBA CLASSES


Examples: unlock method
This example attempts to unlock the selected document. Unlocking is successful if the effective user is one of the lock holders.

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();
     DocumentCollection dc = agentContext.getUnprocessedDocuments();
     
     // Document locking must be enabled
     if (db.isDocumentLockingEnabled()) {
       // Get document and unlock
       // Not unlocked if exception thrown
       Document doc = dc.getFirstDocument();
       doc.unlock();
       System.out.println("document unlocked");
     }
     else
       System.out.println("Document locking not enabled");

   } catch(NotesException e) {
       System.out.println(e.id + "document not unlocked");

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

See Also