Author: jleroux
Date: Mon Nov 23 23:41:34 2009 New Revision: 883549 URL: http://svn.apache.org/viewvc?rev=883549&view=rev Log: Use UtilValidate.isNotEmpty methods instead of (obj != null) || (obj.length > 0) and (obj != null) || (obj.size > 0) Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java ofbiz/trunk/applications/content/src/ControlApplet.java ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.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/data/DataServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/contact/GetContactListMarketingEmail.groovy ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.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/ShoppingCartEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.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/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.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/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java ofbiz/trunk/framework/base/src/org/ofbiz/base/component/ComponentConfig.java ofbiz/trunk/framework/base/src/org/ofbiz/base/config/ResourceLoader.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile2EntityXml.java ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaAction.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallBsh.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/FlexibleMessage.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.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/ifops/CheckPermission.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfHasPermission.java ofbiz/trunk/framework/security/src/org/ofbiz/security/OFBizSecurity.java ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/AbstractAuthorization.java ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/EntityAuthorization.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelPermGroup.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/eca/ServiceEcaAction.java ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaCondition.java ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsServiceEngine.java ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceMultiEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/PropFindHelper.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/ViewGeneric.groovy ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/jpos/service/KeyboardService.java ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/repository/EntityRepositoryMgr.java ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/client/WorkflowClient.java ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfProcessImpl.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=883549&r1=883548&r2=883549&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 Mon Nov 23 23:41:34 2009 @@ -845,7 +845,7 @@ String invoiceItemSeqId = invoiceItem.getString("invoiceItemSeqId"); String invoiceId = invoiceItem.getString("invoiceId"); // Determine commission parties for this invoiceItem - if (productId != null && productId.length() > 0) { + if (UtilValidate.isNotEmpty(productId)) { Map<String, Object> resultMap = null; try { resultMap = dispatcher.runSync("getCommissionForProduct", UtilMisc.<String, Object>toMap( @@ -1730,7 +1730,7 @@ billings = delegator.findByAnd("ReturnItemBilling", UtilMisc.toMap("returnId", returnId, "returnItemSeqId", returnItemSeqId)); } // if there are billings, we have already billed the item, so skip it - if (billings != null && billings.size() > 0) continue; + if (UtilValidate.isNotEmpty(billings)) continue; // get the List of items shipped to/from this returnId List<GenericValue> billItems = itemsShippedGroupedByReturn.get(returnId); 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=883549&r1=883548&r2=883549&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 Mon Nov 23 23:41:34 2009 @@ -3159,7 +3159,7 @@ } Debug.logInfo("Running credit card verification [" + paymentMethodId + "] (" + amount + ") : " + productStorePaymentProperties + " : " + mode, module); - if (amount != null && amount.length() > 0) { + if (UtilValidate.isNotEmpty(amount)) { BigDecimal authAmount = new BigDecimal(amount); if (authAmount.compareTo(BigDecimal.ZERO) > 0) { Map<String, Object> ccAuthContext = FastMap.newInstance(); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentMethodServices.java Mon Nov 23 23:41:34 2009 @@ -183,7 +183,7 @@ GenericValue newPartyContactMechPurpose = null; String contactMechId = (String) context.get("contactMechId"); - if (contactMechId != null && contactMechId.length() > 0 && !contactMechId.equals("_NEW_")) { + if (UtilValidate.isNotEmpty(contactMechId) && !contactMechId.equals("_NEW_")) { // set the contactMechId on the credit card newCc.set("contactMechId", context.get("contactMechId")); // add a PartyContactMechPurpose of BILLING_LOCATION if necessary @@ -334,7 +334,7 @@ GenericValue newPartyContactMechPurpose = null; String contactMechId = (String) context.get("contactMechId"); - if (contactMechId != null && contactMechId.length() > 0 && !contactMechId.equals("_NEW_")) { + if (UtilValidate.isNotEmpty(contactMechId) && !contactMechId.equals("_NEW_")) { // set the contactMechId on the credit card newCc.set("contactMechId", contactMechId); } @@ -347,7 +347,7 @@ isModified = true; } - if (contactMechId != null && contactMechId.length() > 0 && !contactMechId.equals("_NEW_")) { + if (UtilValidate.isNotEmpty(contactMechId) && !contactMechId.equals("_NEW_")) { // add a PartyContactMechPurpose of BILLING_LOCATION if necessary String contactMechPurposeTypeId = "BILLING_LOCATION"; @@ -671,7 +671,7 @@ GenericValue newPartyContactMechPurpose = null; String contactMechId = (String) context.get("contactMechId"); - if (contactMechId != null && contactMechId.length() > 0) { + if (UtilValidate.isNotEmpty(contactMechId)) { // add a PartyContactMechPurpose of BILLING_LOCATION if necessary String contactMechPurposeTypeId = "BILLING_LOCATION"; @@ -787,7 +787,7 @@ GenericValue newPartyContactMechPurpose = null; String contactMechId = (String) context.get("contactMechId"); - if (contactMechId != null && contactMechId.length() > 0) { + if (UtilValidate.isNotEmpty(contactMechId)) { // add a PartyContactMechPurpose of BILLING_LOCATION if necessary String contactMechPurposeTypeId = "BILLING_LOCATION"; Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java Mon Nov 23 23:41:34 2009 @@ -399,7 +399,7 @@ private static void buildMerchantInfo(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) { AIMRequest.put("x_Login", props.getProperty("login")); String trankey = props.getProperty("trankey"); - if (trankey != null && trankey.length() > 0) { + if (UtilValidate.isNotEmpty(trankey)) { AIMRequest.put("x_Tran_Key", props.getProperty("trankey")); } AIMRequest.put("x_Password",props.getProperty("password")); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java Mon Nov 23 23:41:34 2009 @@ -21,6 +21,8 @@ import java.util.*; +import org.ofbiz.base.util.UtilValidate; + public class AuthorizeResponse { private String rawResp = null; @@ -114,7 +116,7 @@ public void setVersion(String version) { - if (version != null && version.length() > 0) + if (UtilValidate.isNotEmpty(version)) { if (version.equals("3.0") || version.equals("3.1")) this.version = version; Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Mon Nov 23 23:41:34 2009 @@ -261,7 +261,7 @@ props.put("logDirectory", logDir); props.put("logFilename", logFile); props.put("logMaximumSize", logSize); - if (keysFile != null && keysFile.length() > 0) { + if (UtilValidate.isNotEmpty(keysFile)) { props.put("alternateKeyFilename", keysFile); } Debug.log("Created CyberSource Properties : " + props, module); @@ -383,12 +383,12 @@ } if (avsOverride != null && avsOverride.get("avsDeclineString") != null) { String overrideString = avsOverride.getString("avsDeclineString"); - if (overrideString != null && overrideString.length() > 0) { + if (UtilValidate.isNotEmpty(overrideString)) { avsCodes = overrideString; } } } - if (avsCodes != null && avsCodes.length() > 0) { + if (UtilValidate.isNotEmpty(avsCodes)) { request.put("businessRules_declineAVSFlags", avsCodes); } String avsIgnore = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "ignoreAvs", configString, "payment.cybersource.ignoreAvs", "false"); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java Mon Nov 23 23:41:34 2009 @@ -64,6 +64,7 @@ import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; @@ -706,7 +707,7 @@ // mode settings String modes = (String) props.get("payment.valuelink.modes"); - if (modes != null && modes.length() > 0) { + if (UtilValidate.isNotEmpty(modes)) { request.put("Modes", modes); } Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java Mon Nov 23 23:41:34 2009 @@ -209,26 +209,26 @@ ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props); Map request = vl.getInitialRequestMap(context); request.put("Interface", iFace != null ? iFace : "Activate"); - if (vlPromoCode != null && vlPromoCode.length() > 0) { + if (UtilValidate.isNotEmpty(vlPromoCode)) { request.put("PromoCode", vlPromoCode); } request.put("Amount", vl.getAmount(amount)); request.put("LocalCurr", vl.getCurrency(currency)); - if (cardNumber != null && cardNumber.length() > 0) { + if (UtilValidate.isNotEmpty(cardNumber)) { request.put("CardNo", cardNumber); } - if (pin != null && pin.length() > 0) { + if (UtilValidate.isNotEmpty(pin)) { request.put("PIN", vl.encryptPin(pin)); } // user defined field #1 - if (orderId != null && orderId.length() > 0) { + if (UtilValidate.isNotEmpty(orderId)) { request.put("User1", orderId); } // user defined field #2 - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { request.put("User2", partyId); } @@ -287,7 +287,7 @@ request.put("PPIN", vl.encryptPin(physicalPin)); // user defined field #2 - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { request.put("User2", partyId); } @@ -340,12 +340,12 @@ request.put("Amount", vl.getAmount(amount)); // user defined field #1 - if (orderId != null && orderId.length() > 0) { + if (UtilValidate.isNotEmpty(orderId)) { request.put("User1", orderId); } // user defined field #2 - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { request.put("User2", partyId); } @@ -401,12 +401,12 @@ request.put("LocalCurr", vl.getCurrency(currency)); // user defined field #1 - if (orderId != null && orderId.length() > 0) { + if (UtilValidate.isNotEmpty(orderId)) { request.put("User1", orderId); } // user defined field #2 - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { request.put("User2", partyId); } @@ -468,12 +468,12 @@ request.put("LocalCurr", vl.getCurrency(currency)); // user defined field #1 - if (orderId != null && orderId.length() > 0) { + if (UtilValidate.isNotEmpty(orderId)) { request.put("User1", orderId); } // user defined field #2 - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { request.put("User2", partyId); } @@ -529,12 +529,12 @@ request.put("LocalCurr", vl.getCurrency(currency)); // user defined field #1 - if (orderId != null && orderId.length() > 0) { + if (UtilValidate.isNotEmpty(orderId)) { request.put("User1", orderId); } // user defined field #2 - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { request.put("User2", partyId); } @@ -583,12 +583,12 @@ request.put("PIN", vl.encryptPin(pin)); // user defined field #1 - if (orderId != null && orderId.length() > 0) { + if (UtilValidate.isNotEmpty(orderId)) { request.put("User1", orderId); } // user defined field #2 - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { request.put("User2", partyId); } @@ -645,12 +645,12 @@ request.put("LocalCurr", vl.getCurrency(currency)); // user defined field #1 - if (orderId != null && orderId.length() > 0) { + if (UtilValidate.isNotEmpty(orderId)) { request.put("User1", orderId); } // user defined field #2 - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { request.put("User2", partyId); } Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java Mon Nov 23 23:41:34 2009 @@ -144,7 +144,7 @@ // gather the address info if (ps != null) { - String street = ps.getString("address1") + (ps.get("address2") != null && ps.getString("address2").length() > 0 ? " " + ps.getString("address2") : ""); + String street = ps.getString(UtilValidate.isNotEmpty(ps.getString("address2")) ? " " + ps.getString("address2") : ""); data.put("STREET", street); data.put("ZIP", ps.getString("postalCode")); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java Mon Nov 23 23:41:34 2009 @@ -137,9 +137,9 @@ // string of customer's name String name = ""; if (contactAddress != null) { - if (contactAddress.get("attnName") != null && contactAddress.getString("attnName").length() > 0) + if (UtilValidate.isNotEmpty(contactAddress.getString("attnName"))) name = contactAddress.getString("attnName"); - else if (contactAddress.get("toName") != null && contactAddress.getString("toName").length() > 0) + else if (UtilValidate.isNotEmpty(contactAddress.getString("toName"))) name = contactAddress.getString("toName"); } // build an address string @@ -191,9 +191,9 @@ GenericValue contactMechShip = EntityUtil.getFirst(shippingAddresses); contactAddressShip = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", contactMechShip.getString("contactMechId")), false); if (UtilValidate.isNotEmpty(contactAddressShip)) { - if (contactAddressShip.get("attnName") != null && contactAddressShip.getString("attnName").length() > 0) { + if (UtilValidate.isNotEmpty(contactAddressShip.getString("attnName"))) { shipName = contactAddressShip.getString("attnName"); - } else if (contactAddressShip.get("toName") != null && contactAddressShip.getString("toName").length() > 0) { + } else if (UtilValidate.isNotEmpty(contactAddressShip.getString("toName"))) { shipName = contactAddressShip.getString("toName"); } if (contactAddressShip.get("address1") != null) { Modified: ofbiz/trunk/applications/content/src/ControlApplet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/ControlApplet.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/ControlApplet.java (original) +++ ofbiz/trunk/applications/content/src/ControlApplet.java Mon Nov 23 23:41:34 2009 @@ -32,6 +32,8 @@ import java.util.Iterator; import java.util.Map; +import org.ofbiz.base.util.UtilValidate; + /** * Control Applet - Client applet for page pushing and (future) chat */ @@ -86,11 +88,11 @@ boolean visitOkay = false; boolean pageOkay = false; - if (sessionId != null && sessionId.length() > 0) + if (UtilValidate.isNotEmpty(sessionId)) sessionOkay = true; - if (visitId != null && visitId.length() > 0) + if (UtilValidate.isNotEmpty(visitId)) visitOkay = true; - if (currentPage != null && currentPage.length() > 0) + if (UtilValidate.isNotEmpty(currentPage)) pageOkay = true; if (sessionOkay && visitOkay && pageOkay) { @@ -146,7 +148,7 @@ } } - if (pullResp != null && pullResp.length() > 0) { + if (UtilValidate.isNotEmpty(pullResp)) { URL docUrl = null; try { docUrl = new URL(pullResp); @@ -217,7 +219,7 @@ valueStr = value.toString(); } - if (valueStr != null && valueStr.length() > 0) { + if (UtilValidate.isNotEmpty(valueStr)) { if (buf.length() > 0) buf.append('&'); try { buf.append(URLEncoder.encode(name, "UTF-8")); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java Mon Nov 23 23:41:34 2009 @@ -139,12 +139,12 @@ while (it.hasNext()) { String ky = (String)it.next(); String val = (String)pk.get(ky); - if (val != null && val.length() > 0) { + if (UtilValidate.isNotEmpty(val)) { if (sig.length() > 0) sig += "_"; sig += val; } } - if (suffix != null && suffix.length() > 0) { + if (UtilValidate.isNotEmpty(suffix)) { if (sig.length() > 0) sig += "_"; sig += suffix; } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java Mon Nov 23 23:41:34 2009 @@ -193,12 +193,12 @@ String fromDateStr = (String) context.get("fromDateStr"); String thruDateStr = (String) context.get("thruDateStr"); Timestamp fromDate = null; - if (fromDateStr != null && fromDateStr.length() > 0) { + if (UtilValidate.isNotEmpty(fromDateStr)) { fromDate = UtilDateTime.toTimestamp(fromDateStr); } Timestamp thruDate = null; - if (thruDateStr != null && thruDateStr.length() > 0) { + if (UtilValidate.isNotEmpty(thruDateStr)) { thruDate = UtilDateTime.toTimestamp(thruDateStr); } 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=883549&r1=883548&r2=883549&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 Mon Nov 23 23:41:34 2009 @@ -702,7 +702,7 @@ public static boolean checkWhen(Map context, String whenStr) { boolean isWhen = true; //opposite default from checkReturnWhen - if (whenStr != null && whenStr.length() > 0) { + if (UtilValidate.isNotEmpty(whenStr)) { FlexibleStringExpander fse = FlexibleStringExpander.getInstance(whenStr); String newWhen = fse.expandString(context); //if (Debug.infoOn()) Debug.logInfo("newWhen:" + newWhen,null); @@ -722,7 +722,7 @@ public static boolean checkReturnWhen(Map<String, Object> context, String whenStr) { boolean isWhen = false; //opposite default from checkWhen - if (whenStr != null && whenStr.length() > 0) { + if (UtilValidate.isNotEmpty(whenStr)) { FlexibleStringExpander fse = FlexibleStringExpander.getInstance(whenStr); String newWhen = fse.expandString(context); try { 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=883549&r1=883548&r2=883549&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 Mon Nov 23 23:41:34 2009 @@ -306,7 +306,7 @@ // It is possible that permission to work with DataResources will be controlled // by an external Content entity. String ownerContentId = (String) context.get("ownerContentId"); - if (ownerContentId != null && ownerContentId.length() > 0) { + if (UtilValidate.isNotEmpty(ownerContentId)) { try { GenericValue content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", ownerContentId)); if (content != null) Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java Mon Nov 23 23:41:34 2009 @@ -152,7 +152,7 @@ Delegator delegator = dctx.getDelegator(); String dataResourceId = (String) context.get("dataResourceId"); String textData = (String) context.get("textData"); - if (textData != null && textData.length() > 0) { + if (UtilValidate.isNotEmpty(textData)) { GenericValue electronicText = delegator.makeValue("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId, "textData", textData)); try { electronicText.create(); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java Mon Nov 23 23:41:34 2009 @@ -116,12 +116,12 @@ String fromDateStr = (String)templateRoot.get("fromDateStr"); String thruDateStr = (String)templateRoot.get("thruDateStr"); Timestamp fromDate = null; - if (fromDateStr != null && fromDateStr.length() > 0) { + if (UtilValidate.isNotEmpty(fromDateStr)) { fromDate = UtilDateTime.toTimestamp(fromDateStr); } traverseContext.put("fromDate", fromDate); Timestamp thruDate = null; - if (thruDateStr != null && thruDateStr.length() > 0) { + if (UtilValidate.isNotEmpty(thruDateStr)) { thruDate = UtilDateTime.toTimestamp(thruDateStr); } traverseContext.put("thruDate", thruDate); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java Mon Nov 23 23:41:34 2009 @@ -134,12 +134,12 @@ String fromDateStr = (String)templateCtx.get("fromDateStr"); String thruDateStr = (String)templateCtx.get("thruDateStr"); Timestamp fromDate = null; - if (fromDateStr != null && fromDateStr.length() > 0) { + if (UtilValidate.isNotEmpty(fromDateStr)) { fromDate = UtilDateTime.toTimestamp(fromDateStr); } traverseContext.put("fromDate", fromDate); Timestamp thruDate = null; - if (thruDateStr != null && thruDateStr.length() > 0) { + if (UtilValidate.isNotEmpty(thruDateStr)) { thruDate = UtilDateTime.toTimestamp(thruDateStr); } traverseContext.put("thruDate", thruDate); Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java Mon Nov 23 23:41:34 2009 @@ -373,7 +373,7 @@ Debug.logWarning(e.getMessage(), module); } } - return (GenericValue)(productionRunRoutingTasks != null && productionRunRoutingTasks.size() > 0? productionRunRoutingTasks.get(productionRunRoutingTasks.size() - 1): null); + return (GenericValue) (UtilValidate.isNotEmpty(productionRunRoutingTasks) ? productionRunRoutingTasks.get(productionRunRoutingTasks.size() - 1): null); } return null; } Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java Mon Nov 23 23:41:34 2009 @@ -24,6 +24,7 @@ import org.ofbiz.base.util.Debug; 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; @@ -76,7 +77,7 @@ List tasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", workEffortId, "workEffortTypeId", "PROD_ORDER_TASK", "workEffortName", taskName)); - return (tasks != null && tasks.size() > 0); + return (UtilValidate.isNotEmpty(tasks)); } public static void getLinkedProductionRuns(Delegator delegator, LocalDispatcher dispatcher, String productionRunId, List productionRuns) throws GenericEntityException { Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java (original) +++ ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java Mon Nov 23 23:41:34 2009 @@ -246,7 +246,7 @@ // if site id exist in cookies then it is not required to create it, if exist with different site then create it int siteIdCookieAge = (60 * 60 * 24 * 365); // should this be configurable? String siteId = request.getParameter("siteId"); - if (siteId != null && siteId.length() > 0) { + if (UtilValidate.isNotEmpty(siteId)) { String visitorSiteIdCookieName = "Ofbiz.TKCD.SiteId"; String visitorSiteId = null; // first try to get the current ID from the visitor cookie @@ -285,7 +285,7 @@ if (overrideCss != null) session.setAttribute("overrideCss", overrideCss); String prodCatalogId = trackingCode.getString("prodCatalogId"); - if (prodCatalogId != null && prodCatalogId.length() > 0) { + if (UtilValidate.isNotEmpty(prodCatalogId)) { session.setAttribute("CURRENT_CATALOG_ID", prodCatalogId); CategoryWorker.setTrail(request, FastList.<String>newInstance()); } Modified: ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/contact/GetContactListMarketingEmail.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/contact/GetContactListMarketingEmail.groovy?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/contact/GetContactListMarketingEmail.groovy (original) +++ ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/contact/GetContactListMarketingEmail.groovy Mon Nov 23 23:41:34 2009 @@ -17,6 +17,8 @@ * under the License. */ +import org.ofbiz.base.util.UtilValidate; + // figure out the MARKETING_EMAIL of the ContactList owner, for setting in the send email link if (!contactList && contactListId) { contactList = delegator.findOne("ContactList", [contactListId : "contactListId"], true); @@ -29,7 +31,7 @@ contactMechs = ownerParty.getRelatedByAnd("PartyContactMechPurpose", [contactMechPurposeTypeId : "PRIMARY_EMAIL"]); } - if (contactMechs != null && contactMechs.size() > 0) { + if (UtilValidate.isNotEmpty(contactMechs)) { context.marketingEmail = contactMechs.get(0); //context.contactMechIdFrom = context.marketingEmail.contactMechId; } 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=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java Mon Nov 23 23:41:34 2009 @@ -75,7 +75,7 @@ try { paymentPrefs = delegator.findByAnd("OrderPaymentPreference", UtilMisc.toMap("orderId", orderId)); List pRoles = delegator.findByAnd("OrderRole", UtilMisc.toMap("orderId", orderId, "roleTypeId", "PLACING_CUSTOMER")); - if (pRoles != null && pRoles.size() > 0) + if (UtilValidate.isNotEmpty(pRoles)) placingCustomer = EntityUtil.getFirst(pRoles); } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up order payment preferences", module); @@ -171,7 +171,7 @@ GenericValue placingCustomer = null; try { List pRoles = delegator.findByAnd("OrderRole", UtilMisc.toMap("orderId", orderId, "roleTypeId", "PLACING_CUSTOMER")); - if (pRoles != null && pRoles.size() > 0) + if (UtilValidate.isNotEmpty(pRoles)) placingCustomer = EntityUtil.getFirst(pRoles); } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up order payment preferences", module); 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -237,7 +237,7 @@ } // get the email setting and send the mail - if (productStoreId != null && productStoreId.length() > 0) { + if (UtilValidate.isNotEmpty(productStoreId)) { Map sendMap = FastMap.newInstance(); GenericValue productStoreEmail = null; @@ -695,7 +695,7 @@ BigDecimal adjustments = getReturnAdjustmentTotal(delegator, UtilMisc.toMap("returnId", returnId, "returnTypeId", "RTN_CREDIT")); - if (returnHeader != null && ((returnItems != null && returnItems.size() > 0) || adjustments.compareTo(ZERO) > 0)) { + if (returnHeader != null && (UtilValidate.isNotEmpty(returnItems) || adjustments.compareTo(ZERO) > 0)) { String finAccountId = returnHeader.getString("finAccountId"); String billingAccountId = returnHeader.getString("billingAccountId"); String fromPartyId = returnHeader.getString("fromPartyId"); @@ -1162,7 +1162,7 @@ BigDecimal adjustments = getReturnAdjustmentTotal(delegator, UtilMisc.toMap("returnId", returnId, "returnTypeId", returnTypeId)); - if (returnHeader != null && ((returnItems != null && returnItems.size() > 0) || adjustments.compareTo(ZERO) > 0)) { + if (returnHeader != null && (UtilValidate.isNotEmpty(returnItems) || adjustments.compareTo(ZERO) > 0)) { Map itemsByOrder = new HashMap(); Map totalByOrder = new HashMap(); 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -62,7 +62,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_error, "checkevents.cart_empty", (cart != null ? cart.getLocale() : Locale.getDefault())); @@ -302,7 +302,7 @@ } String amountStr = request.getParameter("amount_" + paymentMethods[i]); BigDecimal amount = null; - if (amountStr != null && amountStr.length() > 0 && !"REMAINING".equals(amountStr)) { + if (UtilValidate.isNotEmpty(amountStr) && !"REMAINING".equals(amountStr)) { try { amount = new BigDecimal(amountStr); } catch (NumberFormatException e) { 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -197,7 +197,7 @@ // interal code this.cart.setInternalCode(internalCode); - if (shipBeforeDate != null && shipBeforeDate.length() > 0) { + if (UtilValidate.isNotEmpty(shipBeforeDate)) { if (UtilValidate.isDate(shipBeforeDate)) { cart.setShipBeforeDate(UtilDateTime.toTimestamp(shipBeforeDate)); } else { @@ -206,7 +206,7 @@ } } - if (shipAfterDate != null && shipAfterDate.length() > 0) { + if (UtilValidate.isNotEmpty(shipAfterDate)) { if (UtilValidate.isDate(shipAfterDate)) { cart.setShipAfterDate(UtilDateTime.toTimestamp(shipAfterDate)); } else { @@ -495,7 +495,7 @@ gcFieldsOkay = false; } } - if (gcAmt != null && gcAmt.length() > 0) { + if (UtilValidate.isNotEmpty(gcAmt)) { try { gcAmount = new BigDecimal(gcAmt); } catch (NumberFormatException e) { @@ -603,7 +603,7 @@ try { storeResult = dispatcher.runSync("storeOrder", context); orderId = (String) storeResult.get("orderId"); - if (orderId != null && orderId.length() > 0) { + if (UtilValidate.isNotEmpty(orderId)) { this.cart.setOrderId(orderId); if (this.cart.getFirstAttemptOrderId() == null) { this.cart.setFirstAttemptOrderId(orderId); @@ -1519,12 +1519,12 @@ BigDecimal selectedPaymentTotal = cart.getPaymentTotal(); BigDecimal requiredAmount = reqAmtPreParse.setScale(scale, rounding); - if (paymentMethods != null && paymentMethods.size() > 0 && requiredAmount.compareTo(selectedPaymentTotal) > 0) { + if (UtilValidate.isNotEmpty(paymentMethods) && requiredAmount.compareTo(selectedPaymentTotal) > 0) { Debug.logError("Required Amount : " + requiredAmount + " / Selected Amount : " + selectedPaymentTotal, module); errMsg = UtilProperties.getMessage(resource_error, "checkevents.payment_not_cover_this_order", (cart != null ? cart.getLocale() : Locale.getDefault())); return ServiceUtil.returnError(errMsg); } - if (paymentMethods != null && paymentMethods.size() > 0 && requiredAmount.compareTo(selectedPaymentTotal) < 0) { + if (UtilValidate.isNotEmpty(paymentMethods) && requiredAmount.compareTo(selectedPaymentTotal) < 0) { BigDecimal changeAmount = selectedPaymentTotal.subtract(requiredAmount); if (!paymentTypes.contains("CASH")) { Debug.logError("Change Amount : " + changeAmount + " / No cash.", module); 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=883549&r1=883548&r2=883549&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 Mon Nov 23 23:41:34 2009 @@ -430,7 +430,7 @@ // get the ship before date (handles both yyyy-mm-dd input and full timestamp) shipBeforeDateStr = (String) paramMap.remove("shipBeforeDate"); - if (shipBeforeDateStr != null && shipBeforeDateStr.length() > 0) { + if (UtilValidate.isNotEmpty(shipBeforeDateStr)) { if (shipBeforeDateStr.length() == 10) shipBeforeDateStr += " 00:00:00.000"; try { shipBeforeDate = java.sql.Timestamp.valueOf(shipBeforeDateStr); @@ -442,7 +442,7 @@ // get the ship after date (handles both yyyy-mm-dd input and full timestamp) shipAfterDateStr = (String) paramMap.remove("shipAfterDate"); - if (shipAfterDateStr != null && shipAfterDateStr.length() > 0) { + if (UtilValidate.isNotEmpty(shipAfterDateStr)) { if (shipAfterDateStr.length() == 10) shipAfterDateStr += " 00:00:00.000"; try { shipAfterDate = java.sql.Timestamp.valueOf(shipAfterDateStr); @@ -656,7 +656,7 @@ cart.setOrderPartyId(supplierPartyId); cart.setOrderId(orderId); String agreementId = request.getParameter("agreementId_o_0"); - if (agreementId != null && agreementId.length() > 0) { + if (UtilValidate.isNotEmpty(agreementId)) { ShoppingCartHelper sch = new ShoppingCartHelper(delegator, dispatcher, cart); sch.selectAgreement(agreementId); } @@ -1534,7 +1534,7 @@ } String userLoginId = request.getParameter("userLoginId"); if (partyId != null || userLoginId != null) { - if (UtilValidate.isEmpty((partyId)) && userLoginId != null && userLoginId.length() > 0) { + if (UtilValidate.isEmpty((partyId)) && UtilValidate.isNotEmpty(userLoginId)) { GenericValue thisUserLogin = null; try { thisUserLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", userLoginId)); @@ -1547,7 +1547,7 @@ partyId = userLoginId; } } - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { GenericValue thisParty = null; try { thisParty = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId)); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java Mon Nov 23 23:41:34 2009 @@ -404,7 +404,7 @@ continue; } - if (quantStr != null && quantStr.length() > 0) { + if (UtilValidate.isNotEmpty(quantStr)) { BigDecimal quantity = BigDecimal.ZERO; try { @@ -480,7 +480,7 @@ return ServiceUtil.returnError("Requirement with id [" + requirementId + "] doesn't exist."); } - if (quantStr != null && quantStr.length() > 0) { + if (UtilValidate.isNotEmpty(quantStr)) { BigDecimal quantity = BigDecimal.ZERO; try { quantity = new BigDecimal(nf.parse(quantStr).doubleValue()); @@ -697,21 +697,21 @@ item.setReservPersons(reservPersons); } } else if (parameterName.startsWith("shipBeforeDate")) { - if (item != null && quantString.length() > 0) { + if (UtilValidate.isNotEmpty(quantString)) { // input is either yyyy-mm-dd or a full timestamp if (quantString.length() == 10) quantString += " 00:00:00.000"; item.setShipBeforeDate(Timestamp.valueOf(quantString)); } } else if (parameterName.startsWith("shipAfterDate")) { - if (item != null && quantString.length() > 0) { + if (UtilValidate.isNotEmpty(quantString)) { // input is either yyyy-mm-dd or a full timestamp if (quantString.length() == 10) quantString += " 00:00:00.000"; item.setShipAfterDate(Timestamp.valueOf(quantString)); } } else if (parameterName.startsWith("amount")) { - if (item != null && quantString.length() > 0) { + if (UtilValidate.isNotEmpty(quantString)) { BigDecimal amount = new BigDecimal(quantString); if (amount.compareTo(BigDecimal.ZERO) <= 0) { String errMsg = UtilProperties.getMessage(resource_error, "cart.amount_not_positive_number", this.cart.getLocale()); @@ -722,7 +722,7 @@ item.setSelectedAmount(amount); } } else if (parameterName.startsWith("itemType")) { - if (item != null && quantString.length() > 0) { + if (UtilValidate.isNotEmpty(quantString)) { item.setItemType(quantString); } } else { 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=883549&r1=883548&r2=883549&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 Mon Nov 23 23:41:34 2009 @@ -233,7 +233,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/shoppinglist/ShoppingListEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -191,7 +191,7 @@ return "error"; } - if (eventMessage != null && eventMessage.length() > 0) { + if (UtilValidate.isNotEmpty(eventMessage)) { request.setAttribute("_EVENT_MESSAGE_", eventMessage); } 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -179,7 +179,7 @@ } catch (DataFileException e) { Debug.logError(e, module); } - if (entry.get("stateCode") != null && entry.getString("stateCode").length() > 0) { + if (UtilValidate.isNotEmpty(entry.getString("stateCode"))) { GenericValue newValue = delegator.makeValue("ZipSalesRuleLookup"); // PK fields newValue.set("stateCode", entry.get("stateCode") != null ? entry.getString("stateCode").trim() : "_NA_"); @@ -229,7 +229,7 @@ // check for a valid state/province geo String validStates = UtilProperties.getPropertyValue("zipsales.properties", "zipsales.valid.states"); - if (validStates != null && validStates.length() > 0) { + if (UtilValidate.isNotEmpty(validStates)) { List stateSplit = StringUtil.split(validStates, "|"); if (!stateSplit.contains(stateProvince)) { Map result = ServiceUtil.returnSuccess(); @@ -377,7 +377,7 @@ } else { // except if conditions are met boolean qualify = false; - if (condition != null && condition.length() > 0) { + if (UtilValidate.isNotEmpty(condition)) { char[] conditions = condition.toCharArray(); for (int i = 0; i < conditions.length; i++) { switch (conditions[i]) { Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy Mon Nov 23 23:41:34 2009 @@ -107,7 +107,7 @@ // little routine to see if any members have a quantity > 0 assigned members = context.get("productCategoryMembers"); -if (members != null && members.size() > 0) { +if (UtilValidate.isNotEmpty(members)) { for (i = 0; i < members.size(); i++) { productCategoryMember = (GenericValue) members.get(i); if (productCategoryMember.get("quantity") != null && productCategoryMember.getDouble("quantity").doubleValue() > 0.0) { Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java (original) +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java Mon Nov 23 23:41:34 2009 @@ -1173,7 +1173,7 @@ Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); } - if (values != null && values.size() > 0) { + if (UtilValidate.isNotEmpty(values)) { // there should be only one; unique key GenericValue value = values.get(0); @@ -1205,7 +1205,7 @@ Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); } - if (values != null && values.size() > 0) { + if (UtilValidate.isNotEmpty(values)) { // there should be only one; unique key GenericValue value = values.get(0); 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=883549&r1=883548&r2=883549&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 Mon Nov 23 23:41:34 2009 @@ -348,7 +348,7 @@ } catch (GenericEntityException e) { Debug.logWarning(e, module); } - if (partyContactMechPurposes != null && partyContactMechPurposes.size() > 0) + if (UtilValidate.isNotEmpty(partyContactMechPurposes)) target.put("partyContactMechPurposes", partyContactMechPurposes); } @@ -559,7 +559,7 @@ } catch (GenericEntityException e) { Debug.logWarning(e, module); } - if (facilityContactMechPurposes != null && facilityContactMechPurposes.size() > 0) + if (UtilValidate.isNotEmpty(facilityContactMechPurposes)) target.put("facilityContactMechPurposes", facilityContactMechPurposes); } Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java (original) +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java Mon Nov 23 23:41:34 2009 @@ -112,7 +112,7 @@ String description = (String) context.get("description"); // if specified partyId starts with a number, return an error - if (partyId != null && partyId.length() > 0 && Character.isDigit(partyId.charAt(0))) { + if (UtilValidate.isNotEmpty(partyId) && Character.isDigit(partyId.charAt(0))) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "party.id_is_digit", locale)); } @@ -986,7 +986,7 @@ String roleTypeId; try { roleTypeId = (String) context.get("roleTypeId"); - if (roleTypeId != null && roleTypeId.length() > 0) { + if (UtilValidate.isNotEmpty(roleTypeId)) { GenericValue currentRole = delegator.findByPrimaryKeyCache("RoleType", UtilMisc.toMap("roleTypeId", roleTypeId)); result.put("currentRole", currentRole); } @@ -1010,7 +1010,7 @@ String partyTypeId; try { partyTypeId = (String) context.get("partyTypeId"); - if (partyTypeId != null && partyTypeId.length() > 0) { + if (UtilValidate.isNotEmpty(partyTypeId)) { GenericValue currentPartyType = delegator.findByPrimaryKeyCache("PartyType", UtilMisc.toMap("partyTypeId", partyTypeId)); result.put("currentPartyType", currentPartyType); } @@ -1024,7 +1024,7 @@ String stateProvinceGeoId; try { stateProvinceGeoId = (String) context.get("stateProvinceGeoId"); - if (stateProvinceGeoId != null && stateProvinceGeoId.length() > 0) { + if (UtilValidate.isNotEmpty(stateProvinceGeoId)) { GenericValue currentStateGeo = delegator.findByPrimaryKeyCache("Geo", UtilMisc.toMap("geoId", stateProvinceGeoId)); result.put("currentStateGeo", currentStateGeo); } @@ -1123,7 +1123,7 @@ if (!"Y".equals(showAll)) { // check for a partyId - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { paramList = paramList + "&partyId=" + partyId; andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyId"), EntityOperator.LIKE, EntityFunction.UPPER("%"+partyId+"%"))); } @@ -1149,7 +1149,7 @@ // ---- // filter on user login - if (userLoginId != null && userLoginId.length() > 0) { + if (UtilValidate.isNotEmpty(userLoginId)) { paramList = paramList + "&userLoginId=" + userLoginId; // modify the dynamic view @@ -1168,7 +1168,7 @@ // ---- // filter on groupName - if (groupName != null && groupName.length() > 0) { + if (UtilValidate.isNotEmpty(groupName)) { paramList = paramList + "&groupName=" + groupName; // modify the dynamic view @@ -1187,7 +1187,7 @@ // ---- // modify the dynamic view - if ((firstName != null && firstName.length() > 0) || (lastName != null && lastName.length() > 0)) { + if (UtilValidate.isNotEmpty(firstName) || UtilValidate.isNotEmpty(lastName)) { dynamicView.addMemberEntity("PE", "Person"); dynamicView.addAlias("PE", "firstName"); dynamicView.addAlias("PE", "lastName"); @@ -1200,13 +1200,13 @@ } // filter on firstName - if (firstName != null && firstName.length() > 0) { + if (UtilValidate.isNotEmpty(firstName)) { paramList = paramList + "&firstName=" + firstName; andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("firstName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+firstName+"%"))); } // filter on lastName - if (lastName != null && lastName.length() > 0) { + if (UtilValidate.isNotEmpty(lastName)) { paramList = paramList + "&lastName=" + lastName; andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+lastName+"%"))); } @@ -1288,21 +1288,21 @@ // filter on address1 String address1 = (String) context.get("address1"); - if (address1 != null && address1.length() > 0) { + if (UtilValidate.isNotEmpty(address1)) { paramList = paramList + "&address1=" + address1; andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("address1"), EntityOperator.LIKE, EntityFunction.UPPER("%" + address1 + "%"))); } // filter on address2 String address2 = (String) context.get("address2"); - if (address2 != null && address2.length() > 0) { + if (UtilValidate.isNotEmpty(address2)) { paramList = paramList + "&address2=" + address2; andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("address2"), EntityOperator.LIKE, EntityFunction.UPPER("%" + address2 + "%"))); } // filter on city String city = (String) context.get("city"); - if (city != null && city.length() > 0) { + if (UtilValidate.isNotEmpty(city)) { paramList = paramList + "&city=" + city; andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("city"), EntityOperator.LIKE, EntityFunction.UPPER("%" + city + "%"))); } @@ -1315,7 +1315,7 @@ // filter on postal code String postalCode = (String) context.get("postalCode"); - if (postalCode != null && postalCode.length() > 0) { + if (UtilValidate.isNotEmpty(postalCode)) { paramList = paramList + "&postalCode=" + postalCode; andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("postalCode"), EntityOperator.LIKE, EntityFunction.UPPER("%" + postalCode + "%"))); } @@ -1339,7 +1339,7 @@ // filter on infoString String infoString = (String) context.get("infoString"); - if (infoString != null && infoString.length() > 0) { + if (UtilValidate.isNotEmpty(infoString)) { paramList = paramList + "&infoString=" + infoString; andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), EntityOperator.LIKE, EntityFunction.UPPER("%"+infoString+"%"))); fieldsToSelect.add("infoString"); @@ -1363,21 +1363,21 @@ // filter on countryCode String countryCode = (String) context.get("countryCode"); - if (countryCode != null && countryCode.length() > 0) { + if (UtilValidate.isNotEmpty(countryCode)) { paramList = paramList + "&countryCode=" + countryCode; andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("countryCode"), EntityOperator.EQUALS, EntityFunction.UPPER(countryCode))); } // filter on areaCode String areaCode = (String) context.get("areaCode"); - if (areaCode != null && areaCode.length() > 0) { + if (UtilValidate.isNotEmpty(areaCode)) { paramList = paramList + "&areaCode=" + areaCode; andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("areaCode"), EntityOperator.EQUALS, EntityFunction.UPPER(areaCode))); } // filter on contact number String contactNumber = (String) context.get("contactNumber"); - if (contactNumber != null && contactNumber.length() > 0) { + if (UtilValidate.isNotEmpty(contactNumber)) { paramList = paramList + "&contactNumber=" + contactNumber; andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("contactNumber"), EntityOperator.EQUALS, EntityFunction.UPPER(contactNumber))); } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java Mon Nov 23 23:41:34 2009 @@ -156,7 +156,7 @@ // get it from the database if (prodCatalogId == null) { List<String> catalogIds = getCatalogIdsAvailable(request); - if (catalogIds != null && catalogIds.size() > 0) prodCatalogId = catalogIds.get(0); + if (UtilValidate.isNotEmpty(catalogIds)) prodCatalogId = catalogIds.get(0); } if (!fromSession) { 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -168,7 +168,7 @@ if (parameterName.startsWith("pft_")) { String productFeatureTypeId = parameterName.substring(4); String productFeatureId = (String) entry.getValue(); - if (productFeatureId != null && productFeatureId.length() > 0) { + if (UtilValidate.isNotEmpty(productFeatureId)) { featureIdByType.put(productFeatureTypeId, productFeatureId); } } @@ -186,7 +186,7 @@ String parameterName = entry.getKey(); if (parameterName.startsWith("SEARCH_FEAT")) { String productFeatureId = (String) entry.getValue(); - if (productFeatureId != null && productFeatureId.length() > 0) { + if (UtilValidate.isNotEmpty(productFeatureId)) { featureIdList.add(productFeatureId); } } @@ -228,7 +228,7 @@ String parameterName = entry.getKey(); if (parameterName.startsWith("SEARCH_PROD_FEAT_CAT")) { String productFeatureCategoryId = (String) entry.getValue(); - if (productFeatureCategoryId != null && productFeatureCategoryId.length() > 0) { + if (UtilValidate.isNotEmpty(productFeatureCategoryId)) { prodFeatureCategoryIdList.add(productFeatureCategoryId); } } Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java Mon Nov 23 23:41:34 2009 @@ -2113,7 +2113,7 @@ boolean productIdGroupBy = false; // Category - if (productCategoryId != null && productCategoryId.length() > 0) { + if (UtilValidate.isNotEmpty(productCategoryId)) { List productCategoryIdList = null; if (includeSubCategories) { // find all sub-categories recursively, make a Set of productCategoryId 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -630,7 +630,7 @@ for (String parameterName: parameters.keySet()) { if (parameterName.startsWith("SEARCH_FEAT") && !parameterName.startsWith("SEARCH_FEAT_EXC")) { String productFeatureId = (String) parameters.get(parameterName); - if (productFeatureId != null && productFeatureId.length() > 0) { + if (UtilValidate.isNotEmpty(productFeatureId)) { String paramNameExt = parameterName.substring("SEARCH_FEAT".length()); String searchCategoryExc = (String) parameters.get("SEARCH_FEAT_EXC" + paramNameExt); Boolean exclude = UtilValidate.isEmpty(searchCategoryExc) ? null : Boolean.valueOf(!"N".equals(searchCategoryExc)); @@ -642,7 +642,7 @@ // a shorter feature variation if (parameterName.startsWith("S_PFI")) { String productFeatureId = (String) parameters.get(parameterName); - if (productFeatureId != null && productFeatureId.length() > 0) { + if (UtilValidate.isNotEmpty(productFeatureId)) { String paramNameExt = parameterName.substring("S_PFI".length()); String searchCategoryExc = (String) parameters.get("S_PFX" + paramNameExt); Boolean exclude = UtilValidate.isEmpty(searchCategoryExc) ? null : Boolean.valueOf(!"N".equals(searchCategoryExc)); @@ -655,7 +655,7 @@ //if product features category were selected add a constraint for each if (parameterName.startsWith("SEARCH_PROD_FEAT_CAT") && !parameterName.startsWith("SEARCH_PROD_FEAT_CAT_EXC")) { String productFeatureCategoryId = (String) parameters.get(parameterName); - if (productFeatureCategoryId != null && productFeatureCategoryId.length() > 0) { + if (UtilValidate.isNotEmpty(productFeatureCategoryId)) { String paramNameExt = parameterName.substring("SEARCH_PROD_FEAT_CAT".length()); String searchProdFeatureCategoryExc = (String) parameters.get("SEARCH_PROD_FEAT_CAT_EXC" + paramNameExt); Boolean exclude = UtilValidate.isEmpty(searchProdFeatureCategoryExc) ? null : Boolean.valueOf(!"N".equals(searchProdFeatureCategoryExc)); @@ -666,7 +666,7 @@ // a shorter variation for feature category if (parameterName.startsWith("S_FCI")) { String productFeatureCategoryId = (String) parameters.get(parameterName); - if (productFeatureCategoryId != null && productFeatureCategoryId.length() > 0) { + if (UtilValidate.isNotEmpty(productFeatureCategoryId)) { String paramNameExt = parameterName.substring("S_FCI".length()); String searchProdFeatureCategoryExc = (String) parameters.get("S_FCX" + paramNameExt); Boolean exclude = UtilValidate.isEmpty(searchProdFeatureCategoryExc) ? null : Boolean.valueOf(!"N".equals(searchProdFeatureCategoryExc)); @@ -678,7 +678,7 @@ //if product features group were selected add a constraint for each if (parameterName.startsWith("SEARCH_PROD_FEAT_GRP") && !parameterName.startsWith("SEARCH_PROD_FEAT_GRP_EXC")) { String productFeatureGroupId = (String) parameters.get(parameterName); - if (productFeatureGroupId != null && productFeatureGroupId.length() > 0) { + if (UtilValidate.isNotEmpty(productFeatureGroupId)) { String paramNameExt = parameterName.substring("SEARCH_PROD_FEAT_GRP".length()); String searchProdFeatureGroupExc = (String) parameters.get("SEARCH_PROD_FEAT_GRP_EXC" + paramNameExt); Boolean exclude = UtilValidate.isEmpty(searchProdFeatureGroupExc) ? null : Boolean.valueOf(!"N".equals(searchProdFeatureGroupExc)); @@ -689,7 +689,7 @@ // a shorter variation for feature group if (parameterName.startsWith("S_FGI")) { String productFeatureGroupId = (String) parameters.get(parameterName); - if (productFeatureGroupId != null && productFeatureGroupId.length() > 0) { + if (UtilValidate.isNotEmpty(productFeatureGroupId)) { String paramNameExt = parameterName.substring("S_FGI".length()); String searchProdFeatureGroupExc = (String) parameters.get("S_FGX" + paramNameExt); Boolean exclude = UtilValidate.isEmpty(searchProdFeatureGroupExc) ? null : Boolean.valueOf(!"N".equals(searchProdFeatureGroupExc)); |
Free forum by Nabble | Edit this page |