how to find sub contents

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how to find sub contents

Eldurloki
hi at all,

actual I want to write a special standalone servlet which uses ofbiz
business classes. So far so good, with
"org.ofbiz.product.product.ProductWorker.findProduct(...)" I can
access the simple content fields of a product, now I want to get some
values from attached content entities, but I can't find a method to
achieve these neither the GenericValue by the given productId contains
the id's of the inner contents.

Can anyone help me ?

bye

Thomas

PS: we use ofbiz release 4.0
Reply | Threaded
Open this post in threaded view
|

Re: how to find sub contents

Mridul Pathak-2
Hi,    Have a look at org.ofbiz.product.product.ProductContentWrapper class.
 This is meant to extract Product Content from related content entities.

--
Thanks & Regards
Mridul Pathak
Hotwax Media
http://www.hotwaxmedia.com
[hidden email]

On Thu, Oct 23, 2008 at 5:49 PM, Loki <[hidden email]>wrote:

> hi at all,
>
> actual I want to write a special standalone servlet which uses ofbiz
> business classes. So far so good, with
> "org.ofbiz.product.product.ProductWorker.findProduct(...)" I can
> access the simple content fields of a product, now I want to get some
> values from attached content entities, but I can't find a method to
> achieve these neither the GenericValue by the given productId contains
> the id's of the inner contents.
>
> Can anyone help me ?
>
> bye
>
> Thomas
>
> PS: we use ofbiz release 4.0
>
Reply | Threaded
Open this post in threaded view
|

Re: how to find sub contents

Eldurloki
Hi,
if I try to get a related content in in the following way

ProductContentWrapper.getProductContentAsText(genericProduct,
"UNIQUE_INGREDIENTS", locale, dispatcher);

I get an exception like this one:

java.lang.IllegalArgumentException: Could not find a LocationResolver
class name for the location type: DataResource
        at org.ofbiz.base.util.template.FreeMarkerWorker.makeReader(FreeMarkerWorker.java:241)
        at org.ofbiz.base.util.template.FreeMarkerWorker.getTemplate(FreeMarkerWorker.java:274)
        at org.ofbiz.base.util.template.FreeMarkerWorker.renderTemplate(FreeMarkerWorker.java:160)
        at org.ofbiz.base.util.template.FreeMarkerWorker.renderTemplate(FreeMarkerWorker.java:149)
        at org.ofbiz.content.data.DataResourceWorker.renderDataResourceAsText(DataResourceWorker.java:635)
        at org.ofbiz.content.content.ContentWorker.renderContentAsText(ContentWorker.java:219)
        at org.ofbiz.product.product.ProductContentWrapper.getProductContentAsText(ProductContentWrapper.java:171)
        at org.ofbiz.product.product.ProductContentWrapper.getProductContentAsText(ProductContentWrapper.java:109)
        at org.ofbiz.product.product.ProductContentWrapper.getProductContentAsText(ProductContentWrapper.java:90)
        at my servlet ...

but with the, in the first mail addressed, simple content fields it works

ProductContentWrapper.getProductContentAsText(genericProduct,
"DESCRIPTION", locale, dispatcher);

Where should I add such a "LocationResolver class name" ?

Thanks & Regards

Thomas

On Thu, Oct 23, 2008 at 1:25 PM, Mridul Pathak
<[hidden email]> wrote:

> Hi,    Have a look at org.ofbiz.product.product.ProductContentWrapper class.
>  This is meant to extract Product Content from related content entities.
>
> --
> Thanks & Regards
> Mridul Pathak
> Hotwax Media
> http://www.hotwaxmedia.com
> [hidden email]
>
> On Thu, Oct 23, 2008 at 5:49 PM, Loki <[hidden email]>wrote:
>
>> hi at all,
>>
>> actual I want to write a special standalone servlet which uses ofbiz
>> business classes. So far so good, with
>> "org.ofbiz.product.product.ProductWorker.findProduct(...)" I can
>> access the simple content fields of a product, now I want to get some
>> values from attached content entities, but I can't find a method to
>> achieve these neither the GenericValue by the given productId contains
>> the id's of the inner contents.
>>
>> Can anyone help me ?
>>
>> bye
>>
>> Thomas
>>
>> PS: we use ofbiz release 4.0
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: how to find sub contents

Eldurloki
found it, wrong Data Template Type Id for my testcase

On Mon, Oct 27, 2008 at 10:32 AM, Loki <[hidden email]> wrote:

> Hi,
> if I try to get a related content in in the following way
>
> ProductContentWrapper.getProductContentAsText(genericProduct,
> "UNIQUE_INGREDIENTS", locale, dispatcher);
>
> I get an exception like this one:
>
> java.lang.IllegalArgumentException: Could not find a LocationResolver
> class name for the location type: DataResource
>        at org.ofbiz.base.util.template.FreeMarkerWorker.makeReader(FreeMarkerWorker.java:241)
>        at org.ofbiz.base.util.template.FreeMarkerWorker.getTemplate(FreeMarkerWorker.java:274)
>        at org.ofbiz.base.util.template.FreeMarkerWorker.renderTemplate(FreeMarkerWorker.java:160)
>        at org.ofbiz.base.util.template.FreeMarkerWorker.renderTemplate(FreeMarkerWorker.java:149)
>        at org.ofbiz.content.data.DataResourceWorker.renderDataResourceAsText(DataResourceWorker.java:635)
>        at org.ofbiz.content.content.ContentWorker.renderContentAsText(ContentWorker.java:219)
>        at org.ofbiz.product.product.ProductContentWrapper.getProductContentAsText(ProductContentWrapper.java:171)
>        at org.ofbiz.product.product.ProductContentWrapper.getProductContentAsText(ProductContentWrapper.java:109)
>        at org.ofbiz.product.product.ProductContentWrapper.getProductContentAsText(ProductContentWrapper.java:90)
>        at my servlet ...
>
> but with the, in the first mail addressed, simple content fields it works
>
> ProductContentWrapper.getProductContentAsText(genericProduct,
> "DESCRIPTION", locale, dispatcher);
>
> Where should I add such a "LocationResolver class name" ?
>
> Thanks & Regards
>
> Thomas
>
> On Thu, Oct 23, 2008 at 1:25 PM, Mridul Pathak
> <[hidden email]> wrote:
>> Hi,    Have a look at org.ofbiz.product.product.ProductContentWrapper class.
>>  This is meant to extract Product Content from related content entities.
>>
>> --
>> Thanks & Regards
>> Mridul Pathak
>> Hotwax Media
>> http://www.hotwaxmedia.com
>> [hidden email]
>>
>> On Thu, Oct 23, 2008 at 5:49 PM, Loki <[hidden email]>wrote:
>>
>>> hi at all,
>>>
>>> actual I want to write a special standalone servlet which uses ofbiz
>>> business classes. So far so good, with
>>> "org.ofbiz.product.product.ProductWorker.findProduct(...)" I can
>>> access the simple content fields of a product, now I want to get some
>>> values from attached content entities, but I can't find a method to
>>> achieve these neither the GenericValue by the given productId contains
>>> the id's of the inner contents.
>>>
>>> Can anyone help me ?
>>>
>>> bye
>>>
>>> Thomas
>>>
>>> PS: we use ofbiz release 4.0
>>>
>>
>