Users - bsh List Interface from Arralist ?

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

Users - bsh List Interface from Arralist ?

oceatoon
Hello Again every one

Sorry this is a Bsh oriented question, but I can't seem to find the answer :
why can't I instanciate a List with an ArrayList in BSH, it stays
an ArrayList and then I can't use filterProductsInCategory(delegator,List ,String) ?

Thanks for telling me What am I doing wrong ? I'm sure it's some obvious answer but I just don't get it ?

List prodL = new ArrayList(result.get("productIds"));
print("List Size : "+prodL.size());
CatalogWorker.filterProductsInCategory(delegator,prodL , "COMBI"));

return an error
WEB-INF\actions\catalog\keywordsearch.bsh : Error in method invocation: Static method filterProductsInCategory( org.ofbiz.entity.GenericDelegator, java.util.ArrayList, java.lang.String ) not found in class'org.ofbiz.product.catalog.CatalogWorker'

Thanks for you help
tibor

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

Andrew Sykes
Tibor,

You're using "CatalogWorker.filterProductsInCategory" it should be...

CategoryWorker.filterProductsInCategory
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

oceatoon
Hahahaha that's awfull
I was sure I'd see such an embarasing answer
Thanks Andrew

but unfortunetly I still get this
Error: The application script threw an exception: Sourced file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions\catalog\keywordsearch.bsh : Method Invocation CategoryWorker.filterProductsInCategory : at Line: 46 : in file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions\catalog\keywordsearch.bsh : CategoryWorker .filterProductsInCategory ( delegator , result .get ( "productIds" ) , "COMBI" ) Target exception: java.lang.ClassCastException BSF info:

any ideas ?

Tibor


On 3/1/06, Andrew Sykes <[hidden email]> wrote:
Tibor,

You're using "CatalogWorker.filterProductsInCategory " it should be...

CategoryWorker.filterProductsInCategory
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com


_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users


 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Users - CMS Image upload

Andrew Sykes
In reply to this post by Andrew Sykes
Hi,

I'm trying to upload an image in the content application, but I keep
getting this error.

The following required parameter is missing: [resequence.contentIdTo]

Can anyone explain what I'm doing wrong?
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

Andrew Sykes
In reply to this post by oceatoon
Tibor,

Good to know I'm not the only one who does things like that ;-)

I'm not sure what result.get("productIds") is doing, but I'd guess it
isn't returning the 'java.util.List' object that you think it is.

On Wed, 2006-03-01 at 17:05 +0100, tibor katelbach wrote:

> Hahahaha that's awfull
> I was sure I'd see such an embarasing answer
> Thanks Andrew
>
> but unfortunetly I still get this
> Error: The application script threw an exception: Sourced file: C:
> \X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions
> \catalog\keywordsearch.bsh : Method Invocation
> CategoryWorker.filterProductsInCategory : at Line: 46 : in file: C:
> \X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions
> \catalog\keywordsearch.bsh : CategoryWorker .filterProductsInCategory
> ( delegator , result .get ( "productIds" ) , "COMBI" ) Target
> exception: java.lang.ClassCastException BSF info:
>
> any ideas ?
>
> Tibor
>
>
> On 3/1/06, Andrew Sykes <[hidden email]> wrote:
>         Tibor,
>        
>         You're using "CatalogWorker.filterProductsInCategory " it
>         should be...
>        
>         CategoryWorker.filterProductsInCategory
>         --
>         Kind Regards
>         Andrew Sykes <[hidden email]>
>         Sykes Development Ltd
>         http://www.sykesdevelopment.com
>        
>        
>         _______________________________________________
>         Users mailing list
>         [hidden email]
>         http://lists.ofbiz.org/mailman/listinfo/users
>
>  _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

oceatoon
Well
It's ArrayList so I do this as it is often done  in Java

List prodL = new ArrayList(result.get("productIds"));
nList = CategoryWorker.filterProductsInCategory(delegator,prodL , "COMBI");

But bsh obviously doesn't really like this or maybe I need another glasses.cleaning("indepth")
;-)

Tibor

On 3/1/06, Andrew Sykes <[hidden email]> wrote:
Tibor,

Good to know I'm not the only one who does things like that ;-)

I'm not sure what result.get("productIds") is doing, but I'd guess it
isn't returning the 'java.util.List' object that you think it is.

On Wed, 2006-03-01 at 17:05 +0100, tibor katelbach wrote:

