Arbortext Command Language > Repository API > dobj_lock
  
dobj_lock
dobj_lock (dobj , lockflag[, ud])
Locks, in the repository, the document object with the dobj ACL document object handle.
dobj — The object handle of the document object to be locked. If dobj is invalid, or the operation fails, the function sets $main::ioerr and returns a zero (0). If the operation is successful, the function returns a the document handle of the locked object.
lockflag — An integer that determines how the lock will take place. The available lockflag values are:
1 — Destroys any existing lock in favor of the new lock (may not work with all document management systems). Use with extreme caution.
2 — Locks the top level document.
The ud parameter can be used to pass user defined information to a callback; strings must match the adapter encoding. Refer to Repository API Callback functions for more information on using callbacks with the Repository API functions.
The dobj_close function must be called to close the document object after it has been processed. However, the returned document object may differ from the one passed to the function. The document object can be closed by implementing the following sample code.
local new_dobj = dobj_lock(dobj, 2);
if (dobj_valid(new_dobj))
{
# A new dobj was returned. Release the old one and
# start using the new one.
dobj_close(dobj);
dobj = new_dobj;
}