You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Vikas Mayur <vi...@gmail.com> on 2012/04/03 17:10:09 UTC
Re: svn commit: r1307836 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java build.xml
Hi Erwan,
Isn't it a good practice to commit the indentation changes separately, since its just a one line change? Secondly, the changes in the build file seems unrelated?
Regards
Vikas
On Mar 31, 2012, at 9:15 PM, erwan@apache.org wrote:
> Author: erwan
> Date: Sat Mar 31 15:45:12 2012
> New Revision: 1307836
>
> URL: http://svn.apache.org/viewvc?rev=1307836&view=rev
> Log:
> no functional change: removing an array of 1 element
>
> Modified:
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
> ofbiz/trunk/build.xml
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java?rev=1307836&r1=1307835&r2=1307836&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java Sat Mar 31 15:45:12 2012
> @@ -168,42 +168,37 @@ public class ProductDisplayWorker {
> // keep track of how many times a product occurs in order to find averages and rank by purchase amount
> productOccurances = new HashMap<String, Integer>();
>
> - // get all order role entities for user by customer role type
> - // final String[] USER_ORDER_ROLE_TYPES = {"END_USER_CUSTOMER", "SHIP_TO_CUSTOMER", "BILL_TO_CUSTOMER", "PLACING_CUSTOMER"};
> - final String[] USER_ORDER_ROLE_TYPES = {"PLACING_CUSTOMER"};
> -
> - for (int i = 0; i < USER_ORDER_ROLE_TYPES.length; i++) {
> - List<GenericValue> orderRoles = delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", USER_ORDER_ROLE_TYPES[i]), null);
> - Iterator<GenericValue> ordersIter = UtilMisc.toIterator(orderRoles);
> -
> - while (ordersIter != null && ordersIter.hasNext()) {
> - GenericValue orderRole = ordersIter.next();
> - // for each order role get all order items
> - List<GenericValue> orderItems = orderRole.getRelated("OrderItem");
> - Iterator<GenericValue> orderItemsIter = UtilMisc.toIterator(orderItems);
> -
> - while (orderItemsIter != null && orderItemsIter.hasNext()) {
> - GenericValue orderItem = orderItemsIter.next();
> - String productId = orderItem.getString("productId");
> - if (UtilValidate.isNotEmpty(productId)) {
> - // for each order item get the associated product
> - GenericValue product = orderItem.getRelatedOneCache("Product");
> -
> - products.put(product.getString("productId"), product);
> -
> - BigDecimal curQuant = productQuantities.get(product.get("productId"));
> -
> - if (curQuant == null) curQuant = BigDecimal.ZERO;
> - BigDecimal orderQuant = orderItem.getBigDecimal("quantity");
> -
> - if (orderQuant == null) orderQuant = BigDecimal.ZERO;
> - productQuantities.put(product.getString("productId"), curQuant.add(orderQuant));
> -
> - Integer curOcc = productOccurances.get(product.get("productId"));
> -
> - if (curOcc == null) curOcc = Integer.valueOf(0);
> - productOccurances.put(product.getString("productId"), Integer.valueOf(curOcc.intValue() + 1));
> - }
> + // get all order role entities for user by customer role type : PLACING_CUSTOMER
> + List<GenericValue> orderRoles = delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", "PLACING_CUSTOMER"), null);
> + Iterator<GenericValue> ordersIter = UtilMisc.toIterator(orderRoles);
> +
> + while (ordersIter != null && ordersIter.hasNext()) {
> + GenericValue orderRole = ordersIter.next();
> + // for each order role get all order items
> + List<GenericValue> orderItems = orderRole.getRelated("OrderItem");
> + Iterator<GenericValue> orderItemsIter = UtilMisc.toIterator(orderItems);
> +
> + while (orderItemsIter != null && orderItemsIter.hasNext()) {
> + GenericValue orderItem = orderItemsIter.next();
> + String productId = orderItem.getString("productId");
> + if (UtilValidate.isNotEmpty(productId)) {
> + // for each order item get the associated product
> + GenericValue product = orderItem.getRelatedOneCache("Product");
> +
> + products.put(product.getString("productId"), product);
> +
> + BigDecimal curQuant = productQuantities.get(product.get("productId"));
> +
> + if (curQuant == null) curQuant = BigDecimal.ZERO;
> + BigDecimal orderQuant = orderItem.getBigDecimal("quantity");
> +
> + if (orderQuant == null) orderQuant = BigDecimal.ZERO;
> + productQuantities.put(product.getString("productId"), curQuant.add(orderQuant));
> +
> + Integer curOcc = productOccurances.get(product.get("productId"));
> +
> + if (curOcc == null) curOcc = Integer.valueOf(0);
> + productOccurances.put(product.getString("productId"), Integer.valueOf(curOcc.intValue() + 1));
> }
> }
> }
>
> Modified: ofbiz/trunk/build.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.xml?rev=1307836&r1=1307835&r2=1307836&view=diff
> ==============================================================================
> --- ofbiz/trunk/build.xml (original)
> +++ ofbiz/trunk/build.xml Sat Mar 31 15:45:12 2012
> @@ -1056,14 +1056,8 @@ under the License.
> <property name="sonar.cobertura.reportPath" value="runtime/logs/cobertura-report/coverage.xml"/>
> <property name="sonar.java.source" value="1.6" />
> <property name="sonar.java.target" value="1.6" />
> - <property name="sonar.jdbc.url"
> - value="jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8" />
> - <property name="sonar.jdbc.driverClassName" value="com.mysql.jdbc.Driver" />
> - <property name="sonar.jdbc.username" value="${sonar.jdbc.username}" />
> - <property name="sonar.jdbc.password" value="${sonar.jdbc.password}" />
>
> <!-- SERVER ON A REMOTE HOST -->
> - <property name="sonar.host.url" value="${sonar.host.url}" />
> </target>
>
> <target name="full-sonar">
>
>
Re: svn commit: r1307836 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java build.xml
Posted by Vikas Mayur <vi...@gmail.com>.
Thanks Erwan, I think it is easier for code review etc. if the changes are done separately.
Regards
Vikas
On Apr 3, 2012, at 8:45 PM, Erwan de FERRIERES wrote:
> Hi Vikas,
>
> thanks for the build.xml file. This is unrelated and should have not
> been committed.I'll work on it soon.
> For the indentation, I removed a loop, so the formating changes are
> coming with it.
>
> Regards,
>
> 2012/4/3 Vikas Mayur <vi...@gmail.com>:
>> Hi Erwan,
>>
>> Isn't it a good practice to commit the indentation changes separately, since its just a one line change? Secondly, the changes in the build file seems unrelated?
>>
>> Regards
>> Vikas
>>
>> On Mar 31, 2012, at 9:15 PM, erwan@apache.org wrote:
>>
>>> Author: erwan
>>> Date: Sat Mar 31 15:45:12 2012
>>> New Revision: 1307836
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1307836&view=rev
>>> Log:
>>> no functional change: removing an array of 1 element
>>>
>>> Modified:
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
>>> ofbiz/trunk/build.xml
>>>
>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java?rev=1307836&r1=1307835&r2=1307836&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java (original)
>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java Sat Mar 31 15:45:12 2012
>>> @@ -168,42 +168,37 @@ public class ProductDisplayWorker {
>>> // keep track of how many times a product occurs in order to find averages and rank by purchase amount
>>> productOccurances = new HashMap<String, Integer>();
>>>
>>> - // get all order role entities for user by customer role type
>>> - // final String[] USER_ORDER_ROLE_TYPES = {"END_USER_CUSTOMER", "SHIP_TO_CUSTOMER", "BILL_TO_CUSTOMER", "PLACING_CUSTOMER"};
>>> - final String[] USER_ORDER_ROLE_TYPES = {"PLACING_CUSTOMER"};
>>> -
>>> - for (int i = 0; i < USER_ORDER_ROLE_TYPES.length; i++) {
>>> - List<GenericValue> orderRoles = delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", USER_ORDER_ROLE_TYPES[i]), null);
>>> - Iterator<GenericValue> ordersIter = UtilMisc.toIterator(orderRoles);
>>> -
>>> - while (ordersIter != null && ordersIter.hasNext()) {
>>> - GenericValue orderRole = ordersIter.next();
>>> - // for each order role get all order items
>>> - List<GenericValue> orderItems = orderRole.getRelated("OrderItem");
>>> - Iterator<GenericValue> orderItemsIter = UtilMisc.toIterator(orderItems);
>>> -
>>> - while (orderItemsIter != null && orderItemsIter.hasNext()) {
>>> - GenericValue orderItem = orderItemsIter.next();
>>> - String productId = orderItem.getString("productId");
>>> - if (UtilValidate.isNotEmpty(productId)) {
>>> - // for each order item get the associated product
>>> - GenericValue product = orderItem.getRelatedOneCache("Product");
>>> -
>>> - products.put(product.getString("productId"), product);
>>> -
>>> - BigDecimal curQuant = productQuantities.get(product.get("productId"));
>>> -
>>> - if (curQuant == null) curQuant = BigDecimal.ZERO;
>>> - BigDecimal orderQuant = orderItem.getBigDecimal("quantity");
>>> -
>>> - if (orderQuant == null) orderQuant = BigDecimal.ZERO;
>>> - productQuantities.put(product.getString("productId"), curQuant.add(orderQuant));
>>> -
>>> - Integer curOcc = productOccurances.get(product.get("productId"));
>>> -
>>> - if (curOcc == null) curOcc = Integer.valueOf(0);
>>> - productOccurances.put(product.getString("productId"), Integer.valueOf(curOcc.intValue() + 1));
>>> - }
>>> + // get all order role entities for user by customer role type : PLACING_CUSTOMER
>>> + List<GenericValue> orderRoles = delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", "PLACING_CUSTOMER"), null);
>>> + Iterator<GenericValue> ordersIter = UtilMisc.toIterator(orderRoles);
>>> +
>>> + while (ordersIter != null && ordersIter.hasNext()) {
>>> + GenericValue orderRole = ordersIter.next();
>>> + // for each order role get all order items
>>> + List<GenericValue> orderItems = orderRole.getRelated("OrderItem");
>>> + Iterator<GenericValue> orderItemsIter = UtilMisc.toIterator(orderItems);
>>> +
>>> + while (orderItemsIter != null && orderItemsIter.hasNext()) {
>>> + GenericValue orderItem = orderItemsIter.next();
>>> + String productId = orderItem.getString("productId");
>>> + if (UtilValidate.isNotEmpty(productId)) {
>>> + // for each order item get the associated product
>>> + GenericValue product = orderItem.getRelatedOneCache("Product");
>>> +
>>> + products.put(product.getString("productId"), product);
>>> +
>>> + BigDecimal curQuant = productQuantities.get(product.get("productId"));
>>> +
>>> + if (curQuant == null) curQuant = BigDecimal.ZERO;
>>> + BigDecimal orderQuant = orderItem.getBigDecimal("quantity");
>>> +
>>> + if (orderQuant == null) orderQuant = BigDecimal.ZERO;
>>> + productQuantities.put(product.getString("productId"), curQuant.add(orderQuant));
>>> +
>>> + Integer curOcc = productOccurances.get(product.get("productId"));
>>> +
>>> + if (curOcc == null) curOcc = Integer.valueOf(0);
>>> + productOccurances.put(product.getString("productId"), Integer.valueOf(curOcc.intValue() + 1));
>>> }
>>> }
>>> }
>>>
>>> Modified: ofbiz/trunk/build.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.xml?rev=1307836&r1=1307835&r2=1307836&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/build.xml (original)
>>> +++ ofbiz/trunk/build.xml Sat Mar 31 15:45:12 2012
>>> @@ -1056,14 +1056,8 @@ under the License.
>>> <property name="sonar.cobertura.reportPath" value="runtime/logs/cobertura-report/coverage.xml"/>
>>> <property name="sonar.java.source" value="1.6" />
>>> <property name="sonar.java.target" value="1.6" />
>>> - <property name="sonar.jdbc.url"
>>> - value="jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8" />
>>> - <property name="sonar.jdbc.driverClassName" value="com.mysql.jdbc.Driver" />
>>> - <property name="sonar.jdbc.username" value="${sonar.jdbc.username}" />
>>> - <property name="sonar.jdbc.password" value="${sonar.jdbc.password}" />
>>>
>>> <!-- SERVER ON A REMOTE HOST -->
>>> - <property name="sonar.host.url" value="${sonar.host.url}" />
>>> </target>
>>>
>>> <target name="full-sonar">
>>>
>>>
>>
>
>
>
> --
> Erwan de FERRIERES
Re: svn commit: r1307836 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
build.xml
Posted by Erwan de FERRIERES <er...@gmail.com>.
Hi Vikas,
thanks for the build.xml file. This is unrelated and should have not
been committed.I'll work on it soon.
For the indentation, I removed a loop, so the formating changes are
coming with it.
Regards,
2012/4/3 Vikas Mayur <vi...@gmail.com>:
> Hi Erwan,
>
> Isn't it a good practice to commit the indentation changes separately, since its just a one line change? Secondly, the changes in the build file seems unrelated?
>
> Regards
> Vikas
>
> On Mar 31, 2012, at 9:15 PM, erwan@apache.org wrote:
>
>> Author: erwan
>> Date: Sat Mar 31 15:45:12 2012
>> New Revision: 1307836
>>
>> URL: http://svn.apache.org/viewvc?rev=1307836&view=rev
>> Log:
>> no functional change: removing an array of 1 element
>>
>> Modified:
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
>> ofbiz/trunk/build.xml
>>
>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java?rev=1307836&r1=1307835&r2=1307836&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java (original)
>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java Sat Mar 31 15:45:12 2012
>> @@ -168,42 +168,37 @@ public class ProductDisplayWorker {
>> // keep track of how many times a product occurs in order to find averages and rank by purchase amount
>> productOccurances = new HashMap<String, Integer>();
>>
>> - // get all order role entities for user by customer role type
>> - // final String[] USER_ORDER_ROLE_TYPES = {"END_USER_CUSTOMER", "SHIP_TO_CUSTOMER", "BILL_TO_CUSTOMER", "PLACING_CUSTOMER"};
>> - final String[] USER_ORDER_ROLE_TYPES = {"PLACING_CUSTOMER"};
>> -
>> - for (int i = 0; i < USER_ORDER_ROLE_TYPES.length; i++) {
>> - List<GenericValue> orderRoles = delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", USER_ORDER_ROLE_TYPES[i]), null);
>> - Iterator<GenericValue> ordersIter = UtilMisc.toIterator(orderRoles);
>> -
>> - while (ordersIter != null && ordersIter.hasNext()) {
>> - GenericValue orderRole = ordersIter.next();
>> - // for each order role get all order items
>> - List<GenericValue> orderItems = orderRole.getRelated("OrderItem");
>> - Iterator<GenericValue> orderItemsIter = UtilMisc.toIterator(orderItems);
>> -
>> - while (orderItemsIter != null && orderItemsIter.hasNext()) {
>> - GenericValue orderItem = orderItemsIter.next();
>> - String productId = orderItem.getString("productId");
>> - if (UtilValidate.isNotEmpty(productId)) {
>> - // for each order item get the associated product
>> - GenericValue product = orderItem.getRelatedOneCache("Product");
>> -
>> - products.put(product.getString("productId"), product);
>> -
>> - BigDecimal curQuant = productQuantities.get(product.get("productId"));
>> -
>> - if (curQuant == null) curQuant = BigDecimal.ZERO;
>> - BigDecimal orderQuant = orderItem.getBigDecimal("quantity");
>> -
>> - if (orderQuant == null) orderQuant = BigDecimal.ZERO;
>> - productQuantities.put(product.getString("productId"), curQuant.add(orderQuant));
>> -
>> - Integer curOcc = productOccurances.get(product.get("productId"));
>> -
>> - if (curOcc == null) curOcc = Integer.valueOf(0);
>> - productOccurances.put(product.getString("productId"), Integer.valueOf(curOcc.intValue() + 1));
>> - }
>> + // get all order role entities for user by customer role type : PLACING_CUSTOMER
>> + List<GenericValue> orderRoles = delegator.findByAnd("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", "PLACING_CUSTOMER"), null);
>> + Iterator<GenericValue> ordersIter = UtilMisc.toIterator(orderRoles);
>> +
>> + while (ordersIter != null && ordersIter.hasNext()) {
>> + GenericValue orderRole = ordersIter.next();
>> + // for each order role get all order items
>> + List<GenericValue> orderItems = orderRole.getRelated("OrderItem");
>> + Iterator<GenericValue> orderItemsIter = UtilMisc.toIterator(orderItems);
>> +
>> + while (orderItemsIter != null && orderItemsIter.hasNext()) {
>> + GenericValue orderItem = orderItemsIter.next();
>> + String productId = orderItem.getString("productId");
>> + if (UtilValidate.isNotEmpty(productId)) {
>> + // for each order item get the associated product
>> + GenericValue product = orderItem.getRelatedOneCache("Product");
>> +
>> + products.put(product.getString("productId"), product);
>> +
>> + BigDecimal curQuant = productQuantities.get(product.get("productId"));
>> +
>> + if (curQuant == null) curQuant = BigDecimal.ZERO;
>> + BigDecimal orderQuant = orderItem.getBigDecimal("quantity");
>> +
>> + if (orderQuant == null) orderQuant = BigDecimal.ZERO;
>> + productQuantities.put(product.getString("productId"), curQuant.add(orderQuant));
>> +
>> + Integer curOcc = productOccurances.get(product.get("productId"));
>> +
>> + if (curOcc == null) curOcc = Integer.valueOf(0);
>> + productOccurances.put(product.getString("productId"), Integer.valueOf(curOcc.intValue() + 1));
>> }
>> }
>> }
>>
>> Modified: ofbiz/trunk/build.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.xml?rev=1307836&r1=1307835&r2=1307836&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/build.xml (original)
>> +++ ofbiz/trunk/build.xml Sat Mar 31 15:45:12 2012
>> @@ -1056,14 +1056,8 @@ under the License.
>> <property name="sonar.cobertura.reportPath" value="runtime/logs/cobertura-report/coverage.xml"/>
>> <property name="sonar.java.source" value="1.6" />
>> <property name="sonar.java.target" value="1.6" />
>> - <property name="sonar.jdbc.url"
>> - value="jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8" />
>> - <property name="sonar.jdbc.driverClassName" value="com.mysql.jdbc.Driver" />
>> - <property name="sonar.jdbc.username" value="${sonar.jdbc.username}" />
>> - <property name="sonar.jdbc.password" value="${sonar.jdbc.password}" />
>>
>> <!-- SERVER ON A REMOTE HOST -->
>> - <property name="sonar.host.url" value="${sonar.host.url}" />
>> </target>
>>
>> <target name="full-sonar">
>>
>>
>
--
Erwan de FERRIERES