On 18/04/2010, at 12:20 PM, Adam Heath wrote:

> [email protected] wrote:
>> Author: lektran
>> Date: Sun Apr 18 00:16:52 2010
>> New Revision: 935278
>> 
>> URL: http://svn.apache.org/viewvc?rev=935278&view=rev
>> Log:
>> A few examples of using groovy's first() list method instead of 
>> EntityUtil.getFirst(List)
>> 
>> Modified:
>>    
>> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy
>>    
>> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/OrderListInvoiceItem.groovy
>>    
>> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy
>>    
>> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/BillingAccounts.groovy
>>    
>> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy
>>    
>> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy
>> 
>> Modified: 
>> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy?rev=935278&r1=935277&r2=935278&view=diff
>> ==============================================================================
>> --- 
>> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy
>>  (original)
>> +++ 
>> ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy
>>  Sun Apr 18 00:16:52 2010
>> @@ -77,7 +77,8 @@ if (invoice) {
>>         // also create a map with tax grand total amount by VAT tax: it is 
>> also required in invoices by UE
>>         taxRate = invoiceItem.getRelatedOne("TaxAuthorityRateProduct");
>>         if (taxRate && "VAT_TAX".equals(taxRate.taxAuthorityRateTypeId)) {
>> -            taxInfo = 
>> EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyTaxAuthInfo",
>>  UtilMisc.toMap("partyId", billingParty.partyId, "taxAuthGeoId", 
>> taxRate.taxAuthGeoId, "taxAuthPartyId", taxRate.taxAuthPartyId)), 
>> invoice.invoiceDate));
>> +            taxInfos = 
>> EntityUtil.filterByDate(delegator.findByAnd("PartyTaxAuthInfo", [partyId : 
>> billingParty.partyId, taxAuthGeoId : taxRate.taxAuthGeoId, taxAuthPartyId : 
>> taxRate.taxAuthPartyId]), invoice.invoiceDate);
>> +            taxInfo = taxInfos.first();
>>             if (taxInfo) {
>>                 context.billingPartyTaxId = taxInfo.partyTaxId;
>>             }
> 
> Why the split into multiple lines?  None of the other changes do this.

Readability, that line was particularly long and comprised of multiple method 
calls, I was concerned about people not reading to the end and expecting the 
result to be a list.
Plus I don't really like 3 calls on one line.

Regards
Scott

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to