> Hahahaha that's awfull
> I was sure I'd see such an embarasing answer
> Thanks Andrew
>
> but unfortunetly I still get this
> Error: The application script threw an exception: Sourced file: C:
> \X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions
> \catalog\keywordsearch.bsh : Method Invocation
> CategoryWorker.filterProductsInCategory : at Line: 46 : in file: C:
> \X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions
> \catalog\keywordsearch.bsh : CategoryWorker .filterProductsInCategory
> ( delegator , result .get ( "productIds" ) , "COMBI" ) Target
> exception: java.lang.ClassCastException BSF info:
>
> any ideas ?
>
> Tibor
>
>
> On 3/1/06, Andrew Sykes <[hidden email]> wrote:
>         Tibor,
>
>         You're using "CatalogWorker.filterProductsInCategory " it
>         should be...
>
>         CategoryWorker.filterProductsInCategory
>         --
>         Kind Regards
>         Andrew Sykes <[hidden email]>
>         Sykes Development Ltd
>         http://www.sykesdevelopment.com
>
>
>         _______________________________________________
>         Users mailing list
>         [hidden email]
>         http://lists.ofbiz.org/mailman/listinfo/users
>
>  _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes < [hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com


_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users


 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

Andrew Sykes
Tibor,

This is slightly different from the version that was giving you the
error though.

You weren't using 'prodL' but rather 'result.get("productIds")'.

Does that make a difference?

On Wed, 2006-03-01 at 17:42 +0100, tibor katelbach wrote:

> Well
> It's ArrayList so I do this as it is often done  in Java
>
> List prodL = new ArrayList(result.get("productIds"));
> nList = CategoryWorker.filterProductsInCategory(delegator,prodL ,
> "COMBI");
>
> But bsh obviously doesn't really like this or maybe I need another
> glasses.cleaning("indepth")
> ;-)
>
> Tibor
>
> On 3/1/06, Andrew Sykes <[hidden email]> wrote:
>         Tibor,
>        
>         Good to know I'm not the only one who does things like
>         that ;-)
>        
>         I'm not sure what result.get("productIds") is doing, but I'd
>         guess it
>         isn't returning the 'java.util.List' object that you think it
>         is.
>        
>         On Wed, 2006-03-01 at 17:05 +0100, tibor katelbach wrote:
>         > Hahahaha that's awfull
>         > I was sure I'd see such an embarasing answer
>         > Thanks Andrew
>         >
>         > but unfortunetly I still get this
>         > Error: The application script threw an exception: Sourced
>         file: C:
>         > \X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF
>         \actions
>         > \catalog\keywordsearch.bsh : Method Invocation
>         > CategoryWorker.filterProductsInCategory : at Line: 46 : in
>         file: C:
>         > \X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF
>         \actions
>         > \catalog\keywordsearch.bsh :
>         CategoryWorker .filterProductsInCategory
>         > ( delegator , result .get ( "productIds" ) , "COMBI" )
>         Target
>         > exception: java.lang.ClassCastException BSF info:
>         >
>         > any ideas ?
>         >
>         > Tibor
>         >
>         >
>         > On 3/1/06, Andrew Sykes <[hidden email]> wrote:
>         >         Tibor,
>         >
>         >         You're using "CatalogWorker.filterProductsInCategory
>         " it
>         >         should be...
>         >
>         >         CategoryWorker.filterProductsInCategory
>         >         --
>         >         Kind Regards
>         >         Andrew Sykes <[hidden email]>
>         >         Sykes Development Ltd
>         >         http://www.sykesdevelopment.com
>         >
>         >
>         >         _______________________________________________
>         >         Users mailing list
>         >         [hidden email]
>         >         http://lists.ofbiz.org/mailman/listinfo/users
>         >
>         >  _______________________________________________
>         > Users mailing list
>         > [hidden email]
>         > http://lists.ofbiz.org/mailman/listinfo/users
>         --
>         Kind Regards
>         Andrew Sykes < [hidden email]>
>         Sykes Development Ltd
>         http://www.sykesdevelopment.com
>        
>        
>         _______________________________________________
>         Users mailing list
>         [hidden email]
>         http://lists.ofbiz.org/mailman/listinfo/users
>
>  _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

oceatoon
Nop

I still get this , but don't really know where the problems is ?

