Skip to Content
author's profile photo
Former Member

Putting lock on iView programmatically

Hallo,

How can I put a lock on iView programmatically?

Best Regards,

Josef Motl

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Best Answer
    Posted on Jan 11, 2005 at 10:26 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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