Author: jleroux
Date: Mon Nov 23 20:34:27 2009 New Revision: 883492 URL: http://svn.apache.org/viewvc?rev=883492&view=rev Log: Use UtilValidate.isEmpty methods instead of (obj == null) || (obj.size == 0) Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.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/shoppingcart/CheckOutEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.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/product/src/org/ofbiz/product/category/CategoryWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.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/store/ProductStoreWorker.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/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/DelegatorEcaHandler.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceValidationException.java ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java Mon Nov 23 20:34:27 2009 @@ -377,7 +377,7 @@ // make sure the item hasn't already been returned List<GenericValue> returnItems = orderItem.getRelated("ReturnItem"); - if (returnItems == null || returnItems.size() == 0) { + if (UtilValidate.isEmpty(returnItems)) { BigDecimal txAmt = trans.getBigDecimal("amount"); BigDecimal refAmt = txAmt; if (remainingBalance.compareTo(txAmt) == -1) { 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=883492&r1=883491&r2=883492&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 Mon Nov 23 20:34:27 2009 @@ -326,7 +326,7 @@ Debug.logError("Touble getting InvoiceContactMech entity list", module); } - if (locations == null || locations.size() == 0) { + if (UtilValidate.isEmpty(locations)) { // if no locations found get it from the PartyAndContactMech using the from and to party on the invoice String destinationPartyId = null; if (invoice.getString("invoiceTypeId").equals("SALES_INVOICE")) @@ -340,7 +340,7 @@ Debug.logError("Trouble getting contact party purpose list", module); } //if still not found get it from the general location - if (locations == null || locations.size() == 0) { + if (UtilValidate.isEmpty(locations)) { try { locations = EntityUtil.filterByDate(delegator.findByAnd("PartyContactMechPurpose", UtilMisc.toMap("partyId", destinationPartyId, "contactMechPurposeTypeId", "GENERAL_LOCATION"))); 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=883492&r1=883491&r2=883492&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 Mon Nov 23 20:34:27 2009 @@ -370,7 +370,7 @@ hasContent=true; } contentAssoc = EntityUtil.filterByDate(contentAssoc); - if (contentAssoc == null || contentAssoc.size() == 0) { + if (UtilValidate.isEmpty(contentAssoc)) { List<GenericValue> assocs = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentIdFrom)); assocs = EntityUtil.filterByDate(assocs); if (assocs != null) { Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java Mon Nov 23 20:34:27 2009 @@ -392,7 +392,7 @@ try { results = dispatcher.runSync("getAssocAndContentAndDataResource", serviceIn); entityList = (List)results.get("entityList"); - if (entityList == null || entityList.size() == 0) { + if (UtilValidate.isEmpty(entityList)) { String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.no_subcontent", locale); request.setAttribute("_ERROR_MESSAGE_", errMsg); } 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=883492&r1=883491&r2=883492&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 Mon Nov 23 20:34:27 2009 @@ -269,7 +269,7 @@ GenericValue opp = (GenericValue) oppi.next(); if ("PAYMENT_RECEIVED".equals(opp.getString("statusId"))) { List payments = orh.getOrderPayments(opp); - if (payments == null || payments.size() == 0) { + if (UtilValidate.isEmpty(payments)) { // only do this one time; if we have payment already for this pref ignore. Map results = dispatcher.runSync("createPaymentFromPreference", UtilMisc.<String, Object>toMap("userLogin", userLogin, "orderPaymentPreferenceId", opp.getString("orderPaymentPreferenceId"), 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=883492&r1=883491&r2=883492&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 Mon Nov 23 20:34:27 2009 @@ -620,7 +620,7 @@ public String getStatusString(Locale locale) { List<GenericValue> orderStatusList = this.getOrderHeaderStatuses(); - if (orderStatusList == null || orderStatusList.size() == 0) return ""; + if (UtilValidate.isEmpty(orderStatusList)) return ""; Iterator<GenericValue> orderStatusIter = orderStatusList.iterator(); StringBuilder orderStatusString = new StringBuilder(50); 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=883492&r1=883491&r2=883492&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 Mon Nov 23 20:34:27 2009 @@ -410,7 +410,7 @@ Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderErrorUnableToGetReturnItemInformation", locale)); } - if (returnedItems == null || returnedItems.size() == 0) { + if (UtilValidate.isEmpty(returnedItems)) { returnableQuantity = orderQty; } else { BigDecimal returnedQty = BigDecimal.ZERO; 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=883492&r1=883491&r2=883492&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 Mon Nov 23 20:34:27 2009 @@ -370,7 +370,7 @@ GenericValue orderItem = (GenericValue) orderItemIter.next(); if ("RENTAL_ORDER_ITEM".equals(orderItem.getString("orderItemTypeId"))) { // check to see if workefforts are available for this order type. - if (workEfforts == null || workEfforts.size() == 0) { + if (UtilValidate.isEmpty(workEfforts)) { String errMsg = "Work Efforts missing for ordertype RENTAL_ORDER_ITEM " + "Product: " + orderItem.getString("productId"); Debug.logError(errMsg, module); errorMessages.add(errMsg); @@ -799,10 +799,10 @@ orderAdjustment.set("createdDate", UtilDateTime.nowTimestamp()); orderAdjustment.set("createdByUserLogin", userLogin.getString("userLoginId")); - if (orderAdjustment.get("orderItemSeqId") == null || orderAdjustment.getString("orderItemSeqId").length() == 0) { + if (UtilValidate.isEmpty(orderAdjustment.get("orderItemSeqId"))) { orderAdjustment.set("orderItemSeqId", DataModelConstants.SEQ_ID_NA); } - if (orderAdjustment.get("shipGroupSeqId") == null || orderAdjustment.getString("shipGroupSeqId").length() == 0) { + if (UtilValidate.isEmpty(orderAdjustment.get("shipGroupSeqId"))) { orderAdjustment.set("shipGroupSeqId", DataModelConstants.SEQ_ID_NA); } toBeStored.add(orderAdjustment); @@ -850,7 +850,7 @@ } } else if ("OrderAdjustment".equals(valueObj.getEntityName())) { // shipping / tax adjustment(s) - if (valueObj.get("orderItemSeqId") == null || valueObj.getString("orderItemSeqId").length() == 0) { + if (UtilValidate.isEmpty(valueObj.get("orderItemSeqId"))) { valueObj.set("orderItemSeqId", DataModelConstants.SEQ_ID_NA); } valueObj.set("orderAdjustmentId", delegator.getNextSeqId("OrderAdjustment")); @@ -1655,7 +1655,7 @@ Map shippingEstMap = ShippingEvents.getShipEstimate(dispatcher, delegator, orh, shipGroupSeqId); BigDecimal shippingTotal = null; - if (orh.getValidOrderItems(shipGroupSeqId) == null || orh.getValidOrderItems(shipGroupSeqId).size() == 0) { + if (UtilValidate.isEmpty(orh.getValidOrderItems(shipGroupSeqId))) { shippingTotal = ZERO; Debug.log("No valid order items found - " + shippingTotal, module); } else { @@ -2716,7 +2716,7 @@ String noteId = (String) noteRes.get("noteId"); - if (noteId == null || noteId.length() == 0) { + if (UtilValidate.isEmpty(noteId)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemCreatingTheNoteNoNoteIdReturned", locale)); } @@ -2806,7 +2806,7 @@ Debug.logError(e, "Problem getting order headers", module); } - if (ordersToCheck == null || ordersToCheck.size() == 0) { + if (UtilValidate.isEmpty(ordersToCheck)) { Debug.logInfo("No orders to check, finished", module); return ServiceUtil.returnSuccess(); } @@ -3877,7 +3877,7 @@ } } else if ("OrderAdjustment".equals(valueObj.getEntityName())) { // shipping / tax adjustment(s) - if (valueObj.get("orderItemSeqId") == null || valueObj.getString("orderItemSeqId").length() == 0) { + if (UtilValidate.isEmpty(valueObj.get("orderItemSeqId"))) { valueObj.set("orderItemSeqId", DataModelConstants.SEQ_ID_NA); } valueObj.set("orderAdjustmentId", delegator.getNextSeqId("OrderAdjustment")); 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=883492&r1=883491&r2=883492&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 Mon Nov 23 20:34:27 2009 @@ -239,7 +239,7 @@ public static String setCheckOutError(HttpServletRequest request, HttpServletResponse response) { String currentPage = request.getParameter("checkoutpage"); - if (currentPage == null || currentPage.length() == 0) { + if (UtilValidate.isEmpty(currentPage)) { return "error"; } else { return currentPage; @@ -1015,7 +1015,7 @@ } else if (currProcess.equals("payment")) { List paymentMethodIds = cart.getPaymentMethodIds(); List paymentMethodTypeIds = cart.getPaymentMethodTypeIds(); - if (requirePayment && (paymentMethodIds == null || paymentMethodIds.size() == 0) && (paymentMethodTypeIds == null || paymentMethodTypeIds.size() == 0)) { + if (requirePayment && UtilValidate.isEmpty(paymentMethodIds) && UtilValidate.isEmpty(paymentMethodTypeIds)) { return "payment"; } } else if (currProcess.equals("addparty")) { @@ -1046,7 +1046,7 @@ public static String finalizeOrderEntryError(HttpServletRequest request, HttpServletResponse response) { String finalizePage = request.getParameter("finalizeMode"); - if (finalizePage == null || finalizePage.length() == 0) { + if (UtilValidate.isEmpty(finalizePage)) { return "error"; } else { return finalizePage; 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=883492&r1=883491&r2=883492&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 Mon Nov 23 20:34:27 2009 @@ -450,7 +450,7 @@ BigDecimal gcAmount = BigDecimal.ONE.negate(); boolean gcFieldsOkay = true; - if (gcNum == null || gcNum.length() == 0) { + if (UtilValidate.isEmpty(gcNum)) { errMsg = UtilProperties.getMessage(resource_error,"checkhelper.enter_gift_card_number", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); gcFieldsOkay = false; @@ -489,7 +489,7 @@ } if (UtilValidate.isNotEmpty(selectedPaymentMethods)) { - if (gcAmt == null || gcAmt.length() == 0) { + if (UtilValidate.isEmpty(gcAmt)) { errMsg = UtilProperties.getMessage(resource_error,"checkhelper.enter_amount_to_place_on_gift_card", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); gcFieldsOkay = false; @@ -1009,7 +1009,7 @@ if (!ok) { throw new GeneralException("Problem with order change; see above error"); } - if (messages == null || messages.size() == 0) { + if (UtilValidate.isEmpty(messages)) { return ServiceUtil.returnError(DECLINE_MESSAGE); } else { return ServiceUtil.returnError(messages); @@ -1036,7 +1036,7 @@ if (!ok) { throw new GeneralException("Problem with order change; see above error"); } - if (messages == null || messages.size() == 0) { + if (UtilValidate.isEmpty(messages)) { return ServiceUtil.returnError(ERROR_MESSAGE); } else { return ServiceUtil.returnError(messages); 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=883492&r1=883491&r2=883492&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 Mon Nov 23 20:34:27 2009 @@ -177,7 +177,7 @@ List productStorePromoApplsList = productStore.getRelatedCache("ProductStorePromoAppl", null, UtilMisc.toList("sequenceNum")); productStorePromoApplsList = EntityUtil.filterByDate(productStorePromoApplsList, nowTimestamp); - if (productStorePromoApplsList == null || productStorePromoApplsList.size() == 0) { + if (UtilValidate.isEmpty(productStorePromoApplsList)) { if (Debug.verboseOn()) Debug.logVerbose("Not doing promotions, none applied to store with ID " + productStoreId, module); } @@ -231,7 +231,7 @@ List agreementPromoApplsList = agreementItem.getRelatedCache("AgreementPromoAppl", null, UtilMisc.toList("sequenceNum")); agreementPromoApplsList = EntityUtil.filterByDate(agreementPromoApplsList, nowTimestamp); - if (agreementPromoApplsList == null || agreementPromoApplsList.size() == 0) { + if (UtilValidate.isEmpty(agreementPromoApplsList)) { if (Debug.verboseOn()) Debug.logVerbose("Not doing promotions, none applied to agreement with ID " + agreementId, module); } 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=883492&r1=883491&r2=883492&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 Mon Nov 23 20:34:27 2009 @@ -240,7 +240,7 @@ } // no items; not an error; just mention that nothing was added - if (shoppingListItems == null || shoppingListItems.size() == 0) { + if (UtilValidate.isEmpty(shoppingListItems)) { errMsg = UtilProperties.getMessage(resource_error,"shoppinglistevents.no_items_added", cart.getLocale()); return errMsg; } 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=883492&r1=883491&r2=883492&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 Mon Nov 23 20:34:27 2009 @@ -272,7 +272,7 @@ // lookup the records List zipLookup = delegator.findByAnd("ZipSalesTaxLookup", UtilMisc.toMap("zipCode", zipCode), UtilMisc.toList("-fromDate")); - if (zipLookup == null || zipLookup.size() == 0) { + if (UtilValidate.isEmpty(zipLookup)) { throw new GeneralException("The zip code entered is not valid."); } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java Mon Nov 23 20:34:27 2009 @@ -416,7 +416,7 @@ List<GenericValue> productCategoryMembers = EntityUtil.filterByDate(delegator.findByAndCache("ProductCategoryMember", UtilMisc.toMap("productCategoryId", productCategoryId, "productId", productId)), true); - if (productCategoryMembers == null || productCategoryMembers.size() == 0) { + if (UtilValidate.isEmpty(productCategoryMembers)) { //before giving up see if this is a variant product, and if so look up the virtual product and check it... GenericValue product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId)); List<GenericValue> productAssocs = ProductWorker.getVariantVirtualAssocs(product); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java Mon Nov 23 20:34:27 2009 @@ -32,6 +32,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; @@ -195,7 +196,7 @@ } public static String makeFeatureIdByTypeString(Map<String, String> featureIdByType) { - if (featureIdByType == null || featureIdByType.size() == 0) { + if (UtilValidate.isEmpty(featureIdByType)) { return ""; } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java Mon Nov 23 20:34:27 2009 @@ -1355,7 +1355,7 @@ "productPricePurposeId", "PURCHASE"), UtilMisc.toList("-fromDate")); // if no prices are found; find the prices of the parent product - if (prices == null || prices.size() == 0) { + if (UtilValidate.isEmpty(prices)) { GenericValue parentProduct = ProductWorker.getParentProduct(productId, delegator); if (parentProduct != null) { String parentProductId = parentProduct.getString("productId"); @@ -1373,10 +1373,10 @@ // first check for the AVERAGE_COST price type List<GenericValue> pricesToUse = EntityUtil.filterByAnd(prices, UtilMisc.toMap("productPriceTypeId", "AVERAGE_COST")); - if (pricesToUse == null || pricesToUse.size() == 0) { + if (UtilValidate.isEmpty(pricesToUse)) { // next go with default price pricesToUse = EntityUtil.filterByAnd(prices, UtilMisc.toMap("productPriceTypeId", "DEFAULT_PRICE")); - if (pricesToUse == null || pricesToUse.size() == 0) { + if (UtilValidate.isEmpty(pricesToUse)) { // finally use list price pricesToUse = EntityUtil.filterByAnd(prices, UtilMisc.toMap("productPriceTypeId", "LIST_PRICE")); } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Mon Nov 23 20:34:27 2009 @@ -966,7 +966,7 @@ } catch (GenericEntityException e) { Debug.logError(e, "Database error finding CUSTOMER ProductStoreRole records, required by the ProductStore with ID [" + productStore.getString("productStoreId") + "]", module); } - if (productStoreRoleList == null || productStoreRoleList.size() == 0) { + if (UtilValidate.isEmpty(productStoreRoleList)) { // uh-oh, this user isn't associated... String errorMsg = "The " + productStore.getString("storeName") + " [" + productStore.getString("productStoreId") + "] ProductStore requires that customers be associated with it, and the logged in user is NOT associated with it in the CUSTOMER role; userLoginId=[" + userLogin.getString("userLoginId") + "], partyId=[" + userLogin.getString("partyId") + "]"; Debug.logWarning(errorMsg, module); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java Mon Nov 23 20:34:27 2009 @@ -438,7 +438,7 @@ String visitId = VisitHandler.getVisitId(session); ProductSearchOptions productSearchOptions = getProductSearchOptions(session); List<ProductSearchConstraint> productSearchConstraintList = productSearchOptions.getConstraintList(); - if (productSearchConstraintList == null || productSearchConstraintList.size() == 0) { + if (UtilValidate.isEmpty(productSearchConstraintList)) { // no constraints, don't do a search... return new ArrayList<String>(); } @@ -474,7 +474,7 @@ public static void searchAddFeatureIdConstraints(Collection<String> featureIds, Boolean exclude, HttpServletRequest request) { HttpSession session = request.getSession(); - if (featureIds == null || featureIds.size() == 0) { + if (UtilValidate.isEmpty(featureIds)) { return; } for (String productFeatureId: featureIds) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java Mon Nov 23 20:34:27 2009 @@ -197,14 +197,14 @@ Map<String, Object> result = FastMap.newInstance(); List<String> featureOrder = UtilMisc.makeListWritable(UtilGenerics.<String>checkCollection(context.get("featureOrder"))); - if (featureOrder == null || featureOrder.size() == 0) { + if (UtilValidate.isEmpty(featureOrder)) { return ServiceUtil.returnError("Empty list of features passed"); } List<GenericValue> variants = UtilGenerics.checkList(prodFindAllVariants(dctx, context).get("assocProducts")); List<String> virtualVariant = FastList.newInstance(); - if (variants == null || variants.size() == 0) { + if (UtilValidate.isEmpty(variants)) { return ServiceUtil.returnSuccess(); } List<String> items = FastList.newInstance(); @@ -314,7 +314,7 @@ Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); } - if (tree == null || tree.size() == 0) { + if (UtilValidate.isEmpty(tree)) { result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); result.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(resource,"productservices.feature_grouping_came_back_empty", locale)); } else { @@ -818,7 +818,7 @@ } else { // is a GoodIdentification.idValue? List<GenericValue> goodIdentificationList = delegator.findByAnd("GoodIdentification", UtilMisc.toMap("idValue", variantProductId)); - if (goodIdentificationList == null || goodIdentificationList.size() == 0) { + if (UtilValidate.isEmpty(goodIdentificationList)) { // whoops, nothing found... return error return ServiceUtil.returnError("Error creating a virtual with variants: the ID [" + variantProductId + "] is not a valid Product.productId or a GoodIdentification.idValue"); } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java Mon Nov 23 20:34:27 2009 @@ -333,7 +333,7 @@ // check the items excluded from shipping String includeFreeShipping = method.getString("includeNoChargeItems"); if (includeFreeShipping != null && "N".equalsIgnoreCase(includeFreeShipping)) { - if ((itemSizes == null || itemSizes.size() == 0) && orderTotal.compareTo(BigDecimal.ZERO) == 0) { + if (UtilValidate.isEmpty((itemSizes)) && orderTotal.compareTo(BigDecimal.ZERO) == 0) { returnShippingMethods.remove(method); //Debug.logInfo("Removed shipping method due to all items being exempt from shipping", module); continue; @@ -560,7 +560,7 @@ return -1; } - if (surveyResponse == null || surveyResponse.size() == 0) { + if (UtilValidate.isEmpty(surveyResponse)) { return 0; } else { return surveyResponse.size(); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java Mon Nov 23 20:34:27 2009 @@ -620,7 +620,7 @@ return ServiceUtil.returnError(e.getMessage()); } - if (packages == null || packages.size() == 0) { + if (UtilValidate.isEmpty(packages)) { return ServiceUtil.returnError("No packages are available for shipping!"); } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java Mon Nov 23 20:34:27 2009 @@ -582,7 +582,7 @@ } List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, UtilMisc.toList("+shipmentPackageSeqId")); - if (shipmentPackageRouteSegs == null || shipmentPackageRouteSegs.size() == 0) { + if (UtilValidate.isEmpty(shipmentPackageRouteSegs)) { return ServiceUtil.returnError("No ShipmentPackageRouteSegs (ie No Packages) found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId); } if (shipmentPackageRouteSegs.size() != 1) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java Mon Nov 23 20:34:27 2009 @@ -188,7 +188,7 @@ } List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, UtilMisc.toList("+shipmentPackageSeqId")); - if (shipmentPackageRouteSegs == null || shipmentPackageRouteSegs.size() == 0) { + if (UtilValidate.isEmpty(shipmentPackageRouteSegs)) { return ServiceUtil.returnError("No ShipmentPackageRouteSegs (ie No Packages) found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId); } @@ -806,7 +806,7 @@ } List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, UtilMisc.toList("+shipmentPackageSeqId")); - if (shipmentPackageRouteSegs == null || shipmentPackageRouteSegs.size() == 0) { + if (UtilValidate.isEmpty(shipmentPackageRouteSegs)) { return ServiceUtil.returnError("No ShipmentPackageRouteSegs found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId); } @@ -1400,7 +1400,7 @@ } List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, UtilMisc.toList("+shipmentPackageSeqId")); - if (shipmentPackageRouteSegs == null || shipmentPackageRouteSegs.size() == 0) { + if (UtilValidate.isEmpty(shipmentPackageRouteSegs)) { return ServiceUtil.returnError("No ShipmentPackageRouteSegs found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId); } @@ -1824,7 +1824,7 @@ List<? extends Element> rates = UtilXml.childElementList(rateResponseElement, "RatedShipment"); Map<String, BigDecimal> rateMap = FastMap.newInstance(); BigDecimal firstRate = null; - if (rates == null || rates.size() == 0) { + if (UtilValidate.isEmpty(rates)) { return ServiceUtil.returnError("No rates available at this time"); } else { for (Element element: rates) { @@ -2434,7 +2434,7 @@ } List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, UtilMisc.toList("+shipmentPackageSeqId")); - if (shipmentPackageRouteSegs == null || shipmentPackageRouteSegs.size() == 0) { + if (UtilValidate.isEmpty(shipmentPackageRouteSegs)) { return ServiceUtil.returnError("No ShipmentPackageRouteSegs (ie No Packages) found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId); } @@ -2613,7 +2613,7 @@ return ServiceUtil.returnError("ERROR: The Carrier for ShipmentRouteSegment " + shipmentRouteSegmentId + " of Shipment " + shipmentId + ", is not UPS."); } - if (shipmentPackageRouteSegs == null || shipmentPackageRouteSegs.size() == 0) { + if (UtilValidate.isEmpty(shipmentPackageRouteSegs)) { return ServiceUtil.returnError("No ShipmentPackageRouteSegs found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId); } @@ -2863,7 +2863,7 @@ UtilXml.addChildElementValue(shipFromAddressElement, "CountryCode", originCountryGeo.getString("geoCode"), rateRequestDoc); List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, UtilMisc.toList("+shipmentPackageSeqId")); - if (shipmentPackageRouteSegs == null || shipmentPackageRouteSegs.size() == 0) { + if (UtilValidate.isEmpty(shipmentPackageRouteSegs)) { return ServiceUtil.returnError("No ShipmentPackageRouteSegs (ie No Packages) found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId); } for (GenericValue shipmentPackageRouteSeg :shipmentPackageRouteSegs) { @@ -3037,7 +3037,7 @@ if ("1".equals(responseStatusCode)) { List<? extends Element> rates = UtilXml.childElementList(rateResponseElement, "RatedShipment"); Map<String, BigDecimal> rateMap = FastMap.newInstance(); - if (rates == null || rates.size() == 0) { + if (UtilValidate.isEmpty(rates)) { return ServiceUtil.returnError("No rates available at this time"); } else { for (Element element: rates) { Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original) +++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Mon Nov 23 20:34:27 2009 @@ -195,7 +195,7 @@ // create the engines List<ContainerConfig.Container.Property> engineProps = cc.getPropertiesWithValue("engine"); - if (engineProps == null || engineProps.size() == 0) { + if (UtilValidate.isEmpty(engineProps)) { throw new ContainerException("Cannot load CatalinaContainer; no engines defined!"); } for (ContainerConfig.Container.Property engineProp: engineProps) { @@ -207,7 +207,7 @@ // create the connectors List<ContainerConfig.Container.Property> connectorProps = cc.getPropertiesWithValue("connector"); - if (connectorProps == null || connectorProps.size() == 0) { + if (UtilValidate.isEmpty(connectorProps)) { throw new ContainerException("Cannot load CatalinaContainer; no connectors defined!"); } for (ContainerConfig.Container.Property connectorProp: connectorProps) { Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java Mon Nov 23 20:34:27 2009 @@ -86,7 +86,7 @@ } public static Set<String> expandGeoRegionDeep(Set<String> geoIdSet, Delegator delegator) throws GenericEntityException { - if (geoIdSet == null || geoIdSet.size() == 0) { + if (UtilValidate.isEmpty(geoIdSet)) { return geoIdSet; } Set<String> geoIdSetTemp = FastSet.newInstance(); Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/status/StatusServices.java Mon Nov 23 20:34:27 2009 @@ -25,6 +25,8 @@ import javolution.util.FastMap; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; + import static org.ofbiz.base.util.UtilGenerics.checkList; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.Delegator; @@ -43,7 +45,7 @@ public static Map<String, Object> getStatusItems(DispatchContext ctx, Map<String, ?> context) { Delegator delegator = ctx.getDelegator(); List<String> statusTypes = checkList(context.get("statusTypeIds"), String.class); - if (statusTypes == null || statusTypes.size() == 0) { + if (UtilValidate.isEmpty(statusTypes)) { return ServiceUtil.returnError("Parameter statusTypeIds can not be null and must contain at least one element"); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Mon Nov 23 20:34:27 2009 @@ -406,7 +406,7 @@ } Map<String, ModelEntity> entities = FastMap.newInstance(); - if (entityNameSet == null || entityNameSet.size() == 0) { + if (UtilValidate.isEmpty(entityNameSet)) { return entities; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java Mon Nov 23 20:34:27 2009 @@ -943,7 +943,7 @@ public boolean matchesFields(Map<String, ? extends Object> keyValuePairs) { if (fields == null) return true; - if (keyValuePairs == null || keyValuePairs.size() == 0) return true; + if (UtilValidate.isEmpty(keyValuePairs)) return true; for (Map.Entry<String, ? extends Object> anEntry: keyValuePairs.entrySet()) { if (!UtilValidate.areEqual(anEntry.getValue(), this.fields.get(anEntry.getKey()))) { return false; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java Mon Nov 23 20:34:27 2009 @@ -34,6 +34,7 @@ import org.ofbiz.base.config.ResourceHandler; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilTimer; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.cache.UtilCache; import org.ofbiz.entity.GenericEntityConfException; @@ -204,7 +205,7 @@ Set<String> enames = FastSet.newInstance(); if (groupName == null || groupName.length() <= 0) return enames; - if (gc == null || gc.size() == 0) return enames; + if (UtilValidate.isEmpty(gc)) return enames; for (Map.Entry<String, String> entry: gc.entrySet()) { if (groupName.equals(entry.getValue())) enames.add(entry.getKey()); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java Mon Nov 23 20:34:27 2009 @@ -244,7 +244,7 @@ if (values == null) return null; List<T> result = null; - if (fields == null || fields.size() == 0) { + if (UtilValidate.isEmpty(fields)) { result = FastList.newInstance(); result.addAll(values); } else { @@ -267,7 +267,7 @@ */ public static <T extends GenericEntity> List<T> filterByAnd(List<T> values, List<? extends EntityCondition> exprs) { if (values == null) return null; - if (exprs == null || exprs.size() == 0) { + if (UtilValidate.isEmpty(exprs)) { // no constraints... oh well return values; } @@ -296,7 +296,7 @@ */ public static <T extends GenericEntity> List<T> filterByOr(List<T> values, List<? extends EntityCondition> exprs) { if (values == null) return null; - if (exprs == null || exprs.size() == 0) { + if (UtilValidate.isEmpty(exprs)) { return values; } @@ -326,7 +326,7 @@ public static <T extends GenericEntity> List<T> orderBy(Collection<T> values, List<String> orderBy) { if (values == null) return null; if (values.size() == 0) return FastList.newInstance(); - if (orderBy == null || orderBy.size() == 0) { + if (UtilValidate.isEmpty(orderBy)) { List<T> newList = FastList.newInstance(); newList.addAll(values); return newList; Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/DelegatorEcaHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/DelegatorEcaHandler.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/DelegatorEcaHandler.java (original) +++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/DelegatorEcaHandler.java Mon Nov 23 20:34:27 2009 @@ -24,6 +24,8 @@ import java.util.TreeSet; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; + import static org.ofbiz.base.util.UtilGenerics.checkList; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntity; @@ -65,7 +67,7 @@ public void evalRules(String currentOperation, Map<String, List<EntityEcaRule>> eventMap, String event, GenericEntity value, boolean isError) throws GenericEntityException { // if the eventMap is passed we save a HashMap lookup, but if not that's okay we'll just look it up now if (eventMap == null) eventMap = this.getEntityEventMap(value.getEntityName()); - if (eventMap == null || eventMap.size() == 0) { + if (UtilValidate.isEmpty(eventMap)) { //Debug.logInfo("Handler.evalRules for entity " + value.getEntityName() + ", event " + event + ", no eventMap for this entity", module); return; } @@ -73,7 +75,7 @@ List<EntityEcaRule> rules = eventMap.get(event); //Debug.logInfo("Handler.evalRules for entity " + value.getEntityName() + ", event " + event + ", num rules=" + (rules == null ? 0 : rules.size()), module); - if (rules == null || rules.size() == 0) { + if (UtilValidate.isEmpty(rules)) { return; } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java Mon Nov 23 20:34:27 2009 @@ -1036,7 +1036,7 @@ if (source == null) { return target; } - if (contextInfo == null || contextInfo.size() == 0) { + if (UtilValidate.isEmpty(contextInfo)) { return target; } for (ModelParam modelParam: this.contextParamList) { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceValidationException.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceValidationException.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceValidationException.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceValidationException.java Mon Nov 23 20:34:27 2009 @@ -107,7 +107,7 @@ @Override public List<String> getMessageList() { - if (this.messages == null || this.messages.size() == 0) { + if (UtilValidate.isEmpty(this.messages)) { return null; } return this.messages; Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java Mon Nov 23 20:34:27 2009 @@ -32,6 +32,7 @@ import org.ofbiz.base.config.MainResourceHandler; import org.ofbiz.base.config.ResourceHandler; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -142,12 +143,12 @@ public static void evalRules(String serviceName, Map<String, List<ServiceEcaRule>> eventMap, String event, DispatchContext dctx, Map<String, Object> context, Map<String, Object> result, boolean isError, boolean isFailure) throws GenericServiceException { // if the eventMap is passed we save a Map lookup, but if not that's okay we'll just look it up now if (eventMap == null) eventMap = getServiceEventMap(serviceName); - if (eventMap == null || eventMap.size() == 0) { + if (UtilValidate.isEmpty(eventMap)) { return; } Collection<ServiceEcaRule> rules = eventMap.get(event); - if (rules == null || rules.size() == 0) { + if (UtilValidate.isEmpty(rules)) { return; } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java Mon Nov 23 20:34:27 2009 @@ -241,7 +241,7 @@ List<String> trail = null; if (UtilValidate.isNotEmpty(treeString)) { trail = StringUtil.split(treeString, "|"); - if (trail == null || trail.size() == 0) + if (UtilValidate.isEmpty(trail)) throw new RuntimeException("Tree 'trail' value is empty."); context.put("rootEntityId", trail.get(0)); Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java (original) +++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java Mon Nov 23 20:34:27 2009 @@ -289,7 +289,7 @@ } } } - if (orderList == null || orderList.size() == 0) { + if (UtilValidate.isEmpty(orderList)) { Debug.logError("No orders found", module); return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.noOrdersFound", locale)); } Modified: ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java (original) +++ ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java Mon Nov 23 20:34:27 2009 @@ -559,7 +559,7 @@ List<GenericValue> values = delegator.findByAnd("PartyContactMechPurpose", UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId)); - if (values == null || values.size() == 0) { + if (UtilValidate.isEmpty(values)) { Map<String, Object> addPurposeMap = FastMap.newInstance(); addPurposeMap.put("contactMechId", contactMechId); addPurposeMap.put("partyId", partyId); Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java (original) +++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowServices.java Mon Nov 23 20:34:27 2009 @@ -218,7 +218,7 @@ String workEffortId = (String) context.get("workEffortId"); Map appendContext = (Map) context.get("currentContext"); - if (appendContext == null || appendContext.size() == 0) { + if (UtilValidate.isEmpty(appendContext)) { result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); result.put(ModelService.ERROR_MESSAGE, "The passed context is empty"); } Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java?rev=883492&r1=883491&r2=883492&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java (original) +++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java Mon Nov 23 20:34:27 2009 @@ -285,7 +285,7 @@ } protected void readResponsibles(List responsibles, GenericValue valueObject, String prefix) throws DefinitionParserException { - if (responsibles == null || responsibles.size() == 0) { + if (UtilValidate.isEmpty(responsibles)) { return; } @@ -318,7 +318,7 @@ } protected void readExternalPackages(List externalPackages, String packageId, String packageVersion) { - if (externalPackages == null || externalPackages.size() == 0) + if (UtilValidate.isEmpty(externalPackages)) return; Iterator externalPackageIter = externalPackages.iterator(); @@ -334,7 +334,7 @@ } protected void readTypeDeclarations(List typeDeclarations, String packageId, String packageVersion) throws DefinitionParserException { - if (typeDeclarations == null || typeDeclarations.size() == 0) + if (UtilValidate.isEmpty(typeDeclarations)) return; Iterator typeDeclarationsIter = typeDeclarations.iterator(); @@ -362,7 +362,7 @@ // ---------------------------------------------------------------- protected void readWorkflowProcesses(List workflowProcesses, String packageId, String packageVersion) throws DefinitionParserException { - if (workflowProcesses == null || workflowProcesses.size() == 0) + if (UtilValidate.isEmpty(workflowProcesses)) return; Iterator workflowProcessIter = workflowProcesses.iterator(); @@ -533,7 +533,7 @@ protected void readActivities(List activities, String packageId, String packageVersion, String processId, String processVersion, GenericValue processValue) throws DefinitionParserException { - if (activities == null || activities.size() == 0) + if (UtilValidate.isEmpty(activities)) return; Iterator activitiesIter = activities.iterator(); @@ -776,7 +776,7 @@ protected void readTools(List tools, String packageId, String packageVersion, String processId, String processVersion, String activityId) throws DefinitionParserException { - if (tools == null || tools.size() == 0) + if (UtilValidate.isEmpty(tools)) return; Iterator toolsIter = tools.iterator(); @@ -822,7 +822,7 @@ } protected String readActualParameters(List actualParameters) { - if (actualParameters == null || actualParameters.size() == 0) return null; + if (UtilValidate.isEmpty(actualParameters)) return null; StringBuilder actualParametersBuf = new StringBuilder(); Iterator actualParametersIter = actualParameters.iterator(); @@ -837,7 +837,7 @@ } protected String readExtendedAttributes(List extendedAttributes) { - if (extendedAttributes == null || extendedAttributes.size() == 0) return null; + if (UtilValidate.isEmpty(extendedAttributes)) return null; Map ea = new HashMap(); Iterator i = extendedAttributes.iterator(); @@ -855,7 +855,7 @@ protected void readTransitions(List transitions, String packageId, String packageVersion, String processId, String processVersion) throws DefinitionParserException { - if (transitions == null || transitions.size() == 0) + if (UtilValidate.isEmpty(transitions)) return; Iterator transitionsIter = transitions.iterator(); @@ -921,7 +921,7 @@ } protected void readTransitionRestrictions(List transitionRestrictions, GenericValue activityValue) throws DefinitionParserException { - if (transitionRestrictions == null || transitionRestrictions.size() == 0) + if (UtilValidate.isEmpty(transitionRestrictions)) return; Iterator transitionRestrictionsIter = transitionRestrictions.iterator(); @@ -986,7 +986,7 @@ } protected void readTransitionRefs(List transitionRefs, String packageId, String packageVersion, String processId, String processVersion, String activityId) throws DefinitionParserException { - if (transitionRefs == null || transitionRefs.size() == 0) + if (UtilValidate.isEmpty(transitionRefs)) return; Iterator transitionRefsIter = transitionRefs.iterator(); @@ -1010,7 +1010,7 @@ // ---------------------------------------------------------------- protected void readParticipants(List participants, String packageId, String packageVersion, String processId, String processVersion, GenericValue valueObject) throws DefinitionParserException { - if (participants == null || participants.size() == 0) + if (UtilValidate.isEmpty(participants)) return; Iterator participantsIter = participants.iterator(); @@ -1046,7 +1046,7 @@ /* protected void readParticipants(List participants, String packageId, String packageVersion, String processId, String processVersion, GenericValue valueObject) throws DefinitionParserException { - if (participants == null || participants.size() == 0) + if (UtilValidate.isEmpty(participants)) return; Long nextSeqId = delegator.getNextSeqId("WorkflowParticipantList"); @@ -1112,7 +1112,7 @@ protected void readApplications(List applications, String packageId, String packageVersion, String processId, String processVersion) throws DefinitionParserException { - if (applications == null || applications.size() == 0) + if (UtilValidate.isEmpty(applications)) return; Iterator applicationsIter = applications.iterator(); @@ -1144,7 +1144,7 @@ protected void readDataFields(List dataFields, String packageId, String packageVersion, String processId, String processVersion) throws DefinitionParserException { - if (dataFields == null || dataFields.size() == 0) + if (UtilValidate.isEmpty(dataFields)) return; Iterator dataFieldsIter = dataFields.iterator(); @@ -1156,7 +1156,7 @@ String dataFieldId = dataFieldElement.getAttribute("Id"); String dataFieldName = dataFieldElement.getAttribute("Name"); - if (dataFieldName == null || dataFieldName.length() == 0) + if (UtilValidate.isEmpty(dataFieldName)) dataFieldName = dataFieldId; dataFieldValue.set("packageId", packageId); @@ -1198,7 +1198,7 @@ protected void readFormalParameters(List formalParameters, String packageId, String packageVersion, String processId, String processVersion, String applicationId) throws DefinitionParserException { - if (formalParameters == null || formalParameters.size() == 0) + if (UtilValidate.isEmpty(formalParameters)) return; Iterator formalParametersIter = formalParameters.iterator(); long index = 1; @@ -1288,7 +1288,7 @@ return defaultValue; List extendedAttributes = UtilXml.childElementList(extendedAttributesElement, "ExtendedAttribute"); - if (extendedAttributes == null || extendedAttributes.size() == 0) + if (UtilValidate.isEmpty(extendedAttributes)) return defaultValue; Iterator iter = extendedAttributes.iterator(); |
Free forum by Nabble | Edit this page |