Jahia Dev Forum > How to unlock node...

0 (0 Good)
0 (0 Bad)

How to unlock node programatically

by  asy »  2012/09/27 02:49

Hi Guys,

How do I programmatically unlock a node?  

session.getNode("<node path>").unlock(); ---> does not do anything

session.getWorkspace().getLockManager(); ---> throws UnsupportedRepositoryOperationException

 

The reason I want do this, I am experiencing problems with 2 step publication process. After successful publishing, some nodes are remained locked.

 

Cheers,

Bryan Manalo

IOM Senior Java Developer

  • How to unlock node programatically
    2012/09/27 02:49

    asy <p> Hi Guys,</p> <p> How do I programmatically unlock a node? &nbsp;</p> <p> session.getNode(&quot;&lt;node path&gt;&quot;).unlock(); ---&gt; does not do anything</p> <p> session.getWorkspace().getLockManager(); ---&gt; throws&nbsp;UnsupportedRepositoryOperationException</p> <p> &nbsp;</p> <p> The reason I want do this, I am experiencing problems with 2 step publication process. After successful publishing, some nodes are remained locked.</p> <p> &nbsp;</p> <p> Cheers,</p> <p> Bryan Manalo</p> <p> IOM Senior Java Developer</p>

  • Number of messages  13
    Registration date Sep 27, 2012
    0 (0 Good)
    0 (0 Bad)

    Re: How to unlock node programatically

    by  asy »  2012/10/01 06:32

    help anyone? Damien?

     

    Regards,

     

  • Re: How to unlock node programatically
    2012/10/01 06:32

    asy <p> help anyone? Damien?</p> <p> &nbsp;</p> <p> Regards,</p> <p> &nbsp;</p>

  • Number of messages  13
    Registration date Oct 1, 2012
    0 (0 Good)
    0 (0 Bad)

    Re: Re: How to unlock node programatically

    by  wassek »  2012/10/02 08:25

    Hi,

     

    How do you try that?

    Normally first code should work. For instance you could use the jcrConsole.jsp with follow code (e.g. for homepage of ACME-SPACE website):

    JCRNodeWrapper node= session.getNode("/sites/ACME-SPACE/home");
    node.unlock();

     

    This should unlock the node.

     

    regards,

    Werner

    Werner Assek (wassek)

    Number of messages  25
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: Re: Re: How to unlock node programatically

    by  asy »  2012/10/03 03:08

    Thanks Werner for the input.  I have tried that, but it does not work (at least for me).

     

    Anyhow, I found another solution looking at jcrBrowser.jsp from tools -- it uses JCRContentUtils.clearAllLocks(node.getPath(), false, jcrSession);

    I have tested that one and it works.

     

    Cheers,

  • Re: Re: Re: How to unlock node programatically
    2012/10/03 03:08

    asy <p> Thanks Werner for the input. &nbsp;I have tried that, but it does not work (at least for me).</p> <p> &nbsp;</p> <p> Anyhow, I found another solution looking at jcrBrowser.jsp from tools -- it uses&nbsp;JCRContentUtils.clearAllLocks(node.getPath(), false, jcrSession);</p> <p> I have tested that one and it works.</p> <p> &nbsp;</p> <p> Cheers,</p>

  • Number of messages  13
    Registration date Oct 3, 2012
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page