Lock a Portal User to avoid parallel modification in WebDynpro Java
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
Daniel Ruiz replied
Maybe you should take a look at this:
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;
Hope it helps,