If you mean if this will work in a database that isn't built using XPages. the answer is no.
This demo code only works in XPages web code and not if you run the code in a notes client.
You should look at the built in document locking functions
Check out these links if you are using none XPage code
http://www-01.ibm.com/support/docview.wss?uid=swg21095394
http://stackoverflow.com/questions/13286220/emulate-document-locking-in-lotusscript