[opencms-dev] How to unlock a project/file using java class

Pam Callaway pamcallaway at pobox.com
Sat Jan 19 03:03:07 CET 2008


Do you have any more details on the exception?  What user are you
logged in as?  You have to log in programatically.  I haven't done
this in a while, but I seem to recall the user for just
getRequestContext is either the person you're logged in as or
anonymouse, which is probably not enough permissions to do those
things.

On Jan 18, 2008 2:19 PM, gsriman <gsriman at gmail.com> wrote:
>
> Hi Pam,
>    Thanks for your response. I am getting cmsexception error in my code at
> line 3 and also line 5. Here I am trying to unlock offline project.
> here is my code snippet.
>        1    CmsObject cmsobj1;
>        2    CmsRequestContext cmsContext = cmsobj1.getRequestContext();
>        3    CmsProject offlineProject = cmsobj1.readProject("Offline");
>        4    cmsContext.setCurrentProject(offlineProject);
>        5    cmsobj1.unlockProject(offlineProject );
> Am I doing anything wrong?
>
> Thanks in advance
> Sriman
>
> Pam Callaway wrote:
> >
>
> > Here's a hint to get started...
> > http://opencms-wiki.org/Switch_to_the_offline_project
> >
> > To unlock a file you must be logged in as an administrator, or at
> > least as a user that has permissions to that file.
> >
> > Here's some more stuff to help, it shows you how to unlock a resource
> > at the very bottom:
> > http://opencms-wiki.org/Write_a_file_programatically
> >
> > On Jan 15, 2008 1:58 PM, gsriman <gsriman at gmail.com> wrote:
> >>
> >> Hi All,
> >>   I am trying to write a java action class for the template and need to
> >> unlock the file or project before doing anything. Can you tell me how can
> >> I
> >> unlock the Offline project and also a file in this project?
> >>
> >> Thanks in advance
> >> Sriman
> >> --
> >> View this message in context:
> >> http://www.nabble.com/How-to-unlock-a-project-file-using-java-class-tp14844933p14844933.html
> >> Sent from the OpenCMS - Dev mailing list archive at Nabble.com.
> >>
> >>
> >> _______________________________________________
> >> This mail is sent to you from the opencms-dev mailing list
> >> To change your list options, or to unsubscribe from the list, please
> >> visit
> >> http://lists.opencms.org/mailman/listinfo/opencms-dev
> >>
> >
> > _______________________________________________
> > This mail is sent to you from the opencms-dev mailing list
> > To change your list options, or to unsubscribe from the list, please visit
> > http://lists.opencms.org/mailman/listinfo/opencms-dev
> >
> >
>
> --
> View this message in context: http://www.nabble.com/How-to-unlock-a-project-file-using-java-class-tp14844933p14957272.html
>
> Sent from the OpenCMS - Dev mailing list archive at Nabble.com.
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>



More information about the opencms-dev mailing list