Error: The application script threw an exception: Sourced file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions\catalog\keywordsearch.bsh : Method Invocation CategoryWorker.filterProductsInCategory : at Line: 47 : in file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions\catalog\keywordsearch.bsh : CategoryWorker .filterProductsInCategory ( delegator , prodL , "COMBI" ) Target exception: java.lang.ClassCastException BSF info: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions\catalog\keywordsearch.bsh at line: 0 column: 0

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

oceatoon
Maybe this can help :
This what I do in catalog/keywordSearch.bsh

Map result = ProductSearchSession.getProductSearchResult(session, delegator, prodCatalogId);

List prodL = new ArrayList(result.get("productIds"));
nList = CategoryWorker.filterProductsInCategory(delegator,prodL , "COMBI");

On 3/1/06, tibor katelbach <[hidden email]> wrote:
Nop

I still get this , but don't really know where the problems is ?

Error: The application script threw an exception: Sourced file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions\catalog\keywordsearch.bsh : Method Invocation CategoryWorker.filterProductsInCategory : at Line: 47 : in file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions\catalog\keywordsearch.bsh : CategoryWorker .filterProductsInCategory ( delegator , prodL , "COMBI" ) Target exception: java.lang.ClassCastException BSF info: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions\catalog\keywordsearch.bsh at line: 0 column: 0


 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

Andrew Sykes
In reply to this post by oceatoon
Tibor,

It's a bit hard to say on what you've given.

are you sure that prodL is a List of GenericValues?


On Wed, 2006-03-01 at 17:50 +0100, tibor katelbach wrote:

> Nop
>
> I still get this , but don't really know where the problems is ?
>
> Error: The application script threw an exception: Sourced file: C:
> \X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions
> \catalog\keywordsearch.bsh : Method Invocation
> CategoryWorker.filterProductsInCategory : at Line: 47 : in file: C:
> \X_Dev\prodemo\components\ecommerce\webapp\ecommerce\WEB-INF\actions
> \catalog\keywordsearch.bsh : CategoryWorker .filterProductsInCategory
> ( delegator , prodL , "COMBI" ) Target exception:
> java.lang.ClassCastException BSF info: C:\X_Dev\prodemo\components
> \ecommerce\webapp\ecommerce\WEB-INF\actions\catalog\keywordsearch.bsh
> at line: 0 column: 0
>  _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

Andrew Sykes
In reply to this post by oceatoon
Tibor,

It looks like my guess was right, prodL isn't a List of GenericValues

On Wed, 2006-03-01 at 17:59 +0100, tibor katelbach wrote:

> Maybe this can help :
> This what I do in catalog/keywordSearch.bsh
>
> Map result = ProductSearchSession.getProductSearchResult(session,
> delegator, prodCatalogId);
>
> List prodL = new ArrayList(result.get("productIds"));
> nList = CategoryWorker.filterProductsInCategory(delegator,prodL ,
> "COMBI");
>
> On 3/1/06, tibor katelbach <[hidden email]> wrote:
>         Nop
>        
>         I still get this , but don't really know where the problems
>         is ?
>        
>         Error: The application script threw an exception: Sourced
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh : Method Invocation
>         CategoryWorker.filterProductsInCategory : at Line: 47 : in
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh :
>         CategoryWorker .filterProductsInCategory ( delegator , prodL ,
>         "COMBI" ) Target exception: java.lang.ClassCastException BSF
>         info: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh at line: 0 column:
>         0
>        
>
>  _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

oceatoon
Yes you're right

I followed it up and it's simply an µArrayList of searchResult.getString("productId")
where searchResult is the GenericValue.
should I overload this method to return the whole GenericValue or is this too heavy of a technique ? Should I just make an ArrayList of pairs productid, parentCategory ?

thanks for your help Andrew
Tibor

On 3/1/06, Andrew Sykes <[hidden email]> wrote:
Tibor,

It looks like my guess was right, prodL isn't a List of GenericValues

On Wed, 2006-03-01 at 17:59 +0100, tibor katelbach wrote:
> Maybe this can help :
> This what I do in catalog/keywordSearch.bsh
>
> Map result = ProductSearchSession.getProductSearchResult(session,
> delegator, prodCatalogId);
>
> List prodL = new ArrayList(result.get("productIds"));
> nList = CategoryWorker.filterProductsInCategory(delegator,prodL ,
> "COMBI");
>
> On 3/1/06, tibor katelbach <[hidden email]> wrote:
>         Nop
>
>         I still get this , but don't really know where the problems
>         is ?

