[opencms-dev] isInsideProject() returns always true for me

Achim Westermann achim.westermann at questico.de
Tue Feb 9 17:40:09 CET 2010


Hi Vaclav,

that's easy: Look for the CmsResource state. If it is
CmsResource.STATE_UNCHANGED: your resource is published exactly as in offline.
CmsResource.STATE_CHANGED: your resource has pending changes to be published but currently is published in previous state.

CmsResource.STATE_NEW: your resource is not online.

HTH,

Achim

Vaclav Balak wrote:
> Hi Achim,
>   thanks for response. If I understand it right, that method you sent
> me returns flag that my current project is in online project or not.
> But I would like to know how to decide if some resource is in Online
> project (i.e. that resource is published or not). Any suggestions
> please?
> 
> Vaclav
> 
> On Tue, Feb 9, 2010 at 5:01 PM, Achim Westermann
> <achim.westermann at questico.de> wrote:
>> Hi Vaclav,
>>
>> that method does something different: Checks whether the resource is in a subpath of the configured project (thus belongs to it). I know
>> this is somewhat "weird" that projects on the one hand have path semantics and on the other hand there is a "special" Online project which
>> is standing for the published resources...
>>
>> You should try something like:
>>
>> myCmsJspActionElement.getRequestContext().currentProject().isOnlineProject()
>>
>> HTH,
>>
>> Achim
>>
>> Vaclav Balak wrote:
>>> Hi,
>>>   I have following piece of code to deciding that resource is or is
>>> not inside online project:
>>>
>>> CmsProject onlineProject =
>>> cmsObject.readProject(CmsProject.ONLINE_PROJECT_NAME);
>>> CmsResourceUtil resUtil = new CmsResourceUtil(cmsObject);
>>> resUtil.setReferenceProject(onlineProject);
>>> resUtil.setResource(resource);
>>> boolean isInside = resUtil.isInsideProject();
>>>
>>> Problem is that I get always "true", but when I browse to Online
>>> project in Explorer, that resource is not there :-(. Where can be
>>> problem?
>>>
>>> Thanks in advance
>>> Vaclav Balak
>>>
>>> _______________________________________________
>>> 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
>>
> 
> _______________________________________________
> 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