Author: lektran Date: Fri Oct 10 20:30:18 2014 New Revision: 1630979 URL: http://svn.apache.org/r1630979 Log: Make use of EntityQuery.where(EntityCondition...)
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?rev=1630979&r1=1630978&r2=1630979&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java Fri Oct 10 20:30:18 2014 @@ -903,12 +903,11 @@ public class FinAccountPaymentServices { GenericValue trans = null; try { trans = EntityQuery.use(delegator).from("FinAccountTrans") - .where(UtilMisc.toList( + .where( EntityCondition.makeCondition("finAccountTransTypeId", EntityOperator.EQUALS, "DEPOSIT"), EntityCondition.makeCondition("finAccountId", EntityOperator.EQUALS, finAccountId), EntityCondition.makeCondition("orderId", EntityOperator.NOT_EQUAL, null) - )) - .orderBy("-transactionDate").queryFirst(); + ).orderBy("-transactionDate").queryFirst(); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=1630979&r1=1630978&r2=1630979&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Fri Oct 10 20:30:18 2014 @@ -761,10 +761,9 @@ public class InvoiceServices { // check for previous order payments List<GenericValue> orderPaymentPrefs = EntityQuery.use(delegator).from("OrderPaymentPreference") - .where(UtilMisc.<EntityCondition>toList( - EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId), + .where(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED") - )).queryList(); + ).queryList(); List<GenericValue> currentPayments = FastList.newInstance(); for (GenericValue paymentPref : orderPaymentPrefs) { List<GenericValue> payments = paymentPref.getRelated("Payment", null, null, false); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java?rev=1630979&r1=1630978&r2=1630979&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java Fri Oct 10 20:30:18 2014 @@ -654,9 +654,8 @@ public class InvoiceWorker { try { Delegator delegator = invoice.getDelegator(); invoiceTaxItems = EntityQuery.use(delegator).from("InvoiceItem") - .where(UtilMisc.<EntityCondition>toList( - EntityCondition.makeCondition("invoiceId", invoice.getString("invoiceId")), - EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator))) + .where(EntityCondition.makeCondition("invoiceId", invoice.getString("invoiceId")), + EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator)) ).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting InvoiceItem list", module); @@ -692,11 +691,10 @@ public class InvoiceWorker { try { Delegator delegator = invoice.getDelegator(); invoiceTaxItems = EntityQuery.use(delegator).from("InvoiceItem") - .where(UtilMisc.toList( - EntityCondition.makeCondition("invoiceId", invoice.getString("invoiceId")), + .where(EntityCondition.makeCondition("invoiceId", invoice.getString("invoiceId")), EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator)), EntityCondition.makeCondition("taxAuthPartyId", taxAuthPartyId), - EntityCondition.makeCondition("taxAuthGeoId", taxAuthGeoId)) + EntityCondition.makeCondition("taxAuthGeoId", taxAuthGeoId) ).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting InvoiceItem list", module); @@ -714,11 +712,10 @@ public class InvoiceWorker { try { Delegator delegator = invoice.getDelegator(); invoiceTaxItems = EntityQuery.use(delegator).from("InvoiceItem") - .where(UtilMisc.toList( - EntityCondition.makeCondition("invoiceId", invoice.get("invoiceId")), + .where(EntityCondition.makeCondition("invoiceId", invoice.get("invoiceId")), EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator)), - EntityCondition.makeCondition("taxAuthPartyId", null))) - .queryList(); + EntityCondition.makeCondition("taxAuthPartyId", null) + ).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting InvoiceItem list", module); return null; Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java?rev=1630979&r1=1630978&r2=1630979&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java Fri Oct 10 20:30:18 2014 @@ -79,10 +79,9 @@ public class BillingAccountWorker { List<String> relatedPartyIdList = UtilGenerics.checkList(agentResult.get("relatedPartyIdList")); List<GenericValue> billingAccountRoleList = EntityQuery.use(delegator).from("BillingAccountRole") - .where(UtilMisc.toList( - EntityCondition.makeCondition("partyId", EntityOperator.IN, relatedPartyIdList), - EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "BILL_TO_CUSTOMER"))) - .filterByDate().queryList(); + .where(EntityCondition.makeCondition("partyId", EntityOperator.IN, relatedPartyIdList), + EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "BILL_TO_CUSTOMER") + ).filterByDate().queryList(); if (billingAccountRoleList.size() > 0) { BigDecimal totalAvailable = BigDecimal.ZERO; @@ -115,12 +114,11 @@ public class BillingAccountWorker { */ public static List<GenericValue> getBillingAccountOpenOrders(Delegator delegator, String billingAccountId) throws GenericEntityException { return EntityQuery.use(delegator).from("OrderHeader") - .where(UtilMisc.toList( - EntityCondition.makeCondition("billingAccountId", EntityOperator.EQUALS, billingAccountId), + .where(EntityCondition.makeCondition("billingAccountId", EntityOperator.EQUALS, billingAccountId), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"), - EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"))) - .queryList(); + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED") + ).queryList(); } /** Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1630979&r1=1630978&r2=1630979&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Fri Oct 10 20:30:18 2014 @@ -2698,9 +2698,8 @@ public class PaymentGatewayServices { EntityListIterator eli = null; try { eli = EntityQuery.use(delegator).from("OrderPaymentPreference") - .where(UtilMisc.toList( - EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"), - EntityCondition.makeCondition("processAttempt", EntityOperator.GREATER_THAN, Long.valueOf(0)))) + .where(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"), + EntityCondition.makeCondition("processAttempt", EntityOperator.GREATER_THAN, Long.valueOf(0))) .orderBy("orderId").queryIterator(); List<String> processList = FastList.newInstance(); if (eli != null) { @@ -2748,9 +2747,8 @@ public class PaymentGatewayServices { EntityListIterator eli = null; try { eli = EntityQuery.use(delegator).from("OrderPaymentPreference") - .where(UtilMisc.toList( - EntityCondition.makeCondition("needsNsfRetry", EntityOperator.EQUALS, "Y"), - EntityCondition.makeCondition(ModelEntity.STAMP_FIELD, EntityOperator.LESS_THAN_EQUAL_TO, oneWeekAgo))) + .where(EntityCondition.makeCondition("needsNsfRetry", EntityOperator.EQUALS, "Y"), + EntityCondition.makeCondition(ModelEntity.STAMP_FIELD, EntityOperator.LESS_THAN_EQUAL_TO, oneWeekAgo)) .orderBy("orderId").queryIterator(); List<String> processList = FastList.newInstance();