lock (NotesView - JavaScript™)
Locks a view.
Defined in
NotesViewSyntax
lock() : boolean
lock(provisionalock:boolean) : boolean
lock(name:string, provisionalock:boolean) : boolean
lock(names:java.util.Vector)
: boolean
lock(names:java.util.Vector,
provisionalock:boolean)
: boolean
Parameter | Description |
---|---|
name or names |
The names of the lock holders. Each lock holder must be a user or group. Defaults to one lock holder: the effective user. The empty string ("") is not permitted. |
provisionalock |
|
Return value | Description |
---|---|
boolean |
|
Usage
IsDesignLockingEnabled in NotesDatabase must be true or this method throws an exception.This
method:
The following actions occur depending on the current lock
status: If the view is not locked, this method places the lock and
returns true.- Places a persistent lock if the administration (master lock) server is available.
- Places a provisional lock if the administration server is not available and the second parameter is true.
- Throws an exception if the administration server is not available and the second parameter is false.
- If the view is locked and the current user is one of the lock holders, this method returns true.
- If the view is locked and the current user is not one of the lock holders, this method returns false.
- If the view is modified by another user before the lock can be placed, this method throws an exception.
Examples
This button locks a view.database.setDesignLockingEnabled(true);
var v:NotesView = database.getView("main");
try {
if (v.lock(true)) {
requestScope.status = v.getName() + " locked";
} else {
requestScope.status = v.getName() + " not locked";
}
} catch(e) {
requestScope.status = v.getName() + " not locked";
}
var lh:java.util.Vector = v.getLockHolders();
requestScope.status += "\n" +
(lh.isEmpty() ? "No lock holder" : "\Current lock holder: " + lh.firstElement());
database.setDesignLockingEnabled(false);