Well, after hours of painful realisation that this isn't going to work as
easy as expected, I am now trying a different approach:


OFBiz comes with the option of using Beanshell scripts to extend the
Freemarker definitions. Taken from 

http://wiki.magnolia-cms.com/display/WIKI/Access+content+through+the+API

I think that it may be possible to work around my initial problems by
providing ofbiz with an additional beanshell script that grands access to
the content and maps that to the definitions... 

A simple Beanshell must look similar to:

import info.magnolia.cms.core.HierarchyManager;
import info.magnolia.cms.core.Content;
import info.magnolia.cms.beans.config.ContentRepository;
import info.magnolia.context.MgnlContext;

HierarchyManager mgr =
MgnlContext.getHierarchyManager(ContentRepository.WEBSITE);
Content uriContent = mgr.getContent("/en/about-magnolia");
context.put("content",uriContent);



Where of course this one doesn't work - I am receiving the following error
message:

org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen
[component://brandsparadise/widget/BrandsparadiseScreens.xml#main-decorator]:
org.ofbiz.base.util.GeneralException: Error running BSH script at location
[component://brandsparadise/webapp/brandsparadise/actions/cms.bsh] (Error
running BSH script at
[component://brandsparadise/webapp/brandsparadise/actions/cms.bsh], line
[10]: Sourced file:
component://brandsparadise/webapp/brandsparadise/actions/cms.bsh : Typed
variable declaration : Method Invocation MgnlContext.getHierarchyManager :
at Line: 10 : in file:
component://brandsparadise/webapp/brandsparadise/actions/cms.bsh :
MgnlContext .getHierarchyManager ( ContentRepository .WEBSITE )

Target exception: java.lang.IllegalStateException: MgnlContext is not set
for this thread
(Sourced file:
component://brandsparadise/webapp/brandsparadise/actions/cms.bsh : Typed
variable declaration : Method Invocation MgnlContext.getHierarchyManager))
(Error running BSH script at location
[component://brandsparadise/webapp/brandsparadise/actions/cms.bsh] (Error
running BSH script at
[component://brandsparadise/webapp/brandsparadise/actions/cms.bsh], line
[10]: Sourced file:
component://brandsparadise/webapp/brandsparadise/actions/cms.bsh : Typed
variable declaration : Method Invocation MgnlContext.getHierarchyManager :
at Line: 10 : in file:
component://brandsparadise/webapp/brandsparadise/actions/cms.bsh :
MgnlContext .getHierarchyManager ( ContentRepository .WEBSITE )

Target exception: java.lang.IllegalStateException: MgnlContext is not set
for this thread
(Sourced file:
component://brandsparadise/webapp/brandsparadise/actions/cms.bsh : Typed
variable declaration : Method Invocation MgnlContext.getHierarchyManager)))


Is there a way for me to set the thread I want to use? 
-- 
View this message in context: 
http://www.nabble.com/Integrating-Magnolia-into-OFBiz-tp20359541p20478195.html
Sent from the Magnolia - User mailing list archive at Nabble.com.


----------------------------------------------------------------
for list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
----------------------------------------------------------------

Reply via email to