Locking and Unlocking a KM
Document
When two users work simultaneously with the same document, you can lock and unlock the document by implementing code in the application service of your composite application.
...
1. Create a new application:
More information: Creating Composite Application Development Components
2. Create an application service in your application:
More information: Creating Application Services
3. Set dependency to DocContent, Document, and RelatedObject:
More information: Defining Application Service Dependencies
4. To lock or unlock you document, import the following code in the implementation of the application service you have created:
/* You should provide an integer value that indicates the type of the locking and the scope of the locking lockType can be one of the following: 1 - Read Lock 2 - Write Lock
lockScope can be one of the following: 1 - Shared Lock 2 - Exclusive Lock timeout should be an integer value, that indicates the timeout in milliseconds
*/ int lockType = 1; int lockScope = 2; int timeout = 100000; String token = docContentLocal.lockDocument( rid,lockType,lockScope,timeout); |
5. To release a newly obtained lock or all locks, import the following code:
docContentLocal.unlockDocumentWithToken(rid, token); docContentLocal.unLockDocument(rid);
|
6. To check whether a document is locked, import the following code:
docContentLocal.isDocumentLocked(rid));
|