>
>         Error: The application script threw an exception: Sourced
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh : Method Invocation
>         CategoryWorker.filterProductsInCategory : at Line: 47 : in
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh :
>         CategoryWorker .filterProductsInCategory ( delegator , prodL ,
>         "COMBI" ) Target exception: java.lang.ClassCastException BSF
>         info: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh at line: 0 column:
>         0
>
>
>  _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com


_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users


 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - CMS Image upload

byersa
In reply to this post by Andrew Sykes
Andrew,

I am in the middle of some work that involves the CMS. I did not intend
for this to break, but it is probably a result of work that I am doing.
I will look into it and try to get it fixed today.

-Al

Andrew Sykes wrote:

>Hi,
>
>I'm trying to upload an image in the content application, but I keep
>getting this error.
>
>The following required parameter is missing: [resequence.contentIdTo]
>
>Can anyone explain what I'm doing wrong?
>  
>

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - CMS Image upload

Andrew Sykes
Al,

Thank you.

On Wed, 2006-03-01 at 10:33 -0700, Al Byers wrote:

> Andrew,
>
> I am in the middle of some work that involves the CMS. I did not intend
> for this to break, but it is probably a result of work that I am doing.
> I will look into it and try to get it fixed today.
>
> -Al
>
> Andrew Sykes wrote:
>
> >Hi,
> >
> >I'm trying to upload an image in the content application, but I keep
> >getting this error.
> >
> >The following required parameter is missing: [resequence.contentIdTo]
> >
> >Can anyone explain what I'm doing wrong?
> >  
> >
>
>  
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

Sterling Okura
In reply to this post by oceatoon

Tibor,

 

Rather than trying to convert a list of strings to a list of GenericValues, it might be easier to use the CategoryWorker’s isProductInCategory directly (since that’s what filterProductsInCategory method ends up calling anyway).

 

Just iterate through list of ID’s and display any that return true.

 

Adrian has a valid point that bsh is slower, but in my experience it isn’t too bad  once cached (but you have to clear cache for code changes to work).  Depending on how many products you have, it might work ok to just iterated in bsh.

 

public static boolean isProductInCategory(org.ofbiz.entity.GenericDelegator delegator,
                                          java.lang.String productId,
                                          java.lang.String productCategoryId)

                                   throws org.ofbiz.entity.GenericEntityException

 

-sterling

 


From: tibor katelbach [mailto:[hidden email]]
Sent: Wednesday, March 01, 2006 10:22 AM
To: OFBiz Users / Usage Discussion
Subject: Re: [OFBiz] Users - bsh List Interface from Arralist ?

 

Yes you're right

I followed it up and it's simply an µArrayList of searchResult.getString("productId")
where searchResult is the GenericValue.
should I overload this method to return the whole GenericValue or is this too heavy of a technique ? Should I just make an ArrayList of pairs productid, parentCategory ?

thanks for your help Andrew
Tibor

On 3/1/06, Andrew Sykes <[hidden email]> wrote:

Tibor,

It looks like my guess was right, prodL isn't a List of GenericValues

On Wed, 2006-03-01 at 17:59 +0100, tibor katelbach wrote:
> Maybe this can help :
> This what I do in catalog/keywordSearch.bsh
>
> Map result = ProductSearchSession.getProductSearchResult(session,
> delegator, prodCatalogId);
>
> List prodL = new ArrayList(result.get("productIds"));
> nList = CategoryWorker.filterProductsInCategory(delegator,prodL ,
> "COMBI");
>
> On 3/1/06, tibor katelbach <[hidden email]> wrote:
>         Nop
>
>         I still get this , but don't really know where the problems
>         is ?
>
>         Error: The application script threw an exception: Sourced
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh : Method Invocation
>         CategoryWorker.filterProductsInCategory : at Line: 47 : in
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh :
>         CategoryWorker .filterProductsInCategory ( delegator , prodL ,
>         "COMBI" ) Target exception: java.lang.ClassCastException BSF
>         info: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh at line: 0 column:
>         0
>
>
>  _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com


_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users

 


 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

Sterling Okura
In reply to this post by oceatoon

Tibor,

 

I forgot to mention one more suggestion.  You might want to comment out the variant product search code in isProductInCategory() method if you don’t use variants, or if all of your virtual products belong to the same categories that their variants do.

 

