Hi Jacopo,

Thanks for you review, this is indeed a good idea. I'll revisit related changes

Jacques


Le 23/03/2017 à 09:03, Jacopo Cappellato a écrit :
Forwarding an email that I sent yesterday and seems to be lost in the net.

Jacopo

---------- Forwarded message ----------
From: Jacopo Cappellato <[email protected]>
Date: Wed, Mar 22, 2017 at 10:00 AM
Subject: Re: svn commit: r1788065 - in
/ofbiz/ofbiz-framework/trunk/applications:
accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
To: [email protected]
Cc: [email protected]


On Wed, Mar 22, 2017 at 9:26 AM, <[email protected]> wrote:

...
+        try (EntityListIterator eli = EntityQuery.use(delegator)
+                .from("OrderPaymentPreference")
+                .where(EntityCondition.makeCondition("statusId",
EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"),
                              EntityCondition.
makeCondition("processAttempt", EntityOperator.GREATER_THAN,
Long.valueOf(0)))
-                    .orderBy("orderId").queryIterator()) {
+                .orderBy("orderId")
+                .queryIterator()) {
+

With code like the above, I think that embedding everything in the try
clause makes the code a bit less readable.
One option would be to split the entity query code in two lines:

EntityQuery eq = EntityQuery.use(delegator)
                 .from("OrderPaymentPreference")
                 .where(EntityCondition.makeCondition("statusId",
EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"),
                              EntityCondition.makeCondition("processAttempt",
EntityOperator.GREATER_THAN, Long.valueOf(0)))
                 .orderBy("orderId");

try (EntityListIterator eli = eq.queryIterator()) {
...

Jacopo


Reply via email to