Forwarding an email that I sent yesterday and seems to be lost in the net.
Jacopo
---------- Forwarded message ----------
From: Jacopo Cappellato <
[hidden email]>
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:
[hidden email]
Cc:
[hidden email]
On Wed, Mar 22, 2017 at 9:26 AM, <
[hidden email]> 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