cancel
Showing results for 
Search instead for 
Did you mean: 

Putting lock on iView programmatically

Former Member
0 Kudos

Hallo,

How can I put a lock on iView programmatically?

Best Regards,

Josef Motl

Accepted Solutions (1)

Accepted Solutions (1)

jens_glander
Participant
0 Kudos

Hi Josef,

Before I start I just want to mentioned clearly that programmatically modifying PCD content (== using PCD/PCM APIs) is not supported (== public) before SP10. So what I write in the following works but is not supported!

Assume an iView 'myIView' with pcd url:

pcd:portal_content/myIView

Then you need to get an IAdminBase implementation of this iView:

Make sure that the initial pcd context contains (beside the security principal and the initial context factory) the following parameter:

// aspect param

initPcdCtx.addToEnvironment(

Constants.REQUESTED_ASPECT,

PcmConstants.ASPECT_ADMINISTRATION );

IAdminBase iViewAdminBase = (IAdminBase)initPcdCtx.lookup( pNameInNamespace='portal_content/myIView' );

After you got this iViewAdminBase then do the following:

ILockHandle pcmIViewLock = (ILockHandle)iViewAdminBase.getImplementation( IAdminBase.LOCK_HANDLE );

on pcmIViewLock you can call:

pcmIViewLock.setLock( String userId, String sessionId, String description )

That will lock the iView programmatically.

Does it work?

Regards,

Jens

Former Member
0 Kudos

Hi Jens,

thanks for your responce. Do you also know how can I recognize that some object is locked? I didn't found it in APIs you were using.

Best Regards,

Josef

jens_glander
Participant
0 Kudos

Hi Josef,

How to check if the iView is locked, just do the following:

ILockHandle pcmIViewLock = (ILockHandle)iViewAdminBase.getImplementation( IAdminBase.LOCK_HANDLE );

on pcmIViewLock you can call:

pcmIViewLock.getLockInfo()

This returns a null if the object is not locked and a non null object (an ILockHandle.LockInfo object)

if the iView is locked. So this is the way to get the info if the object is not locked or locked. (furthermore you can check with the String ILockHandle.LockInfo.userId which user currently locks the object).

As I told you this API is non public and so I can't give you the full API, but to solve certain problems (like the above one) I try to help you.

That should answer your question,

Regards,

Jens

Answers (0)