What that code does is for every product that doesn’t belong to that category, it does a non-cached findByPrimaryKey to grab the Product entity and check for variants, and if it finds variants if checks each one to see if they belong in that category.  I noticed a huge performance increase by commenting out that code.

 

Warm regards,

sterling

 


From: Sterling Okura [mailto:[hidden email]]
Sent: Wednesday, March 01, 2006 2:44 PM
To: 'OFBiz Users / Usage Discussion'
Subject: Re: [OFBiz] Users - bsh List Interface from Arralist ?

 

Tibor,

 

Rather than trying to convert a list of strings to a list of GenericValues, it might be easier to use the CategoryWorker’s isProductInCategory directly (since that’s what filterProductsInCategory method ends up calling anyway).

 

Just iterate through list of ID’s and display any that return true.

 

Adrian has a valid point that bsh is slower, but in my experience it isn’t too bad  once cached (but you have to clear cache for code changes to work).  Depending on how many products you have, it might work ok to just iterated in bsh.

 

public static boolean isProductInCategory(org.ofbiz.entity.GenericDelegator delegator,
                                          java.lang.String productId,
                                          java.lang.String productCategoryId)

                                   throws org.ofbiz.entity.GenericEntityException

 

-sterling

 


From: tibor katelbach [mailto:[hidden email]]
Sent: Wednesday, March 01, 2006 10:22 AM
To: OFBiz Users / Usage Discussion
Subject: Re: [OFBiz] Users - bsh List Interface from Arralist ?

 

Yes you're right

I followed it up and it's simply an µArrayList of searchResult.getString("productId")
where searchResult is the GenericValue.
should I overload this method to return the whole GenericValue or is this too heavy of a technique ? Should I just make an ArrayList of pairs productid, parentCategory ?

thanks for your help Andrew
Tibor

On 3/1/06, Andrew Sykes <[hidden email]> wrote:

Tibor,

It looks like my guess was right, prodL isn't a List of GenericValues

On Wed, 2006-03-01 at 17:59 +0100, tibor katelbach wrote:
> Maybe this can help :
> This what I do in catalog/keywordSearch.bsh
>
> Map result = ProductSearchSession.getProductSearchResult(session,
> delegator, prodCatalogId);
>
> List prodL = new ArrayList(result.get("productIds"));
> nList = CategoryWorker.filterProductsInCategory(delegator,prodL ,
> "COMBI");
>
> On 3/1/06, tibor katelbach <[hidden email]> wrote:
>         Nop
>
>         I still get this , but don't really know where the problems
>         is ?
>
>         Error: The application script threw an exception: Sourced
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh : Method Invocation
>         CategoryWorker.filterProductsInCategory : at Line: 47 : in
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh :
>         CategoryWorker .filterProductsInCategory ( delegator , prodL ,
>         "COMBI" ) Target exception: java.lang.ClassCastException BSF
>         info: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh at line: 0 column:
>         0
>
>
>  _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com


_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users

 


 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - CMS Image upload

byersa
In reply to this post by Andrew Sykes
Andrew,

Did it used to work? I don't see how. I put a fix into Rev 6889 that
eliminates that problem. Let me know of any others.

-Al

Andrew Sykes wrote:

>Hi,
>
>I'm trying to upload an image in the content application, but I keep
>getting this error.
>
>The following required parameter is missing: [resequence.contentIdTo]
>
>Can anyone explain what I'm doing wrong?
>  
>

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

oceatoon
In reply to this post by oceatoon
Thanks every one for these efficient directions
I got it to work now in bsh and got to understand quite a bit of the interesting  java behind it all.
It works on one level meaning if the product is directly in the category "mycat" in the isProductInCategory(deleg,"product","mycat").
One of my project specification is that my master categories (those of my my search cut up) will have sub categories that contain the products, So I'll need to augment 
isProductInCategory() to go back up in to the category tree to check if the product is in the "mycat" Master Category.
Is there such a method for retreiving the whole category tree of a product or the top level parent category ?

Thanks for all your help
It's quite comforting to know one is not alone with so many functionalities to discover
Best regards
Tibor

On 3/1/06, Sterling Okura <[hidden email]> wrote:

Tibor,

 

I forgot to mention one more suggestion.  You might want to comment out the variant product search code in isProductInCategory() method if you don't use variants, or if all of your virtual products belong to the same categories that their variants do.

 

