Lock a Portal User to avoid parallel modification in WebDynpro Java
Greetings experts
I'm building a application to manage portal users in WebDynpro Java.
I need to lock a portal user; for example "dmaldonado"; in order to avoid parallel modifications. I don't know how
Please help me
Former Member replied
Hello,
Maybe you should take a look at this:
https://cw.sdn.sap.com/cw/docs/DOC-19144
Basically, you should define a namespace for that and an Object Name. (IE: namespace: 'com.yourcompany.useradmin' object: 'userRoles')
The implementation could follow some simple steps, also described and exemplified in the URL.
1. Lookup the Service using JNDI;
2. Create a LogicalLocking Instance; (use the LogicalLockingFactory)
3. As soon a session goes "Edit" (IE: the user clicked Edit button to acquire a lock) you perform a LogicalLocking.lock() for the ObjectName you defined;
- When trying to acquire a Lock you may have to catch and treat an Exception (LockException) and display some Warning to the user (The Object is Locked);
- I reckon you can use LogicalLocking.getCurrentOwner after on your catch block to get the user;
- Use the UME API to collect any additional information you need.
4. As soon a session "Save", you perform the LogicalLocking.unlock() for the ObjectName you defined;
JavaDocs:
http://help.sap.com/javadocs/nw04/current/en/com/sap/engine/services/applocking/LogicalLockingFactory.html
http://help.sap.com/javadocs/nw04/current/en/com/sap/engine/services/applocking/LogicalLocking.html
Hope it helps,
Daniel