You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2010/07/01 16:17:53 UTC
Re: svn commit: r959673 - /ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
To be clear, I'd like to introduce a dependent dropdows mechanism in widgets.
I'm quite sure it's not easy, not sure it's even feasible at this stage...
Jacques
From: <jl...@apache.org>
> Author: jleroux
> Date: Thu Jul 1 14:05:21 2010
> New Revision: 959673
>
> URL: http://svn.apache.org/viewvc?rev=959673&view=rev
> Log:
> Adds a getAssociatedProductsList method. I will certainly add the companions service and request later in the Product application.
> I have also the vague desire to generalize this more, as I have been able to quickly use it in a widget form following the
> Freemarker way already used.
>
> Modified:
> ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
>
> Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=959673&r1=959672&r2=959673&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java (original)
> +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Thu Jul 1 14:05:21 2010
> @@ -33,6 +33,7 @@ import org.ofbiz.entity.GenericValue;
> import org.ofbiz.entity.condition.EntityCondition;
> import org.ofbiz.entity.condition.EntityExpr;
> import org.ofbiz.entity.condition.EntityOperator;
> +import org.ofbiz.entity.util.EntityUtil;
>
> /**
> * Common Workers
> @@ -135,6 +136,35 @@ public class CommonWorkers {
> return geoList;
> }
>
> + public static List<GenericValue> getAssociatedProductsList(Delegator delegator, String productCategoryId) {
> + return getAssociatedProductsList(delegator, productCategoryId, null);
> + }
> +
> + /**
> + * Returns a list of active related products for a product category
> + */
> + public static List<GenericValue> getAssociatedProductsList(Delegator delegator, String productCategoryId, String listOrderBy)
> {
> + List<GenericValue> products = FastList.newInstance();
> + if (UtilValidate.isNotEmpty(productCategoryId)) {
> + EntityCondition productsFindCond = EntityCondition.makeCondition(
> + EntityCondition.makeCondition("productCategoryId", productCategoryId));
> +
> + if (UtilValidate.isEmpty(listOrderBy)) {
> + listOrderBy = "sequenceNum";
> + }
> + List<String> sortList = UtilMisc.toList(listOrderBy);
> +
> + try {
> + products = delegator.findList("ProductCategoryMember", productsFindCond, null, sortList, null, true);
> + products = EntityUtil.filterByDate(products);
> + } catch (GenericEntityException e) {
> + Debug.logError(e, "Cannot lookup ProductCategoryMember", module);
> + }
> + }
> +
> + return products;
> + }
> +
> /**
> * A generic method to be used on Type enities, e.g. ProductType. Recurse to the root level in the type hierarchy
> * and checks if the specified type childType has parentType as its parent somewhere in the hierarchy.
>
>
Re: svn commit: r959673 - /ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
Posted by Jacques Le Roux <ja...@les7arts.com>.
Done at r959984
Jacques
From: "Jacques Le Roux" <ja...@les7arts.com>
> Ha... also I wanted to internationalize the service (when they are no products).
> I will do it for country/states also...
>
> Jacques
>
> From: "Jacques Le Roux" <ja...@les7arts.com>
>> Thanks Anil,
>>
>> I will consider your work, and I even wonder, now that we want to embedd/replace by jQuery, if we should not do it there (I mean
>> in the jQuery branch)
>>
>> For now I have commited a 1st phase at revision: 959951. It already usable without too much work even if all in not completly in
>> place (due to the fact that, AFAIK, we don't use category/products dependent dropdowns in OFBiz... yet...)
>>
>> Thanks also to Scott, our scrutinizer! (yes, I learned this word from Zappa's Joe Garage, a long time ago :o)
>>
>> Jacques
>>
>> From: "Anil Patel" <an...@hotwaxmedia.com>
>>>I have complete something similar using javascript. Here is good description and example
>>>
>>> http://www.hotwaxmedia.com/apache-ofbiz-blog/ofbiz-tutorial-dependent-selects-for-prototype/
>>>
>>> I am using it for Country/State lists.
>>>
>>>
>>> Thanks and Regards
>>> Anil Patel
>>> HotWax Media Inc
>>> Find us on the web at www.hotwaxmedia.com or Google Keyword "ofbiz"
>>>
>>> On Jul 1, 2010, at 7:47 PM, Jacques Le Roux wrote:
>>>
>>>> To be clear, I'd like to introduce a dependent dropdows mechanism in widgets.
>>>> I'm quite sure it's not easy, not sure it's even feasible at this stage...
>>>>
>>>> Jacques
>>>>
>>>> From: <jl...@apache.org>
>>>>> Author: jleroux
>>>>> Date: Thu Jul 1 14:05:21 2010
>>>>> New Revision: 959673
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=959673&view=rev
>>>>> Log:
>>>>> Adds a getAssociatedProductsList method. I will certainly add the companions service and request later in the Product
>>>>> application.
>>>>> I have also the vague desire to generalize this more, as I have been able to quickly use it in a widget form following the
>>>>> Freemarker way already used.
>>>>>
>>>>> Modified:
>>>>> ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
>>>>>
>>>>> Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=959673&r1=959672&r2=959673&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java (original)
>>>>> +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Thu Jul 1 14:05:21 2010
>>>>> @@ -33,6 +33,7 @@ import org.ofbiz.entity.GenericValue;
>>>>> import org.ofbiz.entity.condition.EntityCondition;
>>>>> import org.ofbiz.entity.condition.EntityExpr;
>>>>> import org.ofbiz.entity.condition.EntityOperator;
>>>>> +import org.ofbiz.entity.util.EntityUtil;
>>>>>
>>>>> /**
>>>>> * Common Workers
>>>>> @@ -135,6 +136,35 @@ public class CommonWorkers {
>>>>> return geoList;
>>>>> }
>>>>>
>>>>> + public static List<GenericValue> getAssociatedProductsList(Delegator delegator, String productCategoryId) {
>>>>> + return getAssociatedProductsList(delegator, productCategoryId, null);
>>>>> + }
>>>>> +
>>>>> + /**
>>>>> + * Returns a list of active related products for a product category
>>>>> + */
>>>>> + public static List<GenericValue> getAssociatedProductsList(Delegator delegator, String productCategoryId, String
>>>>> listOrderBy)
>>>>> {
>>>>> + List<GenericValue> products = FastList.newInstance();
>>>>> + if (UtilValidate.isNotEmpty(productCategoryId)) {
>>>>> + EntityCondition productsFindCond = EntityCondition.makeCondition(
>>>>> + EntityCondition.makeCondition("productCategoryId", productCategoryId));
>>>>> +
>>>>> + if (UtilValidate.isEmpty(listOrderBy)) {
>>>>> + listOrderBy = "sequenceNum";
>>>>> + }
>>>>> + List<String> sortList = UtilMisc.toList(listOrderBy);
>>>>> +
>>>>> + try {
>>>>> + products = delegator.findList("ProductCategoryMember", productsFindCond, null, sortList, null, true);
>>>>> + products = EntityUtil.filterByDate(products);
>>>>> + } catch (GenericEntityException e) {
>>>>> + Debug.logError(e, "Cannot lookup ProductCategoryMember", module);
>>>>> + }
>>>>> + }
>>>>> +
>>>>> + return products;
>>>>> + }
>>>>> +
>>>>> /**
>>>>> * A generic method to be used on Type enities, e.g. ProductType. Recurse to the root level in the type hierarchy
>>>>> * and checks if the specified type childType has parentType as its parent somewhere in the hierarchy.
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Re: svn commit: r959673 - /ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
Posted by Jacques Le Roux <ja...@les7arts.com>.
Ha... also I wanted to internationalize the service (when they are no products).
I will do it for country/states also...
Jacques
From: "Jacques Le Roux" <ja...@les7arts.com>
> Thanks Anil,
>
> I will consider your work, and I even wonder, now that we want to embedd/replace by jQuery, if we should not do it there (I mean
> in the jQuery branch)
>
> For now I have commited a 1st phase at revision: 959951. It already usable without too much work even if all in not completly in
> place (due to the fact that, AFAIK, we don't use category/products dependent dropdowns in OFBiz... yet...)
>
> Thanks also to Scott, our scrutinizer! (yes, I learned this word from Zappa's Joe Garage, a long time ago :o)
>
> Jacques
>
> From: "Anil Patel" <an...@hotwaxmedia.com>
>>I have complete something similar using javascript. Here is good description and example
>>
>> http://www.hotwaxmedia.com/apache-ofbiz-blog/ofbiz-tutorial-dependent-selects-for-prototype/
>>
>> I am using it for Country/State lists.
>>
>>
>> Thanks and Regards
>> Anil Patel
>> HotWax Media Inc
>> Find us on the web at www.hotwaxmedia.com or Google Keyword "ofbiz"
>>
>> On Jul 1, 2010, at 7:47 PM, Jacques Le Roux wrote:
>>
>>> To be clear, I'd like to introduce a dependent dropdows mechanism in widgets.
>>> I'm quite sure it's not easy, not sure it's even feasible at this stage...
>>>
>>> Jacques
>>>
>>> From: <jl...@apache.org>
>>>> Author: jleroux
>>>> Date: Thu Jul 1 14:05:21 2010
>>>> New Revision: 959673
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=959673&view=rev
>>>> Log:
>>>> Adds a getAssociatedProductsList method. I will certainly add the companions service and request later in the Product
>>>> application.
>>>> I have also the vague desire to generalize this more, as I have been able to quickly use it in a widget form following the
>>>> Freemarker way already used.
>>>>
>>>> Modified:
>>>> ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
>>>>
>>>> Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=959673&r1=959672&r2=959673&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java (original)
>>>> +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Thu Jul 1 14:05:21 2010
>>>> @@ -33,6 +33,7 @@ import org.ofbiz.entity.GenericValue;
>>>> import org.ofbiz.entity.condition.EntityCondition;
>>>> import org.ofbiz.entity.condition.EntityExpr;
>>>> import org.ofbiz.entity.condition.EntityOperator;
>>>> +import org.ofbiz.entity.util.EntityUtil;
>>>>
>>>> /**
>>>> * Common Workers
>>>> @@ -135,6 +136,35 @@ public class CommonWorkers {
>>>> return geoList;
>>>> }
>>>>
>>>> + public static List<GenericValue> getAssociatedProductsList(Delegator delegator, String productCategoryId) {
>>>> + return getAssociatedProductsList(delegator, productCategoryId, null);
>>>> + }
>>>> +
>>>> + /**
>>>> + * Returns a list of active related products for a product category
>>>> + */
>>>> + public static List<GenericValue> getAssociatedProductsList(Delegator delegator, String productCategoryId, String
>>>> listOrderBy)
>>>> {
>>>> + List<GenericValue> products = FastList.newInstance();
>>>> + if (UtilValidate.isNotEmpty(productCategoryId)) {
>>>> + EntityCondition productsFindCond = EntityCondition.makeCondition(
>>>> + EntityCondition.makeCondition("productCategoryId", productCategoryId));
>>>> +
>>>> + if (UtilValidate.isEmpty(listOrderBy)) {
>>>> + listOrderBy = "sequenceNum";
>>>> + }
>>>> + List<String> sortList = UtilMisc.toList(listOrderBy);
>>>> +
>>>> + try {
>>>> + products = delegator.findList("ProductCategoryMember", productsFindCond, null, sortList, null, true);
>>>> + products = EntityUtil.filterByDate(products);
>>>> + } catch (GenericEntityException e) {
>>>> + Debug.logError(e, "Cannot lookup ProductCategoryMember", module);
>>>> + }
>>>> + }
>>>> +
>>>> + return products;
>>>> + }
>>>> +
>>>> /**
>>>> * A generic method to be used on Type enities, e.g. ProductType. Recurse to the root level in the type hierarchy
>>>> * and checks if the specified type childType has parentType as its parent somewhere in the hierarchy.
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Re: svn commit: r959673 - /ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Anil,
I will consider your work, and I even wonder, now that we want to embedd/replace by jQuery, if we should not do it there (I mean in
the jQuery branch)
For now I have commited a 1st phase at revision: 959951. It already usable without too much work even if all in not completly in
place (due to the fact that, AFAIK, we don't use category/products dependent dropdowns in OFBiz... yet...)
Thanks also to Scott, our scrutinizer! (yes, I learned this word from Zappa's Joe Garage, a long time ago :o)
Jacques
From: "Anil Patel" <an...@hotwaxmedia.com>
>I have complete something similar using javascript. Here is good description and example
>
> http://www.hotwaxmedia.com/apache-ofbiz-blog/ofbiz-tutorial-dependent-selects-for-prototype/
>
> I am using it for Country/State lists.
>
>
> Thanks and Regards
> Anil Patel
> HotWax Media Inc
> Find us on the web at www.hotwaxmedia.com or Google Keyword "ofbiz"
>
> On Jul 1, 2010, at 7:47 PM, Jacques Le Roux wrote:
>
>> To be clear, I'd like to introduce a dependent dropdows mechanism in widgets.
>> I'm quite sure it's not easy, not sure it's even feasible at this stage...
>>
>> Jacques
>>
>> From: <jl...@apache.org>
>>> Author: jleroux
>>> Date: Thu Jul 1 14:05:21 2010
>>> New Revision: 959673
>>>
>>> URL: http://svn.apache.org/viewvc?rev=959673&view=rev
>>> Log:
>>> Adds a getAssociatedProductsList method. I will certainly add the companions service and request later in the Product
>>> application.
>>> I have also the vague desire to generalize this more, as I have been able to quickly use it in a widget form following the
>>> Freemarker way already used.
>>>
>>> Modified:
>>> ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
>>>
>>> Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=959673&r1=959672&r2=959673&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java (original)
>>> +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Thu Jul 1 14:05:21 2010
>>> @@ -33,6 +33,7 @@ import org.ofbiz.entity.GenericValue;
>>> import org.ofbiz.entity.condition.EntityCondition;
>>> import org.ofbiz.entity.condition.EntityExpr;
>>> import org.ofbiz.entity.condition.EntityOperator;
>>> +import org.ofbiz.entity.util.EntityUtil;
>>>
>>> /**
>>> * Common Workers
>>> @@ -135,6 +136,35 @@ public class CommonWorkers {
>>> return geoList;
>>> }
>>>
>>> + public static List<GenericValue> getAssociatedProductsList(Delegator delegator, String productCategoryId) {
>>> + return getAssociatedProductsList(delegator, productCategoryId, null);
>>> + }
>>> +
>>> + /**
>>> + * Returns a list of active related products for a product category
>>> + */
>>> + public static List<GenericValue> getAssociatedProductsList(Delegator delegator, String productCategoryId, String
>>> listOrderBy)
>>> {
>>> + List<GenericValue> products = FastList.newInstance();
>>> + if (UtilValidate.isNotEmpty(productCategoryId)) {
>>> + EntityCondition productsFindCond = EntityCondition.makeCondition(
>>> + EntityCondition.makeCondition("productCategoryId", productCategoryId));
>>> +
>>> + if (UtilValidate.isEmpty(listOrderBy)) {
>>> + listOrderBy = "sequenceNum";
>>> + }
>>> + List<String> sortList = UtilMisc.toList(listOrderBy);
>>> +
>>> + try {
>>> + products = delegator.findList("ProductCategoryMember", productsFindCond, null, sortList, null, true);
>>> + products = EntityUtil.filterByDate(products);
>>> + } catch (GenericEntityException e) {
>>> + Debug.logError(e, "Cannot lookup ProductCategoryMember", module);
>>> + }
>>> + }
>>> +
>>> + return products;
>>> + }
>>> +
>>> /**
>>> * A generic method to be used on Type enities, e.g. ProductType. Recurse to the root level in the type hierarchy
>>> * and checks if the specified type childType has parentType as its parent somewhere in the hierarchy.
>>>
>>>
>>
>>
>
>
Re: svn commit: r959673 - /ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
Posted by Anil Patel <an...@hotwaxmedia.com>.
I have complete something similar using javascript. Here is good description and example
http://www.hotwaxmedia.com/apache-ofbiz-blog/ofbiz-tutorial-dependent-selects-for-prototype/
I am using it for Country/State lists.
Thanks and Regards
Anil Patel
HotWax Media Inc
Find us on the web at www.hotwaxmedia.com or Google Keyword "ofbiz"
On Jul 1, 2010, at 7:47 PM, Jacques Le Roux wrote:
> To be clear, I'd like to introduce a dependent dropdows mechanism in widgets.
> I'm quite sure it's not easy, not sure it's even feasible at this stage...
>
> Jacques
>
> From: <jl...@apache.org>
>> Author: jleroux
>> Date: Thu Jul 1 14:05:21 2010
>> New Revision: 959673
>>
>> URL: http://svn.apache.org/viewvc?rev=959673&view=rev
>> Log:
>> Adds a getAssociatedProductsList method. I will certainly add the companions service and request later in the Product application.
>> I have also the vague desire to generalize this more, as I have been able to quickly use it in a widget form following the
>> Freemarker way already used.
>>
>> Modified:
>> ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
>>
>> Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=959673&r1=959672&r2=959673&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java (original)
>> +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Thu Jul 1 14:05:21 2010
>> @@ -33,6 +33,7 @@ import org.ofbiz.entity.GenericValue;
>> import org.ofbiz.entity.condition.EntityCondition;
>> import org.ofbiz.entity.condition.EntityExpr;
>> import org.ofbiz.entity.condition.EntityOperator;
>> +import org.ofbiz.entity.util.EntityUtil;
>>
>> /**
>> * Common Workers
>> @@ -135,6 +136,35 @@ public class CommonWorkers {
>> return geoList;
>> }
>>
>> + public static List<GenericValue> getAssociatedProductsList(Delegator delegator, String productCategoryId) {
>> + return getAssociatedProductsList(delegator, productCategoryId, null);
>> + }
>> +
>> + /**
>> + * Returns a list of active related products for a product category
>> + */
>> + public static List<GenericValue> getAssociatedProductsList(Delegator delegator, String productCategoryId, String listOrderBy)
>> {
>> + List<GenericValue> products = FastList.newInstance();
>> + if (UtilValidate.isNotEmpty(productCategoryId)) {
>> + EntityCondition productsFindCond = EntityCondition.makeCondition(
>> + EntityCondition.makeCondition("productCategoryId", productCategoryId));
>> +
>> + if (UtilValidate.isEmpty(listOrderBy)) {
>> + listOrderBy = "sequenceNum";
>> + }
>> + List<String> sortList = UtilMisc.toList(listOrderBy);
>> +
>> + try {
>> + products = delegator.findList("ProductCategoryMember", productsFindCond, null, sortList, null, true);
>> + products = EntityUtil.filterByDate(products);
>> + } catch (GenericEntityException e) {
>> + Debug.logError(e, "Cannot lookup ProductCategoryMember", module);
>> + }
>> + }
>> +
>> + return products;
>> + }
>> +
>> /**
>> * A generic method to be used on Type enities, e.g. ProductType. Recurse to the root level in the type hierarchy
>> * and checks if the specified type childType has parentType as its parent somewhere in the hierarchy.
>>
>>
>
>