What that code does is for every product that doesn't belong to that category, it does a non-cached findByPrimaryKey to grab the Product entity and check for variants, and if it finds variants if checks each one to see if they belong in that category.  I noticed a huge performance increase by commenting out that code.

 

Warm regards,

sterling

 


From: Sterling Okura [mailto: [hidden email]]
Sent: Wednesday, March 01, 2006 2:44 PM


To: 'OFBiz Users / Usage Discussion'
Subject: Re: [OFBiz] Users - bsh List Interface from Arralist ?

 

Tibor,

 

Rather than trying to convert a list of strings to a list of GenericValues, it might be easier to use the CategoryWorker's isProductInCategory directly (since that's what filterProductsInCategory method ends up calling anyway).

 

Just iterate through list of ID's and display any that return true.

 

Adrian has a valid point that bsh is slower, but in my experience it isn't too bad  once cached (but you have to clear cache for code changes to work).  Depending on how many products you have, it might work ok to just iterated in bsh.

 

public static boolean isProductInCategory(org.ofbiz.entity.GenericDelegator delegator,
                                          java.lang.String productId,

                                          java.lang.String productCategoryId)

                                   throws org.ofbiz.entity.GenericEntityException

 

-sterling

 


From: tibor katelbach [mailto:[hidden email]]
Sent: Wednesday, March 01, 2006 10:22 AM
To: OFBiz Users / Usage Discussion
Subject: Re: [OFBiz] Users - bsh List Interface from Arralist ?

 

Yes you're right

I followed it up and it's simply an µArrayList of searchResult.getString("productId")
where searchResult is the GenericValue.
should I overload this method to return the whole GenericValue or is this too heavy of a technique ? Should I just make an ArrayList of pairs productid, parentCategory ?

thanks for your help Andrew
Tibor

On 3/1/06, Andrew Sykes <[hidden email]> wrote:

Tibor,

It looks like my guess was right, prodL isn't a List of GenericValues

On Wed, 2006-03-01 at 17:59 +0100, tibor katelbach wrote:
> Maybe this can help :
> This what I do in catalog/keywordSearch.bsh
>
> Map result = ProductSearchSession.getProductSearchResult(session,
> delegator, prodCatalogId);
>
> List prodL = new ArrayList(result.get("productIds"));
> nList = CategoryWorker.filterProductsInCategory(delegator,prodL ,
> "COMBI");
>
> On 3/1/06, tibor katelbach <[hidden email]> wrote:
>         Nop
>
>         I still get this , but don't really know where the problems
>         is ?
>
>         Error: The application script threw an exception: Sourced
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh : Method Invocation
>         CategoryWorker.filterProductsInCategory : at Line: 47 : in
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh :
>         CategoryWorker .filterProductsInCategory ( delegator , prodL ,
>         "COMBI" ) Target exception: java.lang.ClassCastException BSF
>         info: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh at line: 0 column:
>         0
>
>
>  _______________________________________________
> Users mailing list
> [hidden email]
> <a href="http://lists.ofbiz.org/mailman/listinfo/users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
<a href="http://www.sykesdevelopment.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.sykesdevelopment.com


_______________________________________________
Users mailing list
[hidden email]
<a href="http://lists.ofbiz.org/mailman/listinfo/users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.ofbiz.org/mailman/listinfo/users

 



_______________________________________________
Users mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.ofbiz.org/mailman/listinfo/users" target="_blank"> http://lists.ofbiz.org/mailman/listinfo/users



 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - bsh List Interface from Arralist ?

oceatoon
it seems it already works with recursive inCategory check :)
is this correct ?

On 3/2/06, tibor katelbach <[hidden email]> wrote:
Thanks every one for these efficient directions
I got it to work now in bsh and got to understand quite a bit of the interesting  java behind it all.
It works on one level meaning if the product is directly in the category "mycat" in the isProductInCategory(deleg,"product","mycat").
One of my project specification is that my master categories (those of my my search cut up) will have sub categories that contain the products, So I'll need to augment 
isProductInCategory() to go back up in to the category tree to check if the product is in the "mycat" Master Category.
Is there such a method for retreiving the whole category tree of a product or the top level parent category ?

Thanks for all your help
It's quite comforting to know one is not alone with so many functionalities to discover
Best regards
Tibor

