Author: jleroux
Date: Sun Aug 17 00:47:18 2008 New Revision: 686591 URL: http://svn.apache.org/viewvc?rev=686591&view=rev Log: Fix the anti-pattern if (* != null && *.size() > 0) { where * is a variable name (String or Collection). Rewritten to if (UtilValidate.isNotEmpty(*)) { Done with Eclipse regex replace feature with search = if \((\w+) *!= *null *&& *(\w+)\.size\(\) *> *0\) *\{ replace = if (UtilValidate.isNotEmpty($1)) { And of course some hand-work for imports and cleaning. I compiled and tested with ant run-tests Modified: 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/PaymentGatewayServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/SelectRespServlet.java ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchEvents.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearchEvents.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java ofbiz/trunk/framework/base/src/org/ofbiz/base/component/ComponentConfig.java ofbiz/trunk/framework/base/src/org/ofbiz/base/component/ComponentLoaderConfig.java ofbiz/trunk/framework/base/src/org/ofbiz/base/container/ContainerConfig.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInString.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MapProcessor.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelNotification.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelParam.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermission.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceValidationException.java ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/RecurrenceInfo.java ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/RecurrenceRule.java ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/I18nMessageTag.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/print/FoPrintServerEvents.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java ofbiz/trunk/specialpurpose/hhfacility/src/org/ofbiz/hhfacility/FacilityServices.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Keyboard.java ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/audit/EntityAuditMgr.java ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/instance/EntityPersistentMgr.java ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/mapping/EntityParticipantMappingMgr.java ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/user/GenericUserGroupMgr.java ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityImpl.java 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=686591&r1=686590&r2=686591&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 Sun Aug 17 00:47:18 2008 @@ -898,7 +898,7 @@ // build a Map of partyIds (both to and from) in a commission and the amounts // Note that getCommissionForProduct returns a List of Maps with a lot values. See services.xml definition for reference. List itemComms = (List) outMap.get("commissions"); - if (itemComms != null && itemComms.size() > 0) { + if (UtilValidate.isNotEmpty(itemComms)) { Iterator it = itemComms.iterator(); while (it.hasNext()) { Map commMap = (Map)it.next(); @@ -2828,7 +2828,7 @@ BigDecimal tobeApplied = ZERO; // item total amount - already applied (if any) BigDecimal alreadyApplied = ZERO; - if (paymentApplications != null && paymentApplications.size() > 0) { + if (UtilValidate.isNotEmpty(paymentApplications)) { // application(s) found, add them all together Iterator p = paymentApplications.iterator(); while (p.hasNext()) { 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=686591&r1=686590&r2=686591&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 Sun Aug 17 00:47:18 2008 @@ -29,6 +29,7 @@ import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilNumber; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; @@ -108,7 +109,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting InvoiceItem list", module); } - if (invoiceTaxItems != null && invoiceTaxItems.size() > 0) { + if (UtilValidate.isNotEmpty(invoiceTaxItems)) { Iterator invoiceItemsIter = invoiceTaxItems.iterator(); while (invoiceItemsIter.hasNext()) { GenericValue invoiceItem = (GenericValue) invoiceItemsIter.next(); @@ -150,7 +151,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting InvoiceItem list", module); } - if (invoiceItems != null && invoiceItems.size() > 0) { + if (UtilValidate.isNotEmpty(invoiceItems)) { Iterator invoiceItemsIter = invoiceItems.iterator(); while (invoiceItemsIter.hasNext()) { GenericValue invoiceItem = (GenericValue) invoiceItemsIter.next(); @@ -307,7 +308,7 @@ // now return the first PostalAddress from the locations GenericValue postalAddress = null; GenericValue contactMech = null; - if (locations != null && locations.size() > 0) { + if (UtilValidate.isNotEmpty(locations)) { try { contactMech = ((GenericValue) locations.get(0)).getRelatedOne("ContactMech"); } catch (GenericEntityException e) { @@ -425,7 +426,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting paymentApplicationlist", module); } - if (paymentApplications != null && paymentApplications.size() > 0) { + if (UtilValidate.isNotEmpty(paymentApplications)) { Iterator p = paymentApplications.iterator(); while (p.hasNext()) { GenericValue paymentApplication = (GenericValue) p.next(); @@ -509,7 +510,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting paymentApplicationlist", module); } - if (paymentApplications != null && paymentApplications.size() > 0) { + if (UtilValidate.isNotEmpty(paymentApplications)) { Iterator p = paymentApplications.iterator(); while (p.hasNext()) { GenericValue paymentApplication = (GenericValue) p.next(); 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=686591&r1=686590&r2=686591&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 Sun Aug 17 00:47:18 2008 @@ -210,7 +210,7 @@ otherPaymentMethodAndCreditCardList = EntityUtil.filterByDate(otherPaymentMethodAndCreditCardList, true); } - if (otherPaymentMethodAndCreditCardList != null && otherPaymentMethodAndCreditCardList.size() > 0) { + if (UtilValidate.isNotEmpty(otherPaymentMethodAndCreditCardList)) { Iterator otherPaymentMethodAndCreditCardIter = otherPaymentMethodAndCreditCardList.iterator(); while (otherPaymentMethodAndCreditCardIter.hasNext()) { GenericValue otherPaymentMethodAndCreditCard = (GenericValue) otherPaymentMethodAndCreditCardIter.next(); @@ -885,7 +885,7 @@ // create the internal messages List messages = (List) context.get("internalRespMsgs"); - if (messages != null && messages.size() > 0) { + if (UtilValidate.isNotEmpty(messages)) { Iterator i = messages.iterator(); while (i.hasNext()) { GenericValue respMsg = delegator.makeValue("PaymentGatewayRespMsg"); @@ -1751,7 +1751,7 @@ // create the internal messages List messages = (List) context.get("internalRespMsgs"); - if (messages != null && messages.size() > 0) { + if (UtilValidate.isNotEmpty(messages)) { Iterator i = messages.iterator(); while (i.hasNext()) { GenericValue respMsg = delegator.makeValue("PaymentGatewayRespMsg"); @@ -2061,7 +2061,7 @@ // create the internal messages List messages = (List) context.get("internalRespMsgs"); - if (messages != null && messages.size() > 0) { + if (UtilValidate.isNotEmpty(messages)) { Iterator i = messages.iterator(); while (i.hasNext()) { GenericValue respMsg = delegator.makeValue("PaymentGatewayRespMsg"); @@ -2102,7 +2102,7 @@ } catch (GenericEntityException e) { Debug.logError(e, module); } - if (orl != null && orl.size() > 0) { + if (UtilValidate.isNotEmpty(orl)) { GenericValue orderRole = EntityUtil.getFirst(orl); partyIdFrom = orderRole.getString("partyId"); } @@ -2312,7 +2312,7 @@ // create the internal messages List messages = (List) context.get("internalRespMsgs"); - if (messages != null && messages.size() > 0) { + if (UtilValidate.isNotEmpty(messages)) { Iterator i = messages.iterator(); while (i.hasNext()) { GenericValue respMsg = delegator.makeValue("PaymentGatewayRespMsg"); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java Sun Aug 17 00:47:18 2008 @@ -268,7 +268,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting paymentApplicationlist", module); } - if (paymentApplications != null && paymentApplications.size() > 0) { + if (UtilValidate.isNotEmpty(paymentApplications)) { Iterator p = paymentApplications.iterator(); while (p.hasNext()) { GenericValue paymentApplication = (GenericValue) p.next(); @@ -282,7 +282,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting the 'to' paymentApplicationlist", module); } - if (paymentApplications != null && paymentApplications.size() > 0) { + if (UtilValidate.isNotEmpty(paymentApplications)) { Iterator p = paymentApplications.iterator(); while (p.hasNext()) { GenericValue paymentApplication = (GenericValue) p.next(); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/SelectRespServlet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/SelectRespServlet.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/SelectRespServlet.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/SelectRespServlet.java Sun Aug 17 00:47:18 2008 @@ -222,7 +222,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "Cannot get payment preferences for order #" + orderId, module); } - if (paymentPrefs != null && paymentPrefs.size() > 0) { + if (UtilValidate.isNotEmpty(paymentPrefs)) { Iterator i = paymentPrefs.iterator(); while (okay && i.hasNext()) { GenericValue pref = (GenericValue) i.next(); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java Sun Aug 17 00:47:18 2008 @@ -254,7 +254,7 @@ } publishPoints = EntityUtil.filterByDate(publishPoints); - if (publishPoints != null && publishPoints.size() > 0) { + if (UtilValidate.isNotEmpty(publishPoints)) { if (Debug.verboseOn()) Debug.logVerbose("Found publish points: " + publishPoints, module); return true; } else { Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java Sun Aug 17 00:47:18 2008 @@ -99,10 +99,10 @@ viewName = "ContentAssocDataResourceViewTo"; } exprList.add(joinExpr); - if (assocTypes != null && assocTypes.size() > 0) { + if (UtilValidate.isNotEmpty(assocTypes)) { exprList.add(EntityCondition.makeCondition("caContentAssocTypeId", EntityOperator.IN, assocTypes)); } - if (contentTypes != null && contentTypes.size() > 0) { + if (UtilValidate.isNotEmpty(contentTypes)) { exprList.add(EntityCondition.makeCondition("contentTypeId", EntityOperator.IN, contentTypes)); } @@ -300,7 +300,7 @@ while (it.hasNext()) { contentAssoc = (GenericValue)it.next(); content = contentAssoc.getRelatedOneCache(assocRelationName); - if (contentTypes != null && contentTypes.size() > 0) { + if (UtilValidate.isNotEmpty(contentTypes)) { String contentTypeId = (String)content.get("contentTypeId"); if (contentTypes.contains(contentTypeId)) { contentAssocDataResourceView = delegator.makeValue(viewName); @@ -333,7 +333,7 @@ } Map results = FastMap.newInstance(); results.put("entityList", contentAssocDataResourceList); - if (contentAssocDataResourceList != null && contentAssocDataResourceList.size() > 0) { + if (UtilValidate.isNotEmpty(contentAssocDataResourceList)) { results.put("view", contentAssocDataResourceList.get(0)); } return results; Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java Sun Aug 17 00:47:18 2008 @@ -140,7 +140,7 @@ "caContentAssocTypeId", "PUBLISH_LINK"), UtilMisc.toList("caFromDate")); relContentIds = EntityUtil.filterByDate(relContentIds, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true); - if (relContentIds != null && relContentIds.size() > 0) { + if (UtilValidate.isNotEmpty(relContentIds)) { content = EntityUtil.getFirst(relContentIds); } @@ -488,7 +488,7 @@ } List kids = (List)currentNode.get("kids"); - if (kids != null && kids.size() > 0) { + if (UtilValidate.isNotEmpty(kids)) { int idx = 0; while (idx < kids.size()) { currentNode = (Map)kids.get(idx); @@ -722,7 +722,7 @@ String contentId = (String) assoc.get(contentIdName); if (Debug.infoOn()) Debug.logInfo("contentId:" + contentId, ""); content = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); - if (contentTypes != null && contentTypes.size() > 0) { + if (UtilValidate.isNotEmpty(contentTypes)) { contentTypeId = (String) content.get("contentTypeId"); if (contentTypes.contains(contentTypeId)) { contentList.add(content); @@ -801,7 +801,7 @@ joinExpr = EntityCondition.makeCondition("contentId", EntityOperator.EQUALS, contentId); } exprList.add(joinExpr); - if (assocTypes != null && assocTypes.size() > 0) { + if (UtilValidate.isNotEmpty(assocTypes)) { List exprListOr = FastList.newInstance(); Iterator it = assocTypes.iterator(); while (it.hasNext()) { @@ -1101,7 +1101,7 @@ GenericValue view = null; List lst = delegator.findByAndCache("ContentDataResourceView", UtilMisc.toMap("contentId", contentId)); //if (Debug.infoOn()) Debug.logInfo("getContentCache, lst(2):" + lst, ""); - if (lst != null && lst.size() > 0) { + if (UtilValidate.isNotEmpty(lst)) { view = (GenericValue) lst.get(0); } return view; @@ -1117,7 +1117,7 @@ List passedGlobalNodeTrail = null; GenericValue currentContent = null; String viewContentId = null; - if (trail != null && trail.size() > 0) { + if (UtilValidate.isNotEmpty(trail)) { passedGlobalNodeTrail = UtilMisc.makeListWritable(trail); } else { passedGlobalNodeTrail = FastList.newInstance(); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java Sun Aug 17 00:47:18 2008 @@ -534,7 +534,7 @@ // first item in map is the most current directory File latestDir = null; - if (dirMap != null && dirMap.size() > 0) { + if (UtilValidate.isNotEmpty(dirMap)) { latestDir = (File) dirMap.values().iterator().next(); if (latestDir != null) { File[] dirList = latestDir.listFiles(); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java Sun Aug 17 00:47:18 2008 @@ -311,7 +311,7 @@ Debug.logError(e, module); } - if (responses != null && responses.size() > 0) { + if (UtilValidate.isNotEmpty(responses)) { GenericValue response = EntityUtil.getFirst(responses); responseId = response.getString("surveyResponseId"); if (responses.size() > 1) { @@ -359,7 +359,7 @@ Debug.logError(e, module); } - if (answers != null && answers.size() > 0) { + if (UtilValidate.isNotEmpty(answers)) { Iterator i = answers.iterator(); while (i.hasNext()) { GenericValue answer = (GenericValue) i.next(); @@ -369,7 +369,7 @@ } // get the pass-thru (posted form data) - if (passThru != null && passThru.size() > 0) { + if (UtilValidate.isNotEmpty(passThru)) { Iterator i = passThru.keySet().iterator(); while (i.hasNext()) { String key = (String) i.next(); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java Sun Aug 17 00:47:18 2008 @@ -138,7 +138,7 @@ } if (UtilValidate.isNotEmpty(lastPassedContentId)) { - if (trail != null && trail.size() > 0) { + if (UtilValidate.isNotEmpty(trail)) { Map nd = (Map)trail.get(0); String firstTrailContentId = (String)nd.get("contentId"); if (UtilValidate.isNotEmpty(firstTrailContentId) Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java Sun Aug 17 00:47:18 2008 @@ -30,6 +30,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.base.util.Debug; @@ -149,7 +150,7 @@ GenericValue orderItem = shipmentPlan.getRelatedOne("OrderItem"); List productionRuns = delegator.findByAndCache("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId"))); - if (productionRuns != null && productionRuns.size() > 0) { + if (UtilValidate.isNotEmpty(productionRuns)) { Debug.logError("Production Run for order item (" + orderItem.getString("orderId") + "/" + orderItem.getString("orderItemSeqId") + ") not created.", module); continue; } Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java Sun Aug 17 00:47:18 2008 @@ -261,7 +261,7 @@ if (newNode == oneChildNode) { // If no substitution has been done (no valid rule applied), // we try to set the default (first) node-substitution - if (genericNodeRules != null && genericNodeRules.size() > 0) { + if (UtilValidate.isNotEmpty(genericNodeRules)) { // FIXME //... } Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java Sun Aug 17 00:47:18 2008 @@ -557,7 +557,7 @@ if (productsInPackages != null && productsInPackages.size() == 0) { productsInPackages = null; } - if (productsInPackages != null && productsInPackages.size() > 0) { + if (UtilValidate.isNotEmpty(productsInPackages)) { orderShipmentReadMap.put("productsInPackages", productsInPackages); } } Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Sun Aug 17 00:47:18 2008 @@ -2398,7 +2398,7 @@ } try { List existingProductionRuns = delegator.findByAndCache("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", orderItem.getString("orderId"), "orderItemSeqId", orderItem.getString("orderItemSeqId"))); - if (existingProductionRuns != null && existingProductionRuns.size() > 0) { + if (UtilValidate.isNotEmpty(existingProductionRuns)) { Debug.logWarning("Production Run for order item [" + orderItem.getString("orderId") + "/" + orderItem.getString("orderItemSeqId") + "] already exists.", module); continue; } Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java Sun Aug 17 00:47:18 2008 @@ -555,7 +555,7 @@ // TODO : change the return type to boolean to be able to test if all is ok or if it have had a exception GenericDelegator delegator = product.getDelegator(); - if (listComponent != null && listComponent.size() >0) { + if (UtilValidate.isNotEmpty(listComponent)) { Iterator listComponentIter = listComponent.iterator(); while (listComponentIter.hasNext()) { BOMNode node = (BOMNode) listComponentIter.next(); @@ -744,7 +744,7 @@ return ServiceUtil.returnError("An error occurred exploding the product [" + product.getString("productId") + "]"); } components = (List)serviceResponse.get("components"); - if (components != null && components.size() > 0) { + if (UtilValidate.isNotEmpty(components)) { BOMNode node = ((BOMNode)components.get(0)).getParentNode(); isBuilt = node.isManufactured(); } else { @@ -786,7 +786,7 @@ } else { routing = null; } - if (components != null && components.size() > 0) { + if (UtilValidate.isNotEmpty(components)) { BOMNode node = ((BOMNode)components.get(0)).getParentNode(); isBuilt = node.isManufactured(); } else { Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java Sun Aug 17 00:47:18 2008 @@ -246,7 +246,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "ERROR: Unable to get existing payment preferences from order", module); } - if (currentPrefs != null && currentPrefs.size() > 0) { + if (UtilValidate.isNotEmpty(currentPrefs)) { Iterator cpi = currentPrefs.iterator(); while (cpi.hasNext()) { GenericValue cp = (GenericValue) cpi.next(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java Sun Aug 17 00:47:18 2008 @@ -25,10 +25,10 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; -import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ModelService; @@ -184,7 +184,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "ERROR: Unable to get OrderItem records for OrderHeader : " + orderId, module); } - if (orderItems != null && orderItems.size() > 0) { + if (UtilValidate.isNotEmpty(orderItems)) { Iterator oii = orderItems.iterator(); while (oii.hasNext()) { GenericValue orderItem = (GenericValue) oii.next(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Sun Aug 17 00:47:18 2008 @@ -1430,7 +1430,7 @@ } catch (GenericEntityException e) { Debug.logWarning(e, module); } - if (receipts != null && receipts.size() > 0) { + if (UtilValidate.isNotEmpty(receipts)) { Iterator recIter = receipts.iterator(); while (recIter.hasNext()) { GenericValue rec = (GenericValue) recIter.next(); @@ -1468,7 +1468,7 @@ } catch (GenericEntityException e) { Debug.logWarning(e, module); } - if (receipts != null && receipts.size() > 0) { + if (UtilValidate.isNotEmpty(receipts)) { Iterator recIter = receipts.iterator(); while (recIter.hasNext()) { GenericValue rec = (GenericValue) recIter.next(); @@ -1534,7 +1534,7 @@ Debug.logError(e, "Unable to get OrderItemBilling from OrderItem"); } - if (orderItemBillings != null && orderItemBillings.size() > 0) { + if (UtilValidate.isNotEmpty(orderItemBillings)) { // get the ProductContent records List productContents = null; try { @@ -1550,7 +1550,7 @@ productContents = EntityUtil.filterByDate(productContents); productContents = EntityUtil.filterByOr(productContents, cExprs); - if (productContents != null && productContents.size() > 0) { + if (UtilValidate.isNotEmpty(productContents)) { // make sure we are still within the allowed timeframe and use limits Iterator pci = productContents.iterator(); while (pci.hasNext()) { @@ -2356,7 +2356,7 @@ public static BigDecimal calcOrderAdjustments(List orderHeaderAdjustments, BigDecimal subTotal, boolean includeOther, boolean includeTax, boolean includeShipping) { BigDecimal adjTotal = ZERO; - if (orderHeaderAdjustments != null && orderHeaderAdjustments.size() > 0) { + if (UtilValidate.isNotEmpty(orderHeaderAdjustments)) { List filteredAdjs = filterOrderAdjustments(orderHeaderAdjustments, includeOther, includeTax, includeShipping, false, false); Iterator adjIt = filteredAdjs.iterator(); @@ -2577,7 +2577,7 @@ public static BigDecimal calcItemAdjustments(BigDecimal quantity, BigDecimal unitPrice, List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) { BigDecimal adjTotal = ZERO; - if (adjustments != null && adjustments.size() > 0) { + if (UtilValidate.isNotEmpty(adjustments)) { List filteredAdjs = filterOrderAdjustments(adjustments, includeOther, includeTax, includeShipping, forTax, forShipping); Iterator adjIt = filteredAdjs.iterator(); @@ -2593,7 +2593,7 @@ public static BigDecimal calcItemAdjustmentsRecurringBd(BigDecimal quantity, BigDecimal unitPrice, List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) { BigDecimal adjTotal = ZERO; - if (adjustments != null && adjustments.size() > 0) { + if (UtilValidate.isNotEmpty(adjustments)) { List filteredAdjs = filterOrderAdjustments(adjustments, includeOther, includeTax, includeShipping, forTax, forShipping); Iterator adjIt = filteredAdjs.iterator(); @@ -2634,7 +2634,7 @@ public static List filterOrderAdjustments(List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) { List newOrderAdjustmentsList = FastList.newInstance(); - if (adjustments != null && adjustments.size() > 0) { + if (UtilValidate.isNotEmpty(adjustments)) { Iterator adjIt = adjustments.iterator(); while (adjIt.hasNext()) { @@ -2685,7 +2685,7 @@ Debug.logError(e, module); } - if (openOrders != null && openOrders.size() > 0) { + if (UtilValidate.isNotEmpty(openOrders)) { Iterator i = openOrders.iterator(); while (i.hasNext()) { GenericValue order = (GenericValue) i.next(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Sun Aug 17 00:47:18 2008 @@ -158,7 +158,7 @@ Debug.logError(e, module); throw new GeneralRuntimeException(e.getMessage()); } - if (itemIssue != null && itemIssue.size() > 0) { + if (UtilValidate.isNotEmpty(itemIssue)) { Debug.log("Found item issuance reference", module); // just use the first one for now; maybe later we can find a better way to determine which was the // actual item being returned; maybe by serial number @@ -215,7 +215,7 @@ // get the order header -- the first item will determine which product store to use from the order String productStoreId = null; String emailAddress = null; - if (returnItems != null && returnItems.size() > 0) { + if (UtilValidate.isNotEmpty(returnItems)) { GenericValue firstItem = EntityUtil.getFirst(returnItems); GenericValue orderHeader = null; try { @@ -549,7 +549,7 @@ Timestamp now = UtilDateTime.nowTimestamp(); List completedItems = new ArrayList(); - if (returnHeader != null && returnItems != null && returnItems.size() > 0) { + if (returnHeader != null && UtilValidate.isNotEmpty(returnItems)) { Iterator itemsIter = returnItems.iterator(); while (itemsIter.hasNext()) { GenericValue item = (GenericValue) itemsIter.next(); @@ -1350,7 +1350,7 @@ } String returnHeaderTypeId = returnHeader.getString("returnHeaderTypeId"); List createdOrderIds = new ArrayList(); - if (returnHeader != null && returnItems != null && returnItems.size() > 0) { + if (returnHeader != null && UtilValidate.isNotEmpty(returnItems)) { Map returnItemsByOrderId = new HashMap(); Map totalByOrder = new HashMap(); groupReturnItemsByOrder(returnItems, returnItemsByOrderId, totalByOrder, delegator, returnId, returnTypeId); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Sun Aug 17 00:47:18 2008 @@ -372,7 +372,7 @@ return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderCouldNotFindRelatedFixedAssetForTheProduct",UtilMisc.toMap("productId",orderItem.getString("productId")), locale )); } - if (selFixedAssetProduct != null && selFixedAssetProduct.size() > 0) { + if (UtilValidate.isNotEmpty(selFixedAssetProduct)) { Iterator firstOne = selFixedAssetProduct.iterator(); if(firstOne.hasNext()) { GenericValue fixedAssetProduct = delegator.makeValue("FixedAssetProduct"); @@ -532,7 +532,7 @@ // before processing orderItems process orderItemGroups so that they'll be in place for the foreign keys and what not List orderItemGroups = (List) context.get("orderItemGroups"); - if (orderItemGroups != null && orderItemGroups.size() > 0) { + if (UtilValidate.isNotEmpty(orderItemGroups)) { Iterator orderItemGroupIter = orderItemGroups.iterator(); while (orderItemGroupIter.hasNext()) { GenericValue orderItemGroup = (GenericValue) orderItemGroupIter.next(); @@ -561,7 +561,7 @@ // set the order attributes List orderAttributes = (List) context.get("orderAttributes"); - if (orderAttributes != null && orderAttributes.size() > 0) { + if (UtilValidate.isNotEmpty(orderAttributes)) { Iterator oattr = orderAttributes.iterator(); while (oattr.hasNext()) { GenericValue oatt = (GenericValue) oattr.next(); @@ -572,7 +572,7 @@ // set the order item attributes List orderItemAttributes = (List) context.get("orderItemAttributes"); - if (orderItemAttributes != null && orderItemAttributes.size() > 0) { + if (UtilValidate.isNotEmpty(orderItemAttributes)) { Iterator oiattr = orderItemAttributes.iterator(); while (oiattr.hasNext()) { GenericValue oiatt = (GenericValue) oiattr.next(); @@ -583,7 +583,7 @@ // create the order internal notes List orderInternalNotes = (List) context.get("orderInternalNotes"); - if (orderInternalNotes != null && orderInternalNotes.size() > 0) { + if (UtilValidate.isNotEmpty(orderInternalNotes)) { Iterator orderInternalNotesIt = orderInternalNotes.iterator(); while (orderInternalNotesIt.hasNext()) { String orderInternalNote = (String) orderInternalNotesIt.next(); @@ -605,7 +605,7 @@ // create the order public notes List orderNotes = (List) context.get("orderNotes"); - if (orderNotes != null && orderNotes.size() > 0) { + if (UtilValidate.isNotEmpty(orderNotes)) { Iterator orderNotesIt = orderNotes.iterator(); while (orderNotesIt.hasNext()) { String orderNote = (String) orderNotesIt.next(); @@ -628,7 +628,7 @@ // create the workeffort records // and connect them with the orderitem over the WorkOrderItemFulfillment // create also the techData calendars to keep track of availability of the fixed asset. - if (workEfforts != null && workEfforts.size() > 0) { + if (UtilValidate.isNotEmpty(workEfforts)) { List tempList = new LinkedList(); Iterator we = workEfforts.iterator(); while (we.hasNext()) { @@ -764,7 +764,7 @@ // set the orderId on all adjustments; this list will include order and // item adjustments... - if (orderAdjustments != null && orderAdjustments.size() > 0) { + if (UtilValidate.isNotEmpty(orderAdjustments)) { Iterator iter = orderAdjustments.iterator(); while (iter.hasNext()) { @@ -791,7 +791,7 @@ // set the order contact mechs List orderContactMechs = (List) context.get("orderContactMechs"); - if (orderContactMechs != null && orderContactMechs.size() > 0) { + if (UtilValidate.isNotEmpty(orderContactMechs)) { Iterator ocmi = orderContactMechs.iterator(); while (ocmi.hasNext()) { @@ -803,7 +803,7 @@ // set the order item contact mechs List orderItemContactMechs = (List) context.get("orderItemContactMechs"); - if (orderItemContactMechs != null && orderItemContactMechs.size() > 0) { + if (UtilValidate.isNotEmpty(orderItemContactMechs)) { Iterator oicmi = orderItemContactMechs.iterator(); while (oicmi.hasNext()) { @@ -815,7 +815,7 @@ // set the order item ship groups List dropShipGroupIds = FastList.newInstance(); // this list will contain the ids of all the ship groups for drop shipments (no reservations) - if (orderItemShipGroupInfo != null && orderItemShipGroupInfo.size() > 0) { + if (UtilValidate.isNotEmpty(orderItemShipGroupInfo)) { Iterator osiInfos = orderItemShipGroupInfo.iterator(); while (osiInfos.hasNext()) { GenericValue valueObj = (GenericValue) osiInfos.next(); @@ -862,7 +862,7 @@ // set the item survey responses List surveyResponses = (List) context.get("orderItemSurveyResponses"); - if (surveyResponses != null && surveyResponses.size() > 0) { + if (UtilValidate.isNotEmpty(surveyResponses)) { Iterator oisr = surveyResponses.iterator(); while (oisr.hasNext()) { GenericValue surveyResponse = (GenericValue) oisr.next(); @@ -872,7 +872,7 @@ } // set the item price info; NOTE: this must be after the orderItems are stored for referential integrity - if (orderItemPriceInfo != null && orderItemPriceInfo.size() > 0) { + if (UtilValidate.isNotEmpty(orderItemPriceInfo)) { Iterator oipii = orderItemPriceInfo.iterator(); while (oipii.hasNext()) { @@ -890,7 +890,7 @@ // set the item associations List orderItemAssociations = (List) context.get("orderItemAssociations"); - if (orderItemAssociations != null && orderItemAssociations.size() > 0) { + if (UtilValidate.isNotEmpty(orderItemAssociations)) { Iterator oia = orderItemAssociations.iterator(); while (oia.hasNext()) { GenericValue orderItemAssociation = (GenericValue) oia.next(); @@ -905,7 +905,7 @@ // store the orderProductPromoUseInfos List orderProductPromoUses = (List) context.get("orderProductPromoUses"); - if (orderProductPromoUses != null && orderProductPromoUses.size() > 0) { + if (UtilValidate.isNotEmpty(orderProductPromoUses)) { Iterator orderProductPromoUseIter = orderProductPromoUses.iterator(); while (orderProductPromoUseIter.hasNext()) { GenericValue productPromoUse = (GenericValue) orderProductPromoUseIter.next(); @@ -1004,7 +1004,7 @@ // set the order payment info List orderPaymentInfos = (List) context.get("orderPaymentInfo"); - if (orderPaymentInfos != null && orderPaymentInfos.size() > 0) { + if (UtilValidate.isNotEmpty(orderPaymentInfos)) { Iterator oppIter = orderPaymentInfos.iterator(); while (oppIter.hasNext()) { GenericValue valueObj = (GenericValue) oppIter.next(); @@ -1025,7 +1025,7 @@ // store the trackingCodeOrder entities List trackingCodeOrders = (List) context.get("trackingCodeOrders"); - if (trackingCodeOrders != null && trackingCodeOrders.size() > 0) { + if (UtilValidate.isNotEmpty(trackingCodeOrders)) { Iterator tkcdordIter = trackingCodeOrders.iterator(); while (tkcdordIter.hasNext()) { GenericValue trackingCodeOrder = (GenericValue) tkcdordIter.next(); @@ -1037,7 +1037,7 @@ // store the OrderTerm entities List orderTerms = (List) context.get("orderTerms"); - if (orderTerms != null && orderTerms.size() > 0) { + if (UtilValidate.isNotEmpty(orderTerms)) { Iterator orderTermIter = orderTerms.iterator(); while (orderTermIter.hasNext()) { GenericValue orderTerm = (GenericValue) orderTermIter.next(); @@ -1105,7 +1105,7 @@ // START inventory reservation // decrement inventory available for each OrderItemShipGroupAssoc, within the same transaction - if (orderItemShipGroupInfo != null && orderItemShipGroupInfo.size() > 0) { + if (UtilValidate.isNotEmpty(orderItemShipGroupInfo)) { Iterator osiInfos = orderItemShipGroupInfo.iterator(); while (osiInfos.hasNext()) { GenericValue orderItemShipGroupAssoc = (GenericValue) osiInfos.next(); @@ -1494,7 +1494,7 @@ List itemAdj = (List) serviceResult.get("itemAdjustments"); // Accumulate the new tax total from the recalculated header adjustments - if (orderAdj != null && orderAdj.size() > 0) { + if (UtilValidate.isNotEmpty(orderAdj)) { Iterator oai = orderAdj.iterator(); while (oai.hasNext()) { GenericValue oa = (GenericValue) oai.next(); @@ -1507,7 +1507,7 @@ } // Accumulate the new tax total from the recalculated item adjustments - if (itemAdj != null && itemAdj.size() > 0) { + if (UtilValidate.isNotEmpty(itemAdj)) { for (int i = 0; i < itemAdj.size(); i++) { List itemAdjustments = (List) itemAdj.get(i); Iterator ida = itemAdjustments.iterator(); @@ -1962,7 +1962,7 @@ return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderErrorCannotGetOrderItemEntity ",locale) + e.getMessage()); } - if (orderItems != null && orderItems.size() > 0) { + if (UtilValidate.isNotEmpty(orderItems)) { List toBeStored = new ArrayList(); Iterator itemsIterator = orderItems.iterator(); while (itemsIterator.hasNext()) { @@ -2812,7 +2812,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "Problem getting order item records", module); } - if (orderItems != null && orderItems.size() > 0) { + if (UtilValidate.isNotEmpty(orderItems)) { Iterator oii = orderItems.iterator(); while (oii.hasNext()) { GenericValue orderItem = (GenericValue) oii.next(); @@ -2870,7 +2870,7 @@ List digitalItems = new ArrayList(); Map digitalProducts = new HashMap(); - if (orderItems != null && orderItems.size() > 0) { + if (UtilValidate.isNotEmpty(orderItems)) { Iterator i = orderItems.iterator(); while (i.hasNext()) { GenericValue item = (GenericValue) i.next(); @@ -3021,7 +3021,7 @@ GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); - if (orderItems != null && orderItems.size() > 0) { + if (UtilValidate.isNotEmpty(orderItems)) { // loop through the digital items to fulfill Iterator itemsIterator = orderItems.iterator(); while (itemsIterator.hasNext()) { @@ -3054,7 +3054,7 @@ } } - if (allProductContent != null && allProductContent.size() > 0) { + if (UtilValidate.isNotEmpty(allProductContent)) { // only keep ones with valid dates productContent = EntityUtil.filterByDate(allProductContent, UtilDateTime.nowTimestamp(), "fromDate", "thruDate", true); Debug.logInfo("Product has " + allProductContent.size() + " associations, " + @@ -3065,7 +3065,7 @@ } // now use the ProductContent to fulfill the item - if (productContent != null && productContent.size() > 0) { + if (UtilValidate.isNotEmpty(productContent)) { Iterator prodcontentIterator = productContent.iterator(); while (prodcontentIterator.hasNext()) { GenericValue productContentItem = (GenericValue) prodcontentIterator.next(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java Sun Aug 17 00:47:18 2008 @@ -60,7 +60,7 @@ EntityCondition.makeCondition("requirementTypeId", EntityOperator.EQUALS, "PRODUCT_REQUIREMENT"), EntityUtil.getFilterByDateExpr() ); - if (statusIds != null && statusIds.size() > 0) { + if (UtilValidate.isNotEmpty(statusIds)) { conditions.add( EntityCondition.makeCondition("statusId", EntityOperator.IN, statusIds) ); } else { conditions.add( EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "REQ_APPROVED") ); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Sun Aug 17 00:47:18 2008 @@ -60,7 +60,7 @@ //Locale locale = UtilHttp.getLocale(request); String errMsg = null; - if (cart != null && cart.size() > 0) { + if (UtilValidate.isNotEmpty(cart)) { return "success"; } else { errMsg = UtilProperties.getMessage(resource, "checkevents.cart_empty", (cart != null ? cart.getLocale() : Locale.getDefault())); @@ -557,7 +557,7 @@ // check for customer message(s) List messages = (List) callResult.get("authResultMsgs"); - if (messages != null && messages.size() > 0) { + if (UtilValidate.isNotEmpty(messages)) { request.setAttribute("_EVENT_MESSAGE_LIST_", messages); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Sun Aug 17 00:47:18 2008 @@ -85,7 +85,7 @@ Map result; String errMsg = null; - if (this.cart != null && this.cart.size() > 0) { + if (UtilValidate.isNotEmpty(this.cart)) { errorMessages.addAll(setCheckOutShippingAddressInternal(shippingContactMechId)); } else { errMsg = UtilProperties.getMessage(resource,"checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); @@ -124,7 +124,7 @@ Map result; String errMsg = null; - if (this.cart != null && this.cart.size() > 0) { + if (UtilValidate.isNotEmpty(this.cart)) { errorMessages.addAll(setCheckOutShippingOptionsInternal(shippingMethod, shippingInstructions, orderAdditionalEmails, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate)); } else { @@ -219,7 +219,7 @@ Map result; String errMsg = null; - if (this.cart != null && this.cart.size() > 0) { + if (UtilValidate.isNotEmpty(this.cart)) { errorMessages.addAll(setCheckOutPaymentInternal(selectedPaymentMethods, singleUsePayments, billingAccountId)); } else { errMsg = UtilProperties.getMessage(resource,"checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); @@ -246,7 +246,7 @@ } // set the payment method option - if (selectedPaymentMethods != null && selectedPaymentMethods.size() > 0) { + if (UtilValidate.isNotEmpty(selectedPaymentMethods)) { // clear out the old payments cart.clearPayments(); @@ -360,7 +360,7 @@ Map result = null; String errMsg = null; - if (this.cart != null && this.cart.size() > 0) { + if (UtilValidate.isNotEmpty(this.cart)) { this.cart.setShipBeforeDate(shipBefore); this.cart.setShipAfterDate(shipAfter); } else { @@ -388,7 +388,7 @@ String errMsg = null; - if (this.cart != null && this.cart.size() > 0) { + if (UtilValidate.isNotEmpty(this.cart)) { // set the general shipping options and method errorMessages.addAll(setCheckOutShippingOptionsInternal(shippingMethod, shippingInstructions, orderAdditionalEmails, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate)); @@ -480,7 +480,7 @@ } } - if (selectedPaymentMethods != null && selectedPaymentMethods.size() > 0) { + if (UtilValidate.isNotEmpty(selectedPaymentMethods)) { if (gcAmt == null || gcAmt.length() == 0) { errMsg = UtilProperties.getMessage(resource,"checkhelper.enter_amount_to_place_on_gift_card", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); @@ -905,7 +905,7 @@ // check for online payment methods or in-hand payment types with verbal or external refs List exprs = UtilMisc.toList(EntityCondition.makeCondition("manualRefNum", EntityOperator.NOT_EQUAL, null)); List manualRefPaymentPrefs = EntityUtil.filterByAnd(allPaymentPreferences, exprs); - if (manualRefPaymentPrefs != null && manualRefPaymentPrefs.size() > 0) { + if (UtilValidate.isNotEmpty(manualRefPaymentPrefs)) { Iterator i = manualRefPaymentPrefs.iterator(); while (i.hasNext()) { GenericValue opp = (GenericValue) i.next(); @@ -955,7 +955,7 @@ // Check the payment preferences; if we have ANY w/ status PAYMENT_NOT_AUTH invoke payment service. // Invoke payment processing. - if (onlinePaymentPrefs != null && onlinePaymentPrefs.size() > 0) { + if (UtilValidate.isNotEmpty(onlinePaymentPrefs)) { boolean autoApproveOrder = UtilValidate.isEmpty(productStore.get("autoApproveOrder")) || "Y".equalsIgnoreCase(productStore.getString("autoApproveOrder")); if (orderTotal == 0 && autoApproveOrder) { // if there is nothing to authorize; don't bother @@ -1210,7 +1210,7 @@ } } - if (blacklistFound != null && blacklistFound.size() > 0) { + if (UtilValidate.isNotEmpty(blacklistFound)) { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource_error,"OrderFailed", (cart != null ? cart.getLocale() : Locale.getDefault()))); } else { return ServiceUtil.returnSuccess("success"); @@ -1272,7 +1272,7 @@ result = ServiceUtil.returnError(errMsg); return result; } - if (paymentPrefs != null && paymentPrefs.size() > 0) { + if (UtilValidate.isNotEmpty(paymentPrefs)) { if (paymentPrefs.size() > 1) { Debug.logError("Too many payment preferences, you cannot have more then one when using external gateways", module); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Sun Aug 17 00:47:18 2008 @@ -1708,7 +1708,7 @@ /** Returns a list of PaymentMethod value objects selected in the cart */ public List getPaymentMethods() { List methods = FastList.newInstance(); - if (paymentInfo != null && paymentInfo.size() > 0) { + if (UtilValidate.isNotEmpty(paymentInfo)) { Iterator paymentMethodIdIter = getPaymentMethodIds().iterator(); while (paymentMethodIdIter.hasNext()) { String paymentMethodId = (String) paymentMethodIdIter.next(); @@ -1731,7 +1731,7 @@ /** Returns a list of PaymentMethodType value objects selected in the cart */ public List getPaymentMethodTypes() { List types = new LinkedList(); - if (paymentInfo != null && paymentInfo.size() > 0) { + if (UtilValidate.isNotEmpty(paymentInfo)) { Iterator i = getPaymentMethodTypeIds().iterator(); while (i.hasNext()) { String id = (String) i.next(); @@ -2373,7 +2373,7 @@ try { GenericValue orderParty = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", this.getPartyId())); Collection shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); - if (shippingContactMechList != null && shippingContactMechList.size() > 0) { + if (UtilValidate.isNotEmpty(shippingContactMechList)) { GenericValue shippingContactMech = (GenericValue)(shippingContactMechList.iterator()).next(); this.setShippingContactMechId(shippingContactMech.getString("contactMechId")); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Sun Aug 17 00:47:18 2008 @@ -441,7 +441,7 @@ if (productId != null) { String productStoreId = ProductStoreWorker.getProductStoreId(request); List productSurvey = ProductStoreWorker.getProductSurveys(delegator, productStoreId, productId, "CART_ADD", parentProductId); - if (productSurvey != null && productSurvey.size() > 0) { + if (UtilValidate.isNotEmpty(productSurvey)) { // TODO: implement multiple survey per product GenericValue survey = EntityUtil.getFirst(productSurvey); String surveyResponseId = (String) request.getAttribute("surveyResponseId"); @@ -1401,7 +1401,7 @@ // } storeReps = EntityUtil.filterByDate(storeReps); - if (storeReps != null && storeReps.size() > 0) { + if (UtilValidate.isNotEmpty(storeReps)) { hasPermission = true; } } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Sun Aug 17 00:47:18 2008 @@ -854,7 +854,7 @@ String msg = UtilProperties.getMessage(resource, "item.cannot_find_Fixed_Asset", messageMap , cart.getLocale()); return msg; } - if (selFixedAssetProduct != null && selFixedAssetProduct.size() > 0) { + if (UtilValidate.isNotEmpty(selFixedAssetProduct)) { Iterator firstOne = selFixedAssetProduct.iterator(); fixedAssetProduct = (GenericValue) firstOne.next(); } else { @@ -1139,7 +1139,7 @@ // check if a survey is associated with the item and add to the price calculation List surveyResponses = (List) getAttribute("surveyResponses"); - if (surveyResponses != null && surveyResponses.size() > 0) { + if (UtilValidate.isNotEmpty(surveyResponses)) { priceContext.put("surveyResponseId", surveyResponses.get(0)); } @@ -1772,7 +1772,7 @@ /** Returns a List of the item's features for supplier*/ public List getFeaturesForSupplier(LocalDispatcher dispatcher,String partyId) { List featureAppls = getStandardFeatureList(); - if (featureAppls != null && featureAppls.size() > 0) { + if (UtilValidate.isNotEmpty(featureAppls)) { try { Map result = dispatcher.runSync("convertFeaturesForSupplier", UtilMisc.toMap("partyId", partyId, "productFeatures", featureAppls)); featuresForSupplier = (List) result.get("convertedProductFeatures"); @@ -2391,7 +2391,7 @@ // now copy/calc the adjustments Debug.logInfo("Clone's adj: " + item.getAdjustments(), module); - if (item.getAdjustments() != null && item.getAdjustments().size() > 0) { + if (UtilValidate.isNotEmpty(item.getAdjustments())) { List adjustments = new LinkedList(item.getAdjustments()); Iterator adjIterator = adjustments.iterator(); @@ -2423,7 +2423,7 @@ Debug.logInfo("Item's Adj: " + this.getAdjustments(), module); // re-calc this item's adjustments - if (this.getAdjustments() != null && this.getAdjustments().size() > 0) { + if (UtilValidate.isNotEmpty(this.getAdjustments())) { List adjustments = new LinkedList(this.getAdjustments()); Iterator adjIterator = adjustments.iterator(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Sun Aug 17 00:47:18 2008 @@ -238,7 +238,7 @@ Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); } - if (orderPaymentPrefs != null && orderPaymentPrefs.size() > 0) { + if (UtilValidate.isNotEmpty(orderPaymentPrefs)) { Iterator oppi = orderPaymentPrefs.iterator(); while (oppi.hasNext()) { GenericValue opp = (GenericValue) oppi.next(); 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=686591&r1=686590&r2=686591&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 Sun Aug 17 00:47:18 2008 @@ -95,7 +95,7 @@ } } - if (complementProducts != null && complementProducts.size() > 0) { + if (UtilValidate.isNotEmpty(complementProducts)) { Iterator complIter = complementProducts.iterator(); while (complIter.hasNext()) { GenericValue productAssoc = (GenericValue) complIter.next(); @@ -138,7 +138,7 @@ Debug.logWarning(e, module); } - if (cartAssocs != null && cartAssocs.size() > 0) { + if (UtilValidate.isNotEmpty(cartAssocs)) { return cartAssocs; } else { return null; @@ -231,7 +231,7 @@ // remove all products that are already in the cart ShoppingCart cart = (ShoppingCart) httpRequest.getSession().getAttribute("shoppingCart"); - if (cart != null && cart.size() > 0) { + if (UtilValidate.isNotEmpty(cart)) { Iterator cartiter = cart.iterator(); while (cartiter.hasNext()) { ShoppingCartItem item = (ShoppingCartItem) cartiter.next(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Sun Aug 17 00:47:18 2008 @@ -366,7 +366,7 @@ String productPromoId = productPromo.getString("productPromoId"); List productPromoRules = productPromo.getRelatedCache("ProductPromoRule", null, null); - if (productPromoRules != null && productPromoRules.size() > 0) { + if (UtilValidate.isNotEmpty(productPromoRules)) { // always have a useLimit to avoid unlimited looping, default to 1 if no other is specified Long candidateUseLimit = getProductPromoUseLimit(productPromo, partyId, delegator); Long useLimit = candidateUseLimit; @@ -935,7 +935,7 @@ List productCategoryMembers = delegator.findByAndCache("ProductCategoryMember", UtilMisc.toMap("productId", productId, "productCategoryId", productCategoryId)); // and from/thru date within range productCategoryMembers = EntityUtil.filterByDate(productCategoryMembers, nowTimestamp); - if (productCategoryMembers != null && productCategoryMembers.size() > 0) { + if (UtilValidate.isNotEmpty(productCategoryMembers)) { // if any product is in category, set true and break // then 0 (equals), otherwise 1 (not equals) compareBase = new Integer(0); @@ -969,7 +969,7 @@ // and from/thru date within range partyRelationshipList = EntityUtil.filterByDate(partyRelationshipList, true); // then 0 (equals), otherwise 1 (not equals) - if (partyRelationshipList != null && partyRelationshipList.size() > 0) { + if (UtilValidate.isNotEmpty(partyRelationshipList)) { compareBase = new Integer(0); } else { compareBase = new Integer(1); @@ -986,7 +986,7 @@ // and from/thru date within range partyClassificationList = EntityUtil.filterByDate(partyClassificationList, true); // then 0 (equals), otherwise 1 (not equals) - if (partyClassificationList != null && partyClassificationList.size() > 0) { + if (UtilValidate.isNotEmpty(partyClassificationList)) { compareBase = new Integer(0); } else { compareBase = new Integer(1); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java Sun Aug 17 00:47:18 2008 @@ -522,7 +522,7 @@ * Creates records for survey responses on survey items */ public static int makeListItemSurveyResp(GenericDelegator delegator, GenericValue item, List surveyResps) throws GenericEntityException { - if (surveyResps != null && surveyResps.size() > 0) { + if (UtilValidate.isNotEmpty(surveyResps)) { Iterator i = surveyResps.iterator(); int count = 0; while (i.hasNext()) { @@ -544,7 +544,7 @@ */ public static Map getItemSurveyInfos(List items) { Map surveyInfos = new HashMap(); - if (items != null && items.size() > 0) { + if (UtilValidate.isNotEmpty(items)) { Iterator itemIt = items.iterator(); while (itemIt.hasNext()) { GenericValue item = (GenericValue) itemIt.next(); @@ -569,7 +569,7 @@ Debug.logError(e, module); } - if (surveyResp != null && surveyResp.size() > 0) { + if (UtilValidate.isNotEmpty(surveyResp)) { Iterator respIt = surveyResp.iterator(); while (respIt.hasNext()) { GenericValue resp = (GenericValue) respIt.next(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java Sun Aug 17 00:47:18 2008 @@ -35,6 +35,7 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilURL; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.datafile.DataFile; import org.ofbiz.datafile.DataFileException; import org.ofbiz.datafile.Record; @@ -285,11 +286,11 @@ if (zipLookup != null && zipLookup.size() > 1) { // first filter by city List cityLookup = EntityUtil.filterByAnd(zipLookup, UtilMisc.toMap("city", city.toUpperCase())); - if (cityLookup != null && cityLookup.size() > 0) { + if (UtilValidate.isNotEmpty(cityLookup)) { if (cityLookup.size() > 1) { // filter by county List countyLookup = EntityUtil.filterByAnd(taxLookup, UtilMisc.toMap("countyDefault", "Y")); - if (countyLookup != null && countyLookup.size() > 0) { + if (UtilValidate.isNotEmpty(countyLookup)) { // use the county default taxLookup = countyLookup; } else { @@ -303,7 +304,7 @@ } else { // no city found; lookup default city List defaultLookup = EntityUtil.filterByAnd(zipLookup, UtilMisc.toMap("generalDefault", "Y")); - if (defaultLookup != null && defaultLookup.size() > 0) { + if (UtilValidate.isNotEmpty(defaultLookup)) { // use the default city lookup taxLookup = defaultLookup; } else { @@ -318,7 +319,7 @@ // get the first one GenericValue taxEntry = null; - if (taxLookup != null && taxLookup.size() > 0) { + if (UtilValidate.isNotEmpty(taxLookup)) { taxEntry = (GenericValue) taxLookup.iterator().next(); } Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java (original) +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java Sun Aug 17 00:47:18 2008 @@ -208,7 +208,7 @@ public static void getOrderContactMechValueMaps(PageContext pageContext, String orderId, String orderContactMechValueMapsAttr) { GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator"); List<Map<String, GenericValue>> maps = getOrderContactMechValueMaps(delegator, orderId); - if (maps != null && maps.size() > 0) { + if (UtilValidate.isNotEmpty(maps)) { pageContext.setAttribute(orderContactMechValueMapsAttr, maps); } } Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java?rev=686591&r1=686590&r2=686591&view=diff ============================================================================== --- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java (original) +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java Sun Aug 17 00:47:18 2008 @@ -302,7 +302,7 @@ } } - if (validFound != null && validFound.size() > 0) { + if (UtilValidate.isNotEmpty(validFound)) { for (GenericValue partyAndAddr: validFound) { String partyId = partyAndAddr.getString("partyId"); String cmId = partyAndAddr.getString("contactMechId"); |
Free forum by Nabble | Edit this page |