On 3/1/06, Sterling Okura <[hidden email]> wrote:

Tibor,

 

I forgot to mention one more suggestion.  You might want to comment out the variant product search code in isProductInCategory() method if you don't use variants, or if all of your virtual products belong to the same categories that their variants do.

 

What that code does is for every product that doesn't belong to that category, it does a non-cached findByPrimaryKey to grab the Product entity and check for variants, and if it finds variants if checks each one to see if they belong in that category.  I noticed a huge performance increase by commenting out that code.

 

Warm regards,

sterling

 


From: Sterling Okura [mailto: [hidden email]]
Sent: Wednesday, March 01, 2006 2:44 PM


To: 'OFBiz Users / Usage Discussion'
Subject: Re: [OFBiz] Users - bsh List Interface from Arralist ?

 

Tibor,

 

Rather than trying to convert a list of strings to a list of GenericValues, it might be easier to use the CategoryWorker's isProductInCategory directly (since that's what filterProductsInCategory method ends up calling anyway).

 

Just iterate through list of ID's and display any that return true.

 

Adrian has a valid point that bsh is slower, but in my experience it isn't too bad  once cached (but you have to clear cache for code changes to work).  Depending on how many products you have, it might work ok to just iterated in bsh.

 

public static boolean isProductInCategory(org.ofbiz.entity.GenericDelegator delegator,
                                          java.lang.String productId,


                                          java.lang.String productCategoryId)

                                   throws org.ofbiz.entity.GenericEntityException

 

-sterling

 


From: tibor katelbach [mailto:[hidden email]]
Sent: Wednesday, March 01, 2006 10:22 AM
To: OFBiz Users / Usage Discussion
Subject: Re: [OFBiz] Users - bsh List Interface from Arralist ?

 

Yes you're right

I followed it up and it's simply an µArrayList of searchResult.getString("productId")
where searchResult is the GenericValue.
should I overload this method to return the whole GenericValue or is this too heavy of a technique ? Should I just make an ArrayList of pairs productid, parentCategory ?

thanks for your help Andrew
Tibor

On 3/1/06, Andrew Sykes <[hidden email]> wrote:

Tibor,

It looks like my guess was right, prodL isn't a List of GenericValues

On Wed, 2006-03-01 at 17:59 +0100, tibor katelbach wrote:
> Maybe this can help :
> This what I do in catalog/keywordSearch.bsh
>
> Map result = ProductSearchSession.getProductSearchResult(session,
> delegator, prodCatalogId);
>
> List prodL = new ArrayList(result.get("productIds"));
> nList = CategoryWorker.filterProductsInCategory(delegator,prodL ,
> "COMBI");
>
> On 3/1/06, tibor katelbach <[hidden email]> wrote:
>         Nop
>
>         I still get this , but don't really know where the problems
>         is ?
>
>         Error: The application script threw an exception: Sourced
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh : Method Invocation
>         CategoryWorker.filterProductsInCategory : at Line: 47 : in
>         file: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh :
>         CategoryWorker .filterProductsInCategory ( delegator , prodL ,
>         "COMBI" ) Target exception: java.lang.ClassCastException BSF
>         info: C:\X_Dev\prodemo\components\ecommerce\webapp\ecommerce
>         \WEB-INF\actions\catalog\keywordsearch.bsh at line: 0 column:
>         0
>
>
>  _______________________________________________
> Users mailing list
> [hidden email]
> <a href="http://lists.ofbiz.org/mailman/listinfo/users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.ofbiz.org/mailman/listinfo/users
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
<a href="http://www.sykesdevelopment.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.sykesdevelopment.com


_______________________________________________
Users mailing list
[hidden email]
<a href="http://lists.ofbiz.org/mailman/listinfo/users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.ofbiz.org/mailman/listinfo/users

 



_______________________________________________
Users mailing list
[hidden email]
<a href="http://lists.ofbiz.org/mailman/listinfo/users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://lists.ofbiz.org/mailman/listinfo/users




 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Users - Entity XML Export

Andrew Sykes
Hi,

Would it be a good idea to add a fromDate and thruDate to the entity
export stuff in webtools?

I think this would be a handy thing when preparing seed data as it would
allow the developer to quickly extract only the changes he'd made.

Perhaps there is another way of doing this already...?
--
Kind Regards
Andrew Sykes <[hidden email]>
Sykes Development Ltd
http://www.sykesdevelopment.com

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
12