This is an automated email from the ASF dual-hosted git repository.
surajk pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 038d46e Improved: Corrected some single line statements to fix checkstyle issues, also removed some remaining extra spaces from code to avoid checkstyle erros in applications component. (OFBIZ-11886) new c20b03e Merge branch 'trunk' of https://gitbox.apache.org/repos/asf/ofbiz-framework into trunk 038d46e is described below commit 038d46e51d477c1c1082202bae928202ad3fde4d Author: Suraj Khurana <[hidden email]> AuthorDate: Tue Jul 21 12:22:02 2020 +0530 Improved: Corrected some single line statements to fix checkstyle issues, also removed some remaining extra spaces from code to avoid checkstyle erros in applications component. (OFBIZ-11886) --- .../ofbiz/accounting/invoice/InvoiceServices.java | 10 +- .../accounting/payment/PaymentGatewayServices.java | 2 +- .../thirdparty/eway/GatewayResponse.java | 2 +- .../thirdparty/sagepay/SagePayPaymentServices.java | 2 +- .../thirdparty/securepay/SecurePayServiceTest.java | 2 +- .../accounting/thirdparty/verisign/PayflowPro.java | 46 +++-- .../thirdparty/worldpay/WorldPayEvents.java | 4 +- .../ofbiz/content/ContentManagementServices.java | 24 ++- .../ofbiz/content/ContentManagementWorker.java | 24 +-- .../org/apache/ofbiz/content/cms/CmsEvents.java | 24 ++- .../ofbiz/content/content/ContentKeywordIndex.java | 4 +- .../ofbiz/content/content/ContentSearch.java | 4 +- .../ofbiz/content/content/ContentServices.java | 16 +- .../ofbiz/content/content/ContentWorker.java | 8 +- .../ofbiz/content/content/PermissionRecorder.java | 4 +- .../content/content/UploadContentAndImage.java | 8 +- .../org/apache/ofbiz/content/ftp/FtpServices.java | 8 +- .../apache/ofbiz/content/layout/LayoutEvents.java | 60 ++++-- .../apache/ofbiz/content/survey/SurveyWrapper.java | 66 +++---- .../content/view/SimpleContentViewHandler.java | 24 ++- .../webapp/ftl/InjectNodeTrailCsvTransform.java | 4 +- .../ftl/LimitedSubContentCacheTransform.java | 4 +- .../content/webapp/ftl/RenderContentAsText.java | 4 +- .../content/webapp/ftl/RenderContentTransform.java | 2 +- .../content/webapp/ftl/RenderSubContentAsText.java | 14 +- .../webapp/ftl/RenderSubContentCacheTransform.java | 16 +- .../jobshopmgt/ProductionRunServices.java | 36 ++-- .../ofbiz/manufacturing/mrp/MrpServices.java | 18 +- .../manufacturing/techdata/TechDataServices.java | 194 ++++++++++---------- .../marketing/tracking/TrackingCodeEvents.java | 24 ++- .../java/org/apache/ofbiz/sfa/vcard/VCard.java | 2 +- .../apache/ofbiz/order/order/OrderReadHelper.java | 2 +- .../ofbiz/order/order/OrderReturnServices.java | 3 +- .../apache/ofbiz/order/order/OrderServices.java | 14 +- .../order/requirement/RequirementServices.java | 5 +- .../ofbiz/order/shoppingcart/CheckOutEvents.java | 2 +- .../ofbiz/order/shoppingcart/CheckOutHelper.java | 2 +- .../ofbiz/order/shoppingcart/ShoppingCart.java | 203 +++++++++++---------- .../order/shoppingcart/ShoppingCartEvents.java | 14 +- .../ofbiz/order/shoppingcart/ShoppingCartItem.java | 10 +- .../order/shoppingcart/ShoppingCartServices.java | 6 +- .../shoppingcart/product/ProductPromoWorker.java | 6 +- .../order/shoppinglist/ShoppingListEvents.java | 2 +- .../ofbiz/order/thirdparty/taxware/TaxwareUTL.java | 40 +++- .../apache/ofbiz/party/party/PartyServices.java | 2 +- .../org/apache/ofbiz/party/party/PartyWorker.java | 2 +- .../ofbiz/product/catalog/CatalogWorker.java | 4 +- .../product/category/CatalogUrlDirective.java | 2 - .../ofbiz/product/category/CatalogUrlServlet.java | 2 +- .../ofbiz/product/category/CategoryServices.java | 4 +- .../ofbiz/product/category/CategoryWorker.java | 20 +- .../ofbiz/product/category/SeoConfigUtil.java | 1 - .../ofbiz/product/imagemanagement/FrameImage.java | 12 +- .../ofbiz/product/inventory/InventoryServices.java | 30 ++- .../apache/ofbiz/product/price/PriceServices.java | 104 +++++++---- .../ofbiz/product/product/ProductEvents.java | 2 +- .../ofbiz/product/product/ProductSearchEvents.java | 2 +- .../product/product/ProductSearchSession.java | 4 +- .../ofbiz/product/product/ProductServices.java | 3 +- .../ofbiz/product/product/ProductUtilServices.java | 30 +-- .../ofbiz/product/product/ProductWorker.java | 5 +- .../ofbiz/product/store/ProductStoreWorker.java | 6 +- .../ofbiz/shipment/packing/PackingServices.java | 2 +- .../ofbiz/shipment/packing/PackingSession.java | 2 +- .../ofbiz/shipment/shipment/ShipmentWorker.java | 6 +- .../ofbiz/shipment/thirdparty/ups/UpsServices.java | 12 +- .../shipment/thirdparty/usps/UspsServices.java | 3 +- .../ofbiz/shipment/verify/VerifyPickSession.java | 2 +- .../securityext/cert/CertificateServices.java | 2 +- .../ofbiz/workeffort/workeffort/ICalConverter.java | 16 +- .../workeffort/workeffort/WorkEffortServices.java | 31 ++-- 71 files changed, 749 insertions(+), 531 deletions(-) diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java index a9638ee..2558fb4 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java @@ -165,7 +165,9 @@ public class InvoiceServices { String invoiceId = (String) context.get("invoiceId"); if (UtilValidate.isEmpty(billItems)) { - if (Debug.verboseOn()) Debug.logVerbose("No order items to invoice; not creating invoice; returning success", MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("No order items to invoice; not creating invoice; returning success", MODULE); + } return ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "AccountingNoOrderItemsToInvoice", locale)); } @@ -579,7 +581,7 @@ public class InvoiceServices { EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "VAT_TAX"), EntityCondition.makeCondition("amountAlreadyIncluded", EntityOperator.LESS_THAN, BigDecimal.ZERO)); EntityCondition andCondition = EntityCondition.makeCondition(exprs, EntityOperator.AND); - GenericValue orderAdjustment = EntityUtil.getFirst(delegator.findList("OrderAdjustment", andCondition, null, null, null, false)); + GenericValue orderAdjustment = EntityUtil.getFirst(delegator.findList("OrderAdjustment", andCondition, null, null, null, false)); if (UtilValidate.isNotEmpty(orderAdjustment)) { amount = adj.getBigDecimal("amount").subtract(orderAdjustment.getBigDecimal("amountAlreadyIncluded")).setScale(100, ROUNDING); } else { @@ -921,7 +923,7 @@ public class InvoiceServices { Map<String, List<Map<String, Object>>> commissionParties = new HashMap<>(); for (String salesInvoiceId : salesInvoiceIds) { List<String> salesRepPartyIds = UtilGenerics.cast(context.get("partyIds")); - BigDecimal amountTotal = InvoiceWorker.getInvoiceTotal(delegator, salesInvoiceId); + BigDecimal amountTotal = InvoiceWorker.getInvoiceTotal(delegator, salesInvoiceId); if (amountTotal.signum() == 0) { Debug.logWarning("Invoice [" + salesInvoiceId + "] has an amount total of [" + amountTotal + "], so no commission invoice will be created", MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, @@ -3560,7 +3562,7 @@ public class InvoiceServices { try { for (final CSVRecord rec : fmt.parse(csvReader)) { - currentInvoiceId = rec.get("invoiceId"); + currentInvoiceId = rec.get("invoiceId"); if (lastInvoiceId == null || !currentInvoiceId.equals(lastInvoiceId)) { newInvoiceId = null; Map<String, Object> invoice = UtilMisc.toMap( diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java index 1db542b..1ee57de 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java @@ -730,7 +730,7 @@ public class PaymentGatewayServices { orderId = paymentPref.getString("orderId"); } else { - orderId = (String) context.get("orderId"); + orderId = (String) context.get("orderId"); } } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayResponse.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayResponse.java index f3d18c5..e838d48 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayResponse.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayResponse.java @@ -154,7 +154,7 @@ public class GatewayResponse { value = textnode.getNodeValue(); } - switch(name) { + switch (name) { case "ewayTrxnError": txTrxnError = value; break; diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java index 822231a..f503664 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java @@ -117,7 +117,7 @@ public class SagePayPaymentServices { //getting order details orderId = UtilFormatOut.checkNull((String) context.get("orderId")); - processAmount = (BigDecimal) context.get("processAmount"); + processAmount = (BigDecimal) context.get("processAmount"); currency = (String) context.get("currency"); } else { diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java index 1c1f16c..4b72f25 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java @@ -139,7 +139,7 @@ public class SecurePayServiceTest extends OFBizTestCase { } else { Debug.logInfo("[testAuth] Result from SecurePay: " + result, MODULE); String authRefNum = (String) result.get("authRefNum"); - BigDecimal processAmount = (BigDecimal) result.get("processAmount"); + BigDecimal processAmount = (BigDecimal) result.get("processAmount"); paymentGatewayResponse = delegator.makeValue("PaymentGatewayResponse", UtilMisc.toMap( "paymentGatewayResponseId", "testOrder1000_01", "orderPaymentPreferenceId", "testOrder1000_01", diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java index 84c91be..f6a5755 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java @@ -164,7 +164,9 @@ public class PayflowPro { params.append("&").append(parseContext(data)); // transmit the request - //if (Debug.verboseOn()) Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + } String resp; if (!comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "enableTransmit", configString, "payment.verisign.enable_transmit", "false")) { resp = pfp.submitTransaction(params.toString(), pfp.generateRequestId()); @@ -247,7 +249,9 @@ public class PayflowPro { params.append("&").append(parseContext(data)); // transmit the request - if (Debug.verboseOn()) Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + } String resp; if (!comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "enableTransmit", configString, "payment.verisign.enable_transmit", "false")) { resp = pfp.submitTransaction(params.toString(), pfp.generateRequestId()); @@ -255,7 +259,9 @@ public class PayflowPro { resp = "RESULT=0&AUTHCODE=T&PNREF=" + (new Date()).getTime() + "&RESPMSG=Testing"; } - if (Debug.verboseOn()) Debug.logVerbose("Response from Verisign: " + resp, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Response from Verisign: " + resp, MODULE); + } // check the response Map<String, Object> result = ServiceUtil.returnSuccess(); @@ -325,7 +331,9 @@ public class PayflowPro { params.append("&").append(parseContext(data)); // transmit the request - if (Debug.verboseOn()) Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + } String resp; if (!comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "enableTransmit", configString, "payment.verisign.enable_transmit", "false")) { resp = pfp.submitTransaction(params.toString(), pfp.generateRequestId()); @@ -333,7 +341,9 @@ public class PayflowPro { resp = "RESULT=0&AUTHCODE=T&PNREF=" + (new Date()).getTime() + "&RESPMSG=Testing"; } - if (Debug.verboseOn()) Debug.logVerbose("Response from Verisign: " + resp, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Response from Verisign: " + resp, MODULE); + } // check the response Map<String, Object> result = ServiceUtil.returnSuccess(); @@ -402,7 +412,9 @@ public class PayflowPro { params.append("&").append(parseContext(data)); // transmit the request - if (Debug.verboseOn()) Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + } String resp; if (!comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "enableTransmit", configString, "payment.verisign.enable_transmit", "false")) { resp = pfp.submitTransaction(params.toString(), pfp.generateRequestId()); @@ -410,7 +422,9 @@ public class PayflowPro { resp = "RESULT=0&AUTHCODE=T&PNREF=" + (new Date()).getTime() + "&RESPMSG=Testing"; } - if (Debug.verboseOn()) Debug.logVerbose("Response from Verisign: " + resp, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Response from Verisign: " + resp, MODULE); + } // check the response Map<String, Object> result = ServiceUtil.returnSuccess(); @@ -462,7 +476,9 @@ public class PayflowPro { params.append("&").append(parseContext(data)); // transmit the request - if (Debug.verboseOn()) Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + } String resp; if (!comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "enableTransmit", configString, "payment.verisign.enable_transmit", "false")) { resp = pfp.submitTransaction(params.toString(), pfp.generateRequestId()); @@ -470,14 +486,16 @@ public class PayflowPro { resp = "RESULT=0&TOKEN=" + (new Date()).getTime() + "&RESPMSG=Testing"; } - if (Debug.verboseOn()) Debug.logVerbose("Response from Verisign: " + resp, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Response from Verisign: " + resp, MODULE); + } Map<String, String> responseMap = parseResponse(resp); String result = responseMap.get("RESULT"); if (!"0".equals(result)) { String respMsg = responseMap.get("RESPMSG"); Debug.logError("A problem occurred while requesting an express checkout token from paypal: Result = " + result + ", Message = " + respMsg, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage("AccountingErrorUiLabels", + return ServiceUtil.returnError(UtilProperties.getMessage("AccountingErrorUiLabels", "AccountingPayPalCommunicationError", locale)); } token = responseMap.get("TOKEN"); @@ -561,7 +579,9 @@ public class PayflowPro { params.append("&").append(parseContext(data)); // transmit the request - if (Debug.verboseOn()) Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + } String resp; if (!comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "enableTransmit", configString, "payment.verisign.enable_transmit", "false")) { resp = pfp.submitTransaction(params.toString(), pfp.generateRequestId()); @@ -640,7 +660,9 @@ public class PayflowPro { params.append("&").append(parseContext(data)); // transmit the request - if (Debug.verboseOn()) Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Sending to Verisign: " + params.toString(), MODULE); + } String resp; if (!comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "enableTransmit", configString, "payment.verisign.enable_transmit", "false")) { resp = pfp.submitTransaction(params.toString(), pfp.generateRequestId()); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java index da5392f..5846f2e 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java @@ -401,7 +401,9 @@ public class WorldPayEvents { } private static boolean setPaymentPreferences(Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin, String orderId, HttpServletRequest request) { - if (Debug.verboseOn()) Debug.logVerbose("Setting payment preferences..", MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Setting payment preferences..", MODULE); + } List<GenericValue> paymentPrefs = null; try { paymentPrefs = EntityQuery.use(delegator).from("OrderPaymentPreference") diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java index 10ce323..2983043 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java @@ -152,7 +152,9 @@ public class ContentManagementServices { String deactivateString = (String) context.get("deactivateExisting"); boolean deactivateExisting = "true".equalsIgnoreCase(deactivateString); - if (Debug.infoOn()) Debug.logInfo("in persist... mapKey(0):" + mapKey, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in persist... mapKey(0):" + mapKey, MODULE); + } // ContentPurposes can get passed in as a delimited string or a list. Combine. List<String> contentPurposeList = UtilGenerics.cast(context.get("contentPurposeList")); @@ -319,7 +321,9 @@ public class ContentManagementServices { map.put("userLogin", userLogin); map.put("dataResourceId", dataResourceId); map.put("contentId", contentId); - if (Debug.infoOn()) Debug.logInfo("in persist... context:" + context, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in persist... context:" + context, MODULE); + } Map<String, Object> r = dispatcher.runSync("updateContent", map); boolean isError = ModelService.RESPOND_ERROR.equals(r.get(ModelService.RESPONSE_MESSAGE)); if (isError) @@ -336,9 +340,13 @@ public class ContentManagementServices { Debug.logInfo("CREATING contentASSOC contentAssocTypeId:" + contentAssocTypeId, MODULE); } // create content assoc if the key values are present.... - if (Debug.infoOn()) Debug.logInfo("contentAssoc: " + contentAssoc.toString(), MODULE); + if (Debug.infoOn()) { + Debug.logInfo("contentAssoc: " + contentAssoc.toString(), MODULE); + } if (UtilValidate.isNotEmpty(contentAssocTypeId) && contentAssoc.get("contentId") != null && contentAssoc.get("contentIdTo") != null) { - if (Debug.infoOn()) Debug.logInfo("in persistContentAndAssoc, deactivateExisting:" + deactivateExisting, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in persistContentAndAssoc, deactivateExisting:" + deactivateExisting, MODULE); + } Map<String, Object> contentAssocContext = new HashMap<>(); contentAssocContext.put("userLogin", userLogin); contentAssocContext.put("displayFailCond", bDisplayFailCond); @@ -447,7 +455,9 @@ public class ContentManagementServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(permResults)); } serviceContext.put("fromDate", UtilDateTime.nowTimestamp()); - if (Debug.infoOn()) Debug.logInfo("updateSiteRoles, serviceContext(1):" + serviceContext, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("updateSiteRoles, serviceContext(1):" + serviceContext, MODULE); + } permResults = dispatcher.runSync("createContentRole", serviceContext); if (ServiceUtil.isError(permResults)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(permResults)); @@ -587,7 +597,7 @@ public class ContentManagementServices { } } else if ("SHORT_TEXT".equals(dataResourceTypeId)) { } else if ("SURVEY".startsWith(dataResourceTypeId)) { - } else if ("_FILE".indexOf(dataResourceTypeId) >=0) { + } else if ("_FILE".indexOf(dataResourceTypeId) >= 0) { Map<String, Object> uploadImage = new HashMap<>(); uploadImage.put("userLogin", userLogin); uploadImage.put("dataResourceId", dataResourceId); @@ -630,7 +640,7 @@ public class ContentManagementServices { } } else if ("SHORT_TEXT".equals(dataResourceTypeId)) { } else if ("SURVEY".startsWith(dataResourceTypeId)) { - } else if ("_FILE".indexOf(dataResourceTypeId) >=0) { + } else if ("_FILE".indexOf(dataResourceTypeId) >= 0) { Map<String, Object> uploadImage = new HashMap<>(); uploadImage.put("userLogin", userLogin); uploadImage.put("dataResourceId", dataResourceId); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java index 2c0cb81..3e065be 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java @@ -106,7 +106,9 @@ public final class ContentManagementWorker { lookupCaches.put(cacheEntityName, lkupCache); } lkupCache.add(pk.getPrimaryKey()); - if (Debug.infoOn()) Debug.logInfo("in mruAddByEntityName, entityName:" + entityName + " lifoSet.size()" + lkupCache.size(), MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in mruAddByEntityName, entityName:" + entityName + " lifoSet.size()" + lkupCache.size(), MODULE); + } } public static Iterator<Object> mostRecentlyViewedIterator(String entityName, Map<String, LifoSet<Object>> lookupCaches) { @@ -196,7 +198,7 @@ public final class ContentManagementWorker { GenericPK cachedPK = null; if (UtilValidate.isNotEmpty(entityName)) { cachedPK = currentEntityMap.get(entityName); - } + } getCurrentValueWithCachedPK(request, delegator, cachedPK, entityName); GenericPK currentPK = (GenericPK) request.getAttribute("currentPK"); currentEntityMap.put(entityName, currentPK); @@ -243,7 +245,6 @@ public final class ContentManagementWorker { sCached = oCached.toString(); if (UtilValidate.isEmpty(sCached)) { useCached = false; - } else { } } else { useCached = false; @@ -388,7 +389,7 @@ public final class ContentManagementWorker { if (filteredList.size() > 0) { map.put(publishPointId, "Y"); GenericValue assoc = filteredList.get(0); - Timestamp fromDate = (Timestamp)assoc.get("fromDate"); + Timestamp fromDate = (Timestamp) assoc.get("fromDate"); map.put(publishPointId + "FromDate", fromDate); } else { map.put(publishPointId, "N"); @@ -437,14 +438,14 @@ public final class ContentManagementWorker { return webSitePublishPoint; } - public static GenericValue getParentWebSitePublishPointValue(Delegator delegator, String contentId) throws GenericEntityException { + public static GenericValue getParentWebSitePublishPointValue(Delegator delegator, String contentId) throws GenericEntityException { String contentIdTo = getParentWebSitePublishPointId(delegator, contentId); GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", contentIdTo).cache().queryOne(); return content; } - public static String getParentWebSitePublishPointId(Delegator delegator, String contentId) throws GenericEntityException { + public static String getParentWebSitePublishPointId(Delegator delegator, String contentId) throws GenericEntityException { String contentIdTo = null; GenericValue contentAssoc = EntityQuery.use(delegator).from("ContentAssoc") .where("contentId", contentId, "contentAssocTypeId", "SUBSITE") @@ -468,7 +469,7 @@ public final class ContentManagementWorker { return webSitePublishPoint; } - public static List<Object[]> getPublishedLinks(Delegator delegator, String targContentId, String rootPubId, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { + public static List<Object[]> getPublishedLinks(Delegator delegator, String targContentId, String rootPubId, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { // Set up one map with all the top-level publish points (to which only one sub point can be attached to) // and another map (publishPointMapAll) that points to one of the top-level points. List<GenericValue> allPublishPointList = getAllPublishPoints(delegator, rootPubId); @@ -504,7 +505,7 @@ public final class ContentManagementWorker { String topContentId = (String) publishPointMapAll.get(contentIdTo); Object[] subArr = (Object[]) publishPointMap.get(topContentId); if (contentIdTo.equals(topContentId)) { - subArr[3] = contentAssoc.get("fromDate"); + subArr[3] = contentAssoc.get("fromDate"); } else { if (subArr != null) { List<Object[]> subPointList = UtilGenerics.cast(subArr[1]); @@ -513,10 +514,11 @@ public final class ContentManagementWorker { while (it5.hasNext()) { subArr2 = it5.next(); String contentId5 = (String) subArr2[0]; - if (contentId5.equals(contentIdTo)) + if (contentId5.equals(contentIdTo)) { break; + } } - subArr2[2] = contentAssoc.get("fromDate"); + subArr2[2] = contentAssoc.get("fromDate"); } } } @@ -536,7 +538,7 @@ public final class ContentManagementWorker { List<String> assocTypes = UtilMisc.toList("AUTHOR"); // TODO check if we want contentTypes to be filled/used, else this should be removed List<String> contentTypes = null; - Map<String, Object> results = ContentServicesComplex.getAssocAndContentAndDataResourceCacheMethod(delegator, contentId, null, "To", null, null, assocTypes, contentTypes, Boolean.TRUE, null, null); + Map<String, Object> results = ContentServicesComplex.getAssocAndContentAndDataResourceCacheMethod(delegator, contentId, null, "To", null, null, assocTypes, contentTypes, Boolean.TRUE, null, null); List<GenericValue> valueList = UtilGenerics.cast(results.get("entityList")); if (valueList.size() > 0) { GenericValue value = valueList.get(0); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java index 14225c1..3249281 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java @@ -198,9 +198,13 @@ public class CmsEvents { // get the contentId/mapKey from URL if (contentId == null) { - if (Debug.verboseOn()) Debug.logVerbose("Current PathInfo: " + pathInfo, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Current PathInfo: " + pathInfo, MODULE); + } String[] pathSplit = pathInfo.split("/"); - if (Debug.verboseOn()) Debug.logVerbose("Split pathinfo: " + pathSplit.length, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Split pathinfo: " + pathSplit.length, MODULE); + } contentId = pathSplit[0]; if (pathSplit.length > 1) { mapKey = pathSplit[1]; @@ -235,7 +239,9 @@ public class CmsEvents { } if (errorContainer != null) { - if (Debug.verboseOn()) Debug.logVerbose("Found error containers: " + errorContainer, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Found error containers: " + errorContainer, MODULE); + } GenericValue errorPage = null; try { @@ -267,7 +273,9 @@ public class CmsEvents { try { GenericValue errorPage = EntityQuery.use(delegator).from("Content").where("contentId", "CONTENT_ERROR_" + statusCode).cache().queryOne(); if (errorPage != null) { - if (Debug.verboseOn()) Debug.logVerbose("Found generic page " + statusCode, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Found generic page " + statusCode, MODULE); + } contentId = errorPage.getString("contentId"); mapKey = null; hasErrorPage = true; @@ -382,7 +390,9 @@ public class CmsEvents { } publishPoints = EntityUtil.filterByDate(publishPoints); if (UtilValidate.isNotEmpty(publishPoints)) { - if (Debug.verboseOn()) Debug.logVerbose("Found publish points: " + publishPoints, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Found publish points: " + publishPoints, MODULE); + } return HttpServletResponse.SC_OK; } else { // the passed in contentId is not a publish point for the web site; @@ -435,7 +445,9 @@ public class CmsEvents { } } } else { - if (Debug.verboseOn()) Debug.logVerbose("Found assocs: " + contentAssoc, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Found assocs: " + contentAssoc, MODULE); + } return HttpServletResponse.SC_OK; } if (hadContent) return HttpServletResponse.SC_GONE; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java index 8ccc9fc..2b76946 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java @@ -195,7 +195,9 @@ public class ContentKeywordIndex { } } if (toBeStored.size() > 0) { - if (Debug.verboseOn()) Debug.logVerbose("[ContentKeywordIndex.indexKeywords] Storing " + toBeStored.size() + " keywords for contentId " + content.getString("contentId"), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("[ContentKeywordIndex.indexKeywords] Storing " + toBeStored.size() + " keywords for contentId " + content.getString("contentId"), MODULE); + } if ("true".equals(EntityUtilProperties.getPropertyValue("contentsearch", "index.delete.on_index", "false", delegator))) { // delete all keywords if the properties file says to diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java index abaa4fa..b9ced14 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java @@ -319,7 +319,9 @@ public class ContentSearch { hasResults = true; } if (resultOffset != null && resultOffset > 1) { - if (Debug.infoOn()) Debug.logInfo("Before relative, current index=" + eli.currentIndex(), MODULE); + if (Debug.infoOn()) { + Debug.logInfo("Before relative, current index=" + eli.currentIndex(), MODULE); + } hasResults = eli.relative(resultOffset - 1); initialResult = null; } diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java index 0facaaa..bc09ee5 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java @@ -480,8 +480,12 @@ public class ContentServices { String privilegeEnumId = (String) context.get("privilegeEnumId"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - if (Debug.infoOn()) Debug.logInfo("in publishContent, statusId:" + statusId, MODULE); - if (Debug.infoOn()) Debug.logInfo("in publishContent, userLogin:" + userLogin, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in publishContent, statusId:" + statusId, MODULE); + } + if (Debug.infoOn()) { + Debug.logInfo("in publishContent, userLogin:" + userLogin, MODULE); + } Map<String, Object> mapIn = new HashMap<>(); mapIn.put("contentId", contentId); @@ -494,13 +498,17 @@ public class ContentServices { GenericValue contentAssocViewFrom = ContentWorker.getContentAssocViewFrom(delegator, contentIdTo, contentId, contentAssocTypeId, statusId, privilegeEnumId); if (contentAssocViewFrom != null) isPublished = true; - if (Debug.infoOn()) Debug.logInfo("in publishContent, contentId:" + contentId + " contentIdTo:" + contentIdTo + " contentAssocTypeId:" + contentAssocTypeId + " publish:" + publish + " isPublished:" + isPublished, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in publishContent, contentId:" + contentId + " contentIdTo:" + contentIdTo + " contentAssocTypeId:" + contentAssocTypeId + " publish:" + publish + " isPublished:" + isPublished, MODULE); + } if (UtilValidate.isNotEmpty(publish) && "Y".equalsIgnoreCase(publish)) { GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne(); String contentStatusId = (String) content.get("statusId"); String contentPrivilegeEnumId = (String) content.get("privilegeEnumId"); - if (Debug.infoOn()) Debug.logInfo("in publishContent, statusId:" + statusId + " contentStatusId:" + contentStatusId + " privilegeEnumId:" + privilegeEnumId + " contentPrivilegeEnumId:" + contentPrivilegeEnumId, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in publishContent, statusId:" + statusId + " contentStatusId:" + contentStatusId + " privilegeEnumId:" + privilegeEnumId + " contentPrivilegeEnumId:" + contentPrivilegeEnumId, MODULE); + } // Don't do anything if link was already there if (!isPublished) { content.put("privilegeEnumId", privilegeEnumId); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java index 549b566..3cef6e8 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java @@ -779,7 +779,9 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor String contentTypeId = null; for (GenericValue assoc : assocList) { String contentId = (String) assoc.get(contentIdName); - if (Debug.infoOn()) Debug.logInfo("contentId:" + contentId, ""); + if (Debug.infoOn()) { + Debug.logInfo("contentId:" + contentId, ""); + } content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne(); if (UtilValidate.isNotEmpty(contentTypes)) { contentTypeId = content.getString("contentTypeId"); @@ -943,7 +945,9 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor contentIdOtherField = "contentId"; } - if (Debug.infoOn()) Debug.logInfo("getContentAncestry, contentId:" + contentId, ""); + if (Debug.infoOn()) { + Debug.logInfo("getContentAncestry, contentId:" + contentId, ""); + } try { List<GenericValue> contentAssocs = EntityQuery.use(delegator).from("ContentAssoc") .where(contentIdField, contentId) diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java index 7aa24c6..3bdbe1c 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java @@ -51,8 +51,8 @@ public class PermissionRecorder { private static final String MODULE = PermissionRecorder.class.getName(); - private static final String[] opFields = { "contentPurposeTypeId", "contentOperationId", "roleTypeId", "statusId", "privilegeEnumId"}; - private static final String[] fieldTitles = { "Purpose", "Operation", "Role", "Status", "Privilege"}; + private static final String[] opFields = {"contentPurposeTypeId", "contentOperationId", "roleTypeId", "statusId", "privilegeEnumId"}; + private static final String[] fieldTitles = {"Purpose", "Operation", "Role", "Status", "Privilege"}; public PermissionRecorder() { isOn = UtilProperties.propertyValueEqualsIgnoreCase("content", "permissionRecorderOn", "true"); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java index 9dd687b..4835880 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java @@ -197,7 +197,9 @@ public class UploadContentAndImage { String ftlDataResourceId = drid; - if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]ftlContentId:" + ftlContentId, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("[UploadContentAndImage]ftlContentId:" + ftlContentId, MODULE); + } // Create or update summary text subContent if (passedParams.containsKey("summaryData")) { Map<String, Object> sumContext = new HashMap<>(); @@ -280,7 +282,9 @@ public class UploadContentAndImage { imgContext.put("mapKey", "IMAGE"); imgContext.put("dataTemplateTypeId", "NONE"); imgContext.put("rootDir", "rootDir"); - if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]imgContext " + imgContext, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("[UploadContentAndImage]imgContext " + imgContext, MODULE); + } Map<String, Object> imgResults = dispatcher.runSync("persistContentAndAssoc", imgContext); if (ServiceUtil.isError(imgResults)) { String errorMessage = ServiceUtil.getErrorMessage(imgResults); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java index a2dcf31..b74dbef 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java @@ -168,7 +168,9 @@ public class FtpServices { //test if the file is correctly sent if (forceTransferControlSuccess) { - if (Debug.infoOn()) Debug.logInfo(" Control if service really success the transfer", MODULE); + if (Debug.infoOn()) { + Debug.logInfo(" Control if service really success the transfer", MODULE); + } //recreate the connection ftpClient.closeConnection(); @@ -179,7 +181,9 @@ public class FtpServices { //check the file name previously copy List<String> fileNames = ftpClient.list(path); - if (Debug.infoOn()) Debug.logInfo(" For the path " + path + " we found " + fileNames, MODULE); + if (Debug.infoOn()) { + Debug.logInfo(" For the path " + path + " we found " + fileNames, MODULE); + } if (fileNames == null || !fileNames.contains(remoteFileName)) { return ServiceUtil.returnError("DataResource " + content.getString("dataResourceId") + " return an empty stream"); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java index 2beca77..feb5d8f 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java @@ -182,7 +182,9 @@ public class LayoutEvents { return "error"; } String imageFileName = (String) uploadResults.get("imageFileName"); - if (Debug.verboseOn()) Debug.logVerbose("in createLayoutImage(java), context:" + context, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in createLayoutImage(java), context:" + context, ""); + } context.put("userLogin", session.getAttribute("userLogin")); context.put("dataResourceTypeId", "IMAGE_OBJECT"); context.put("contentAssocTypeId", "SUB_CONTENT"); @@ -194,13 +196,19 @@ public class LayoutEvents { context.put("drDataResourceTypeId", null); String dataResourceId = (String) context.get("drDataResourceId"); - if (Debug.verboseOn()) Debug.logVerbose("in createLayoutImage(java), dataResourceId:" + dataResourceId, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in createLayoutImage(java), dataResourceId:" + dataResourceId, ""); + } GenericValue dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", dataResourceId).queryOne(); - if (Debug.verboseOn()) Debug.logVerbose("in createLayoutImage(java), dataResource:" + dataResource, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in createLayoutImage(java), dataResource:" + dataResource, ""); + } // Use objectInfo field to store the name of the file, since there is no // place in ImageDataResource for it. - if (Debug.verboseOn()) Debug.logVerbose("in createLayoutImage(java), imageFileName:" + imageFileName, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in createLayoutImage(java), imageFileName:" + imageFileName, ""); + } if (dataResource != null) { dataResource.setNonPKFields(context); dataResource.store(); @@ -229,7 +237,9 @@ public class LayoutEvents { Locale locale = UtilHttp.getLocale(request); Map<String, Object> context = new HashMap<>(); Map<String, Object> paramMap = UtilHttp.getParameterMap(request); - if (Debug.verboseOn()) Debug.logVerbose("in replaceSubContent, paramMap:" + paramMap, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("in replaceSubContent, paramMap:" + paramMap, MODULE); + } String dataResourceId = (String) paramMap.get("dataResourceId"); if (UtilValidate.isEmpty(dataResourceId)) { String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.data_ressource_id_null", locale); @@ -297,14 +307,18 @@ public class LayoutEvents { Locale locale = UtilHttp.getLocale(request); Map<String, Object> paramMap = UtilHttp.getParameterMap(request); String contentId = (String) paramMap.get("contentId"); - if (Debug.verboseOn()) Debug.logVerbose("in cloneLayout, contentId:" + contentId, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in cloneLayout, contentId:" + contentId, ""); + } if (UtilValidate.isEmpty(contentId)) { String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.content_id_empty", locale); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } String contentIdTo = (String) paramMap.get("contentIdTo"); - if (Debug.verboseOn()) Debug.logVerbose("in cloneLayout, contentIdTo:" + contentIdTo, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in cloneLayout, contentIdTo:" + contentIdTo, ""); + } GenericValue content = null; GenericValue newContent = null; GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); @@ -314,14 +328,18 @@ public class LayoutEvents { String newDataResourceId = null; try { content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne(); - if (Debug.verboseOn()) Debug.logVerbose("in cloneLayout, content:" + content, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in cloneLayout, content:" + content, ""); + } if (content == null) { String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.content_empty", locale); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } newContent = delegator.makeValue("Content", content); - if (Debug.verboseOn()) Debug.logVerbose("in cloneLayout, newContent:" + newContent, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in cloneLayout, newContent:" + newContent, ""); + } String oldName = (String) content.get("contentName"); newId = delegator.getNextSeqId("Content"); newContent.set("contentId", newId); @@ -329,7 +347,9 @@ public class LayoutEvents { GenericValue dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", dataResourceId).queryOne(); if (dataResource != null) { GenericValue newDataResource = delegator.makeValue("DataResource", dataResource); - if (Debug.verboseOn()) Debug.logVerbose("in cloneLayout, newDataResource:" + newDataResource, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in cloneLayout, newDataResource:" + newDataResource, ""); + } String dataResourceName = "Copy:" + (String) dataResource.get("dataResourceName"); newDataResource.set("dataResourceName", dataResourceName); newDataResourceId = delegator.getNextSeqId("DataResource"); @@ -346,7 +366,9 @@ public class LayoutEvents { newContent.set("createdByUserLogin", userLoginId); newContent.set("lastModifiedByUserLogin", userLoginId); newContent.create(); - if (Debug.verboseOn()) Debug.logVerbose("in cloneLayout, newContent:" + newContent, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in cloneLayout, newContent:" + newContent, ""); + } GenericValue newContentAssoc = delegator.makeValue("ContentAssoc"); newContentAssoc.set("contentId", newId); @@ -354,7 +376,9 @@ public class LayoutEvents { newContentAssoc.set("contentAssocTypeId", "SUB_CONTENT"); newContentAssoc.set("fromDate", UtilDateTime.nowTimestamp()); newContentAssoc.create(); - if (Debug.verboseOn()) Debug.logVerbose("in cloneLayout, newContentAssoc:" + newContentAssoc, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in cloneLayout, newContentAssoc:" + newContentAssoc, ""); + } } catch (GenericEntityException e) { request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); return "error"; @@ -432,7 +456,9 @@ public class LayoutEvents { GenericValue view = delegator.makeValue("ContentDataResourceView"); view.set("contentId", newId); view.set("drDataResourceId", newDataResourceId); - if (Debug.verboseOn()) Debug.logVerbose("in cloneLayout, view:" + view, ""); + if (Debug.verboseOn()) { + Debug.logVerbose("in cloneLayout, view:" + view, ""); + } ContentManagementWorker.setCurrentEntityMap(request, view); request.setAttribute("contentId", view.get("contentId")); request.setAttribute("drDataResourceId", view.get("drDataResourceId")); @@ -592,8 +618,12 @@ public class LayoutEvents { if (attrVal == null) { attrVal = (String) paramMap.get(attrName); } - if (Debug.verboseOn()) Debug.logVerbose("in copyToClip, attrName:" + attrName,""); - if (Debug.verboseOn()) Debug.logVerbose("in copyToClip, attrVal:" + attrVal,""); + if (Debug.verboseOn()) { + Debug.logVerbose("in copyToClip, attrName:" + attrName,""); + } + if (Debug.verboseOn()) { + Debug.logVerbose("in copyToClip, attrVal:" + attrVal,""); + } if (UtilValidate.isNotEmpty(attrVal)) { passedPK.put(attrName, attrVal); } else { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java b/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java index 8ab454e..460f3d4 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java @@ -584,24 +584,24 @@ public class SurveyWrapper { GenericValue value; while (((value = eli.next()) != null)) { switch (type) { - case 1: - Long n = value.getLong("numericResponse"); - if (UtilValidate.isNotEmpty(n)) { - result[1] += n; - } - break; - case 2: - Double c = value.getDouble("currencyResponse"); - if (UtilValidate.isNotEmpty(c)) { - result[1] += (((double) Math.round((c - c) * 100)) / 100); - } - break; - case 3: - Double f = value.getDouble("floatResponse"); - if (UtilValidate.isNotEmpty(f)) { - result[1] += f; - } - break; + case 1: + Long n = value.getLong("numericResponse"); + if (UtilValidate.isNotEmpty(n)) { + result[1] += n; + } + break; + case 2: + Double c = value.getDouble("currencyResponse"); + if (UtilValidate.isNotEmpty(c)) { + result[1] += (((double) Math.round((c - c) * 100)) / 100); + } + break; + case 3: + Double f = value.getDouble("floatResponse"); + if (UtilValidate.isNotEmpty(f)) { + result[1] += f; + } + break; } result[0]++; // increment the count } @@ -626,21 +626,21 @@ public class SurveyWrapper { // average switch (type) { - case 1: - if (result[0] > 0) { - result[2] = result[1] / ((long) result[0]); - } - break; - case 2: - if (result[0] > 0) { - result[2] = (((double) Math.round((result[1] / result[0]) * 100)) / 100); - } - break; - case 3: - if (result[0] > 0) { - result[2] = result[1] / (long) result[0]; - } - break; + case 1: + if (result[0] > 0) { + result[2] = result[1] / ((long) result[0]); + } + break; + case 2: + if (result[0] > 0) { + result[2] = (((double) Math.round((result[1] / result[0]) * 100)) / 100); + } + break; + case 3: + if (result[0] > 0) { + result[2] = result[1] / (long) result[0]; + } + break; } return result; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/view/SimpleContentViewHandler.java b/applications/content/src/main/java/org/apache/ofbiz/content/view/SimpleContentViewHandler.java index 8299103..6a9f380 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/view/SimpleContentViewHandler.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/view/SimpleContentViewHandler.java @@ -83,7 +83,9 @@ public class SimpleContentViewHandler extends AbstractViewHandler { String webSiteId = WebSiteWorker.getWebSiteId(request); try { - if (Debug.verboseOn()) Debug.logVerbose("dataResourceId:" + dataResourceId, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("dataResourceId:" + dataResourceId, MODULE); + } Delegator delegator = (Delegator) request.getAttribute("delegator"); if (UtilValidate.isEmpty(dataResourceId)) { if (UtilValidate.isEmpty(contentRevisionSeqId)) { @@ -92,7 +94,9 @@ public class SimpleContentViewHandler extends AbstractViewHandler { GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).cache().queryOne(); dataResourceId = content.getString("dataResourceId"); } - if (Debug.verboseOn()) Debug.logVerbose("dataResourceId:" + dataResourceId, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("dataResourceId:" + dataResourceId, MODULE); + } } else { Timestamp fromDate = null; if (UtilValidate.isNotEmpty(fromDateStr)) { @@ -108,7 +112,9 @@ public class SimpleContentViewHandler extends AbstractViewHandler { } GenericValue content = ContentWorker.getSubContent(delegator, contentId, mapKey, null, null, assocList, fromDate); dataResourceId = content.getString("dataResourceId"); - if (Debug.verboseOn()) Debug.logVerbose("dataResourceId:" + dataResourceId, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("dataResourceId:" + dataResourceId, MODULE); + } } } else { GenericValue contentRevisionItem = EntityQuery.use(delegator) @@ -121,9 +127,15 @@ public class SimpleContentViewHandler extends AbstractViewHandler { + ", contentRevisionSeqId=" + contentRevisionSeqId + ", itemContentId=" + contentId); } dataResourceId = contentRevisionItem.getString("newDataResourceId"); - if (Debug.verboseOn()) Debug.logVerbose("contentRevisionItem:" + contentRevisionItem, MODULE); - if (Debug.verboseOn()) Debug.logVerbose("contentId=" + rootContentId + ", contentRevisionSeqId=" + contentRevisionSeqId + ", itemContentId=" + contentId, MODULE); - if (Debug.verboseOn()) Debug.logVerbose("dataResourceId:" + dataResourceId, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("contentRevisionItem:" + contentRevisionItem, MODULE); + } + if (Debug.verboseOn()) { + Debug.logVerbose("contentId=" + rootContentId + ", contentRevisionSeqId=" + contentRevisionSeqId + ", itemContentId=" + contentId, MODULE); + } + if (Debug.verboseOn()) { + Debug.logVerbose("dataResourceId:" + dataResourceId, MODULE); + } } } if (UtilValidate.isNotEmpty(dataResourceId)) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java index c079498..b0de1f2 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java @@ -46,8 +46,8 @@ public class InjectNodeTrailCsvTransform implements TemplateTransformModel { private static final String MODULE = InjectNodeTrailCsvTransform.class.getName(); - static final String[] saveKeyNames = { "nodeTrailCsv", "globalNodeTrail", "nodeTrail" }; - static final String[] removeKeyNames = { "nodeTrailCsv" }; + static final String[] saveKeyNames = {"nodeTrailCsv", "globalNodeTrail", "nodeTrail" }; + static final String[] removeKeyNames = {"nodeTrailCsv" }; /** * @deprecated use FreeMarkerWorker.getWrappedObject() diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java index 67dbf40..412f399 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java @@ -56,8 +56,8 @@ public class LimitedSubContentCacheTransform implements TemplateTransformModel { private static final String MODULE = LimitedSubContentCacheTransform.class.getName(); - static final String[] upSaveKeyNames = { "globalNodeTrail" }; - static final String[] saveKeyNames = { "contentId", "subContentId", "entityList", "entityIndex", + static final String[] upSaveKeyNames = {"globalNodeTrail" }; + static final String[] saveKeyNames = {"contentId", "subContentId", "entityList", "entityIndex", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "entityList", "viewSize", "viewIndex", "highIndex", "lowIndex", "listSize", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "globalNodeTrail", "outputIndex" }; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java index 4b7480b..f672f28 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java @@ -73,8 +73,8 @@ public class RenderContentAsText implements TemplateTransformModel { if (Debug.verboseOn()) { Debug.logVerbose("in RenderSubContent, contentId(2):" + templateRoot.get("contentId"), MODULE); } - final String thisContentId = (String) templateRoot.get("contentId"); - final String xmlEscape = (String) templateRoot.get("xmlEscape"); + final String thisContentId = (String) templateRoot.get("contentId"); + final String xmlEscape = (String) templateRoot.get("xmlEscape"); final boolean directAssocMode = UtilValidate.isNotEmpty(thisContentId) ? true : false; if (Debug.verboseOn()) { Debug.logVerbose("in Render(0), directAssocMode ." + directAssocMode, MODULE); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java index f156c21..e9d627f 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java @@ -61,7 +61,7 @@ public class RenderContentTransform implements TemplateTransformModel { final MapStack<String> templateRoot = MapStack.create(FreeMarkerWorker.createEnvironmentMap(env)); templateRoot.push(args); - final String xmlEscape = (String) templateRoot.get("xmlEscape"); + final String xmlEscape = (String) templateRoot.get("xmlEscape"); final String thisContentId = (String) templateRoot.get("contentId"); return new Writer(out) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java index 94384f5..29342e1 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java @@ -68,9 +68,9 @@ public class RenderSubContentAsText implements TemplateTransformModel { if (Debug.infoOn()) { Debug.logInfo("in RenderSubContent, contentId(2):" + templateRoot.get("contentId"), MODULE); } - final String thisContentId = (String) templateRoot.get("contentId"); - final String thisMapKey = (String) templateRoot.get("mapKey"); - final String xmlEscape = (String) templateRoot.get("xmlEscape"); + final String thisContentId = (String) templateRoot.get("contentId"); + final String thisMapKey = (String) templateRoot.get("mapKey"); + final String xmlEscape = (String) templateRoot.get("xmlEscape"); if (Debug.infoOn()) { Debug.logInfo("in Render(0), thisSubContentId ." + thisContentId, MODULE); } @@ -112,7 +112,9 @@ public class RenderSubContentAsText implements TemplateTransformModel { } String editRequestName = (String) templateRoot.get("editRequestName"); - if (Debug.infoOn()) Debug.logInfo("in Render(3), editRequestName ." + editRequestName, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in Render(3), editRequestName ." + editRequestName, MODULE); + } if (UtilValidate.isNotEmpty(editRequestName)) { String editStyle = getEditStyle(); @@ -128,7 +130,9 @@ public class RenderSubContentAsText implements TemplateTransformModel { out.write(txt); - if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, after renderContentAsTextCache:", MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in RenderSubContent, after renderContentAsTextCache:", MODULE); + } } catch (GeneralException e) { String errMsg = "Error rendering thisContentId:" + thisContentId + " msg:" + e.toString(); Debug.logError(e, errMsg, MODULE); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java index 1953f7c..c368947 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java @@ -52,7 +52,7 @@ import freemarker.template.TemplateTransformModel; public class RenderSubContentCacheTransform implements TemplateTransformModel { private static final String MODULE = RenderSubContentCacheTransform.class.getName(); - static final String[] upSaveKeyNames = { "globalNodeTrail" }; + static final String[] upSaveKeyNames = {"globalNodeTrail" }; @Override @SuppressWarnings("unchecked") @@ -72,7 +72,7 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { String contentAssocPredicateId = (String) templateRoot.get("contentAssocPredicateId"); String strNullThruDatesOnly = (String) templateRoot.get("nullThruDatesOnly"); Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && "true".equalsIgnoreCase(strNullThruDatesOnly)) ? Boolean.TRUE :Boolean.FALSE; - String thisSubContentId = (String) templateRoot.get("subContentId"); + String thisSubContentId = (String) templateRoot.get("subContentId"); final boolean directAssocMode = UtilValidate.isNotEmpty(thisSubContentId) ? true : false; GenericValue val = null; try { @@ -194,7 +194,9 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { contentAssocTypeId = (String) templateRoot.get("contentAssocTypeId"); mapKey = (String) templateRoot.get("mapKey"); fromDate = (String) templateRoot.get("fromDate"); - if (Debug.infoOn()) Debug.logInfo("in Render(0), view ." + view, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in Render(0), view ." + view, MODULE); + } if (view != null) { ModelEntity modelEntity = view.getModelEntity(); if (UtilValidate.isEmpty(contentId) && modelEntity.getField("caContentId") != null) @@ -221,7 +223,9 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { } else { contentId = (String) templateRoot.get("subContentId"); } - if (Debug.infoOn()) Debug.logInfo("in Render(0), contentIdTo ." + contentIdTo, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in Render(0), contentIdTo ." + contentIdTo, MODULE); + } String delim = "?"; if (UtilValidate.isNotEmpty(contentId)) { fullRequest += delim + "contentId=" + contentId; @@ -244,7 +248,9 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { delim = "&"; } - if (Debug.infoOn()) Debug.logInfo("in Render(2), contentIdTo ." + contentIdTo, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("in Render(2), contentIdTo ." + contentIdTo, MODULE); + } out.write("<a href=\""); ServletContext servletContext = request.getSession().getServletContext(); RequestHandler rh = (RequestHandler) servletContext.getAttribute("_REQUEST_HANDLER_"); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java index 58d18ca..2038b6f 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java @@ -190,7 +190,7 @@ public class ProductionRunServices { // TODO: security management and finishing cleaning (ex copy from PartyServices.java) // Mandatory input fields String productId = (String) context.get("productId"); - Timestamp startDate = (Timestamp) context.get("startDate"); + Timestamp startDate = (Timestamp) context.get("startDate"); BigDecimal pRQuantity = (BigDecimal) context.get("pRQuantity"); String facilityId = (String) context.get("facilityId"); // Optional input fields @@ -263,7 +263,7 @@ public class ProductionRunServices { if (workEffortName == null) { String prdName = UtilValidate.isNotEmpty(product.getString("productName"))? product.getString("productName"): product.getString("productId"); String wefName = UtilValidate.isNotEmpty(routing.getString("workEffortName"))? routing.getString("workEffortName"): routing.getString("workEffortId"); - workEffortName = prdName + "-" + wefName; + workEffortName = prdName + "-" + wefName; } serviceContext.clear(); @@ -350,7 +350,9 @@ public class ProductionRunServices { Debug.logError(e, "Problem calling the createWorkEffort service", MODULE); } String productionRunTaskId = (String) serviceResult.get("workEffortId"); - if (Debug.infoOn()) Debug.logInfo("ProductionRunTaskId created: " + productionRunTaskId, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("ProductionRunTaskId created: " + productionRunTaskId, MODULE); + } // The newly created production run task is associated to the routing task // to keep track of the template used to generate it. @@ -405,7 +407,9 @@ public class ProductionRunServices { } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the createWorkEffortGoodStandard service", MODULE); } - if (Debug.infoOn()) Debug.logInfo("ProductLink created for productId: " + productBom.getString("productIdTo"), MODULE); + if (Debug.infoOn()) { + Debug.logInfo("ProductLink created for productId: " + productBom.getString("productIdTo"), MODULE); + } } } first = false; @@ -466,7 +470,9 @@ public class ProductionRunServices { } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the assignPartyToWorkEffort service", MODULE); } - if (Debug.infoOn()) Debug.logInfo("ProductionRunPartyassigment for party: " + workEffortPartyAssignment.get("partyId") + " created", MODULE); + if (Debug.infoOn()) { + Debug.logInfo("ProductionRunPartyassigment for party: " + workEffortPartyAssignment.get("partyId") + " created", MODULE); + } } } } @@ -504,7 +510,9 @@ public class ProductionRunServices { } catch (GenericServiceException gse) { Debug.logError(gse, "Problem calling the createWorkEffortCostCalc service", MODULE); } - if (Debug.infoOn()) Debug.logInfo("ProductionRun CostCalc for cost calc: " + costCalc.getString("costComponentCalcId") + " created", MODULE); + if (Debug.infoOn()) { + Debug.logInfo("ProductionRun CostCalc for cost calc: " + costCalc.getString("costComponentCalcId") + " created", MODULE); + } } } } @@ -543,7 +551,7 @@ public class ProductionRunServices { productionRun.setQuantity(quantity); } - Timestamp estimatedStartDate = (Timestamp) context.get("estimatedStartDate"); + Timestamp estimatedStartDate = (Timestamp) context.get("estimatedStartDate"); if (estimatedStartDate != null && !estimatedStartDate.equals(productionRun.getEstimatedStartDate())) { productionRun.setEstimatedStartDate(estimatedStartDate); } @@ -1634,7 +1642,9 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingAddProductionRunRoutingTaskNotCreated", locale)); } String productionRunTaskId = (String) serviceResult.get("workEffortId"); - if (Debug.infoOn()) Debug.logInfo("ProductionRunTaskId created: " + productionRunTaskId, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("ProductionRunTaskId created: " + productionRunTaskId, MODULE); + } productionRun.setEstimatedCompletionDate(productionRun.recalculateEstimatedCompletionDate()); @@ -1669,7 +1679,9 @@ public class ProductionRunServices { } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the assignPartyToWorkEffort service", MODULE); } - if (Debug.infoOn()) Debug.logInfo("ProductionRunPartyassigment for party: " + workEffortPartyAssignment.get("partyId") + " created", MODULE); + if (Debug.infoOn()) { + Debug.logInfo("ProductionRunPartyassigment for party: " + workEffortPartyAssignment.get("partyId") + " created", MODULE); + } } } @@ -3462,7 +3474,7 @@ public class ProductionRunServices { continue; } BigDecimal qtyDiff = qtyToProduce.subtract(qtyProduced); - String productId = genericResult.getString("productId"); + String productId = genericResult.getString("productId"); Timestamp estimatedShipDate = genericResult.getTimestamp("estimatedCompletionDate"); if (estimatedShipDate == null) { estimatedShipDate = now; @@ -3489,13 +3501,13 @@ public class ProductionRunServices { String orderId = null; GenericValue orderDeliverySchedule = null; for (GenericValue genericResult : resultList) { - String newOrderId = genericResult.getString("orderId"); + String newOrderId = genericResult.getString("orderId"); if (!newOrderId.equals(orderId)) { orderDeliverySchedule = null; orderId = newOrderId; orderDeliverySchedule = EntityQuery.use(delegator).from("OrderDeliverySchedule").where("orderId", orderId, "orderItemSeqId", "_NA_").queryOne(); } - String productId = genericResult.getString("productId"); + String productId = genericResult.getString("productId"); BigDecimal orderQuantity = genericResult.getBigDecimal("quantity"); GenericValue orderItemDeliverySchedule = null; orderItemDeliverySchedule = EntityQuery.use(delegator).from("OrderDeliverySchedule").where("orderId", orderId, "orderItemSeqId", genericResult.getString("orderItemSeqId")).queryOne(); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java index bc5c806..58d7d4f 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java @@ -157,7 +157,7 @@ public class MrpServices { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventFindError", locale)); } for (GenericValue genericResult : resultList) { - String productId = genericResult.getString("productId"); + String productId = genericResult.getString("productId"); BigDecimal reservedQuantity = genericResult.getBigDecimal("reservedQuantity"); BigDecimal shipGroupQuantity = genericResult.getBigDecimal("quantity"); BigDecimal cancelledQuantity = genericResult.getBigDecimal("cancelQuantity"); @@ -217,7 +217,7 @@ public class MrpServices { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventFindError", locale)); } for (GenericValue genericResult : resultList) { - String productId = genericResult.getString("productId"); + String productId = genericResult.getString("productId"); BigDecimal eventQuantityTmp = genericResult.getBigDecimal("quantity"); if (productId == null || eventQuantityTmp == null) { continue; @@ -260,13 +260,13 @@ public class MrpServices { } for (GenericValue genericResult : resultList) { try { - String newOrderId = genericResult.getString("orderId"); + String newOrderId = genericResult.getString("orderId"); if (!newOrderId.equals(orderId)) { orderDeliverySchedule = null; orderId = newOrderId; orderDeliverySchedule = EntityQuery.use(delegator).from("OrderDeliverySchedule").where("orderId", orderId, "orderItemSeqId", "_NA_").queryOne(); } - String productId = genericResult.getString("productId"); + String productId = genericResult.getString("productId"); BigDecimal shipGroupQuantity = genericResult.getBigDecimal("quantity"); BigDecimal cancelledQuantity = genericResult.getBigDecimal("cancelQuantity"); if (UtilValidate.isEmpty(shipGroupQuantity)) { @@ -321,7 +321,7 @@ public class MrpServices { || "PRUN_CANCELLED".equals(genericResult.getString("currentStatusId"))) { continue; } - String productId = genericResult.getString("productId"); + String productId = genericResult.getString("productId"); // get the inventory already consumed BigDecimal consumedInventoryTotal = BigDecimal.ZERO; List<GenericValue> consumedInventoryItems = EntityQuery.use(delegator).from("WorkEffortAndInventoryAssign") @@ -372,7 +372,7 @@ public class MrpServices { continue; } BigDecimal qtyDiff = qtyToProduce.subtract(qtyProduced); - String productId = genericResult.getString("productId"); + String productId = genericResult.getString("productId"); BigDecimal eventQuantityTmp = qtyDiff; Timestamp estimatedShipDate = genericResult.getTimestamp("estimatedCompletionDate"); if (estimatedShipDate == null) { @@ -435,7 +435,7 @@ public class MrpServices { } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventFindError", locale)); } - String partyId = (String) facility.get("ownerPartyId"); + String partyId = (String) facility.get("ownerPartyId"); try { resultList = EntityQuery.use(delegator).from("SalesForecast") .where("organizationPartyId", partyId) @@ -444,7 +444,7 @@ public class MrpServices { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCannotFindSalesForecasts", locale)); } for (GenericValue genericResult : resultList) { - String customTimePeriodId = genericResult.getString("customTimePeriodId"); + String customTimePeriodId = genericResult.getString("customTimePeriodId"); GenericValue customTimePeriod = null; try { customTimePeriod = EntityQuery.use(delegator).from("CustomTimePeriod").where("customTimePeriodId", customTimePeriodId).queryOne(); @@ -464,7 +464,7 @@ public class MrpServices { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCannotFindSalesForecastDetails", locale)); } for (GenericValue sfd : salesForecastDetails) { - String productId = sfd.getString("productId"); + String productId = sfd.getString("productId"); BigDecimal eventQuantityTmp = sfd.getBigDecimal("quantity"); if (productId == null || eventQuantityTmp == null) { continue; diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java index b605174..114cf50 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java @@ -92,10 +92,10 @@ public class TechDataServices { if (listRoutingTask == null) { listRoutingTask = new LinkedList<>(); } - if (listRoutingTask.size() == 0) { + //if (listRoutingTask.size() == 0) { //FIXME is it correct ? // listRoutingTask.add(UtilMisc.toMap("label", "no Match", "value", "NO_MATCH")); - } + //} result.put("lookupResult", listRoutingTask); return result; } @@ -116,12 +116,12 @@ public class TechDataServices { String workEffortIdFrom = (String) context.get("workEffortIdFrom"); String workEffortIdTo = (String) context.get("workEffortIdTo"); String workEffortAssocTypeId = (String) context.get("workEffortAssocTypeId"); - Long sequenceNum = (Long) context.get("sequenceNum"); + Long sequenceNum = (Long) context.get("sequenceNum"); Timestamp fromDate = (Timestamp) context.get("fromDate"); Timestamp thruDate = (Timestamp) context.get("thruDate"); String create = (String) context.get("create"); - boolean createProcess = (create !=null && "Y".equals(create)) ? true : false; + boolean createProcess = (create != null && "Y".equals(create)) ? true : false; List<GenericValue> listRoutingTaskAssoc = null; try { @@ -139,25 +139,20 @@ public class TechDataServices { if (!workEffortIdFrom.equals(routingTaskAssoc.getString("workEffortIdFrom")) || !workEffortIdTo.equals(routingTaskAssoc.getString("workEffortIdTo")) || !workEffortAssocTypeId.equals(routingTaskAssoc.getString("workEffortAssocTypeId")) - || !sequenceNum.equals(routingTaskAssoc.getLong("sequenceNum")) - ) { + || !sequenceNum.equals(routingTaskAssoc.getLong("sequenceNum"))) { if (routingTaskAssoc.getTimestamp("thruDate") == null && routingTaskAssoc.getTimestamp("fromDate") == null) sequenceNumNotOk = "Y"; else if (routingTaskAssoc.getTimestamp("thruDate") == null) { if (thruDate == null) sequenceNumNotOk = "Y"; else if (thruDate.after(routingTaskAssoc.getTimestamp("fromDate"))) sequenceNumNotOk = "Y"; - } - else if (routingTaskAssoc.getTimestamp("fromDate") == null) { + } else if (routingTaskAssoc.getTimestamp("fromDate") == null) { if (fromDate == null) sequenceNumNotOk = "Y"; else if (fromDate.before(routingTaskAssoc.getTimestamp("thruDate"))) sequenceNumNotOk = "Y"; - } - else if (fromDate == null && thruDate == null) sequenceNumNotOk = "Y"; + } else if (fromDate == null && thruDate == null) sequenceNumNotOk = "Y"; else if (thruDate == null) { if (fromDate.before(routingTaskAssoc.getTimestamp("thruDate"))) sequenceNumNotOk = "Y"; - } - else if (fromDate == null) { + } else if (fromDate == null) { if (thruDate.after(routingTaskAssoc.getTimestamp("fromDate"))) sequenceNumNotOk = "Y"; - } - else if (routingTaskAssoc.getTimestamp("fromDate").before(thruDate) && fromDate.before(routingTaskAssoc.getTimestamp("thruDate"))) sequenceNumNotOk = "Y"; + } else if (routingTaskAssoc.getTimestamp("fromDate").before(thruDate) && fromDate.before(routingTaskAssoc.getTimestamp("thruDate"))) sequenceNumNotOk = "Y"; } else if (createProcess) sequenceNumNotOk = "Y"; } } @@ -173,23 +168,24 @@ public class TechDataServices { * @return the techDataCalendar associated */ public static GenericValue getTechDataCalendar(GenericValue routingTask) { - GenericValue machineGroup = null, techDataCalendar = null; + GenericValue machineGroup = null; + GenericValue techDataCalendar = null; try { machineGroup = routingTask.getRelatedOne("FixedAsset", true); } catch (GenericEntityException e) { - Debug.logError("Pb reading FixedAsset associated with routingTask"+e.getMessage(), MODULE); + Debug.logError("Pb reading FixedAsset associated with routingTask" + e.getMessage(), MODULE); } if (machineGroup != null) { if (machineGroup.getString("calendarId") != null) { try { techDataCalendar = machineGroup.getRelatedOne("TechDataCalendar", true); } catch (GenericEntityException e) { - Debug.logError("Pb reading TechDataCalendar associated with machineGroup"+e.getMessage(), MODULE); + Debug.logError("Pb reading TechDataCalendar associated with machineGroup" + e.getMessage(), MODULE); } } else { try { List<GenericValue> machines = machineGroup.getRelated("ChildFixedAsset", null, null, true); - if (machines != null && machines.size()>0) { + if (machines != null && machines.size() > 0) { GenericValue machine = EntityUtil.getFirst(machines); techDataCalendar = machine.getRelatedOne("TechDataCalendar", true); } @@ -215,41 +211,41 @@ public class TechDataServices { * @param dayStart * @return a map with the capacity (Double) available and moveDay (int): the number of day it's necessary to move to have capacity available */ - public static Map<String, Object> dayStartCapacityAvailable(GenericValue techDataCalendarWeek, int dayStart) { + public static Map<String, Object> dayStartCapacityAvailable(GenericValue techDataCalendarWeek, int dayStart) { Map<String, Object> result = new HashMap<>(); int moveDay = 0; Double capacity = null; Time startTime = null; while (capacity == null || capacity == 0) { switch (dayStart) { - case Calendar.MONDAY: - capacity = techDataCalendarWeek.getDouble("mondayCapacity"); - startTime = techDataCalendarWeek.getTime("mondayStartTime"); - break; - case Calendar.TUESDAY: - capacity = techDataCalendarWeek.getDouble("tuesdayCapacity"); - startTime = techDataCalendarWeek.getTime("tuesdayStartTime"); - break; - case Calendar.WEDNESDAY: - capacity = techDataCalendarWeek.getDouble("wednesdayCapacity"); - startTime = techDataCalendarWeek.getTime("wednesdayStartTime"); - break; - case Calendar.THURSDAY: - capacity = techDataCalendarWeek.getDouble("thursdayCapacity"); - startTime = techDataCalendarWeek.getTime("thursdayStartTime"); - break; - case Calendar.FRIDAY: - capacity = techDataCalendarWeek.getDouble("fridayCapacity"); - startTime = techDataCalendarWeek.getTime("fridayStartTime"); - break; - case Calendar.SATURDAY: - capacity = techDataCalendarWeek.getDouble("saturdayCapacity"); - startTime = techDataCalendarWeek.getTime("saturdayStartTime"); - break; - case Calendar.SUNDAY: - capacity = techDataCalendarWeek.getDouble("sundayCapacity"); - startTime = techDataCalendarWeek.getTime("sundayStartTime"); - break; + case Calendar.MONDAY: + capacity = techDataCalendarWeek.getDouble("mondayCapacity"); + startTime = techDataCalendarWeek.getTime("mondayStartTime"); + break; + case Calendar.TUESDAY: + capacity = techDataCalendarWeek.getDouble("tuesdayCapacity"); + startTime = techDataCalendarWeek.getTime("tuesdayStartTime"); + break; + case Calendar.WEDNESDAY: + capacity = techDataCalendarWeek.getDouble("wednesdayCapacity"); + startTime = techDataCalendarWeek.getTime("wednesdayStartTime"); + break; + case Calendar.THURSDAY: + capacity = techDataCalendarWeek.getDouble("thursdayCapacity"); + startTime = techDataCalendarWeek.getTime("thursdayStartTime"); + break; + case Calendar.FRIDAY: + capacity = techDataCalendarWeek.getDouble("fridayCapacity"); + startTime = techDataCalendarWeek.getTime("fridayStartTime"); + break; + case Calendar.SATURDAY: + capacity = techDataCalendarWeek.getDouble("saturdayCapacity"); + startTime = techDataCalendarWeek.getTime("saturdayStartTime"); + break; + case Calendar.SUNDAY: + capacity = techDataCalendarWeek.getDouble("sundayCapacity"); + startTime = techDataCalendarWeek.getTime("sundayStartTime"); + break; } if (capacity == null || capacity == 0) { moveDay += 1; @@ -268,17 +264,17 @@ public class TechDataServices { * @param dateFrom the date * @return long capacityRemaining */ - public static long capacityRemaining(GenericValue techDataCalendar, Timestamp dateFrom) { + public static long capacityRemaining(GenericValue techDataCalendar, Timestamp dateFrom) { GenericValue techDataCalendarWeek = null; // TODO read TechDataCalendarExcWeek to manage execption week (maybe it's needed to refactor the entity definition try { techDataCalendarWeek = techDataCalendar.getRelatedOne("TechDataCalendarWeek", true); } catch (GenericEntityException e) { - Debug.logError("Pb reading Calendar Week associated with calendar"+e.getMessage(), MODULE); + Debug.logError("Pb reading Calendar Week associated with calendar" + e.getMessage(), MODULE); return 0; } // TODO read TechDataCalendarExcDay to manage execption day - Calendar cDateTrav = Calendar.getInstance(); + Calendar cDateTrav = Calendar.getInstance(); cDateTrav.setTime(dateFrom); Map<String, Object> position = dayStartCapacityAvailable(techDataCalendarWeek, cDateTrav.get(Calendar.DAY_OF_WEEK)); int moveDay = (Integer) position.get("moveDay"); @@ -287,9 +283,9 @@ public class TechDataServices { Double capacity = (Double) position.get("capacity"); Timestamp startAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateFrom).getTime() + startTime.getTime() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET)); if (dateFrom.before(startAvailablePeriod)) return 0; - Timestamp endAvailablePeriod = new Timestamp(startAvailablePeriod.getTime()+capacity.longValue()); + Timestamp endAvailablePeriod = new Timestamp(startAvailablePeriod.getTime() + capacity.longValue()); if (dateFrom.after(endAvailablePeriod)) return 0; - return endAvailablePeriod.getTime() - dateFrom.getTime(); + return endAvailablePeriod.getTime() - dateFrom.getTime(); } /** Used to move in a TechDataCalenda, produce the Timestamp for the begining of the next day available and its associated capacity. * If the dateFrom (param in) is not in an available TechDataCalendar period, the return value is the next day available @@ -298,7 +294,7 @@ public class TechDataServices { * @param dateFrom the date * @return a map with Timestamp dateTo, Double nextCapacity */ - public static Map<String, Object> startNextDay(GenericValue techDataCalendar, Timestamp dateFrom) { + public static Map<String, Object> startNextDay(GenericValue techDataCalendar, Timestamp dateFrom) { Map<String, Object> result = new HashMap<>(); Timestamp dateTo = null; GenericValue techDataCalendarWeek = null; @@ -310,7 +306,7 @@ public class TechDataServices { return ServiceUtil.returnError("Pb reading Calendar Week associated with calendar"); } // TODO read TechDataCalendarExcDay to manage execption day - Calendar cDateTrav = Calendar.getInstance(); + Calendar cDateTrav = Calendar.getInstance(); cDateTrav.setTime(dateFrom); Map<String, Object> position = dayStartCapacityAvailable(techDataCalendarWeek, cDateTrav.get(Calendar.DAY_OF_WEEK)); Time startTime = (Time) position.get("startTime"); @@ -319,8 +315,7 @@ public class TechDataServices { Timestamp startAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateTo).getTime() + startTime.getTime() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET)); if (dateTo.before(startAvailablePeriod)) { dateTo = startAvailablePeriod; - } - else { + } else { dateTo = UtilDateTime.getNextDayStart(dateTo); cDateTrav.setTime(dateTo); position = dayStartCapacityAvailable(techDataCalendarWeek, cDateTrav.get(Calendar.DAY_OF_WEEK)); @@ -341,21 +336,21 @@ public class TechDataServices { * @param amount the amount of millisecond to move forward * @return the dateTo */ - public static Timestamp addForward(GenericValue techDataCalendar, Timestamp dateFrom, long amount) { + public static Timestamp addForward(GenericValue techDataCalendar, Timestamp dateFrom, long amount) { Timestamp dateTo = (Timestamp) dateFrom.clone(); long nextCapacity = capacityRemaining(techDataCalendar, dateFrom); if (amount <= nextCapacity) { - dateTo.setTime(dateTo.getTime()+amount); + dateTo.setTime(dateTo.getTime() + amount); amount = 0; } else amount -= nextCapacity; Map<String, Object> result = new HashMap<>(); - while (amount > 0) { + while (amount > 0) { result = startNextDay(techDataCalendar, dateTo); dateTo = (Timestamp) result.get("dateTo"); nextCapacity = ((Double) result.get("nextCapacity")).longValue(); if (amount <= nextCapacity) { - dateTo.setTime(dateTo.getTime()+amount); + dateTo.setTime(dateTo.getTime() + amount); amount = 0; } else amount -= nextCapacity; } @@ -376,34 +371,34 @@ public class TechDataServices { Time startTime = null; while (capacity == null || capacity == 0) { switch (dayEnd) { - case Calendar.MONDAY: - capacity = techDataCalendarWeek.getDouble("mondayCapacity"); - startTime = techDataCalendarWeek.getTime("mondayStartTime"); - break; - case Calendar.TUESDAY: - capacity = techDataCalendarWeek.getDouble("tuesdayCapacity"); - startTime = techDataCalendarWeek.getTime("tuesdayStartTime"); - break; - case Calendar.WEDNESDAY: - capacity = techDataCalendarWeek.getDouble("wednesdayCapacity"); - startTime = techDataCalendarWeek.getTime("wednesdayStartTime"); - break; - case Calendar.THURSDAY: - capacity = techDataCalendarWeek.getDouble("thursdayCapacity"); - startTime = techDataCalendarWeek.getTime("thursdayStartTime"); - break; - case Calendar.FRIDAY: - capacity = techDataCalendarWeek.getDouble("fridayCapacity"); - startTime = techDataCalendarWeek.getTime("fridayStartTime"); - break; - case Calendar.SATURDAY: - capacity = techDataCalendarWeek.getDouble("saturdayCapacity"); - startTime = techDataCalendarWeek.getTime("saturdayStartTime"); - break; - case Calendar.SUNDAY: - capacity = techDataCalendarWeek.getDouble("sundayCapacity"); - startTime = techDataCalendarWeek.getTime("sundayStartTime"); - break; + case Calendar.MONDAY: + capacity = techDataCalendarWeek.getDouble("mondayCapacity"); + startTime = techDataCalendarWeek.getTime("mondayStartTime"); + break; + case Calendar.TUESDAY: + capacity = techDataCalendarWeek.getDouble("tuesdayCapacity"); + startTime = techDataCalendarWeek.getTime("tuesdayStartTime"); + break; + case Calendar.WEDNESDAY: + capacity = techDataCalendarWeek.getDouble("wednesdayCapacity"); + startTime = techDataCalendarWeek.getTime("wednesdayStartTime"); + break; + case Calendar.THURSDAY: + capacity = techDataCalendarWeek.getDouble("thursdayCapacity"); + startTime = techDataCalendarWeek.getTime("thursdayStartTime"); + break; + case Calendar.FRIDAY: + capacity = techDataCalendarWeek.getDouble("fridayCapacity"); + startTime = techDataCalendarWeek.getTime("fridayStartTime"); + break; + case Calendar.SATURDAY: + capacity = techDataCalendarWeek.getDouble("saturdayCapacity"); + startTime = techDataCalendarWeek.getTime("saturdayStartTime"); + break; + case Calendar.SUNDAY: + capacity = techDataCalendarWeek.getDouble("sundayCapacity"); + startTime = techDataCalendarWeek.getTime("sundayStartTime"); + break; } if (capacity == null || capacity == 0) { moveDay -= 1; @@ -422,17 +417,17 @@ public class TechDataServices { * @param dateFrom the date * @return long capacityRemaining */ - public static long capacityRemainingBackward(GenericValue techDataCalendar, Timestamp dateFrom) { + public static long capacityRemainingBackward(GenericValue techDataCalendar, Timestamp dateFrom) { GenericValue techDataCalendarWeek = null; // TODO read TechDataCalendarExcWeek to manage exception week (maybe it's needed to refactor the entity definition try { techDataCalendarWeek = techDataCalendar.getRelatedOne("TechDataCalendarWeek", true); } catch (GenericEntityException e) { - Debug.logError("Pb reading Calendar Week associated with calendar"+e.getMessage(), MODULE); + Debug.logError("Pb reading Calendar Week associated with calendar" + e.getMessage(), MODULE); return 0; } // TODO read TechDataCalendarExcDay to manage execption day - Calendar cDateTrav = Calendar.getInstance(); + Calendar cDateTrav = Calendar.getInstance(); cDateTrav.setTime(dateFrom); Map<String, Object> position = dayEndCapacityAvailable(techDataCalendarWeek, cDateTrav.get(Calendar.DAY_OF_WEEK)); int moveDay = (Integer) position.get("moveDay"); @@ -443,7 +438,7 @@ public class TechDataServices { if (dateFrom.before(startAvailablePeriod)) return 0; Timestamp endAvailablePeriod = new Timestamp(startAvailablePeriod.getTime()+capacity.longValue()); if (dateFrom.after(endAvailablePeriod)) return 0; - return dateFrom.getTime() - startAvailablePeriod.getTime(); + return dateFrom.getTime() - startAvailablePeriod.getTime(); } /** Used to move in a TechDataCalenda, produce the Timestamp for the end of the previous day available and its associated capacity. * If the dateFrom (param in) is not in an available TechDataCalendar period, the return value is the previous day available @@ -452,7 +447,7 @@ public class TechDataServices { * @param dateFrom the date * @return a map with Timestamp dateTo, Double previousCapacity */ - public static Map<String, Object> endPreviousDay(GenericValue techDataCalendar, Timestamp dateFrom) { + public static Map<String, Object> endPreviousDay(GenericValue techDataCalendar, Timestamp dateFrom) { Map<String, Object> result = new HashMap<>(); Timestamp dateTo = null; GenericValue techDataCalendarWeek = null; @@ -464,7 +459,7 @@ public class TechDataServices { return ServiceUtil.returnError("Pb reading Calendar Week associated with calendar"); } // TODO read TechDataCalendarExcDay to manage execption day - Calendar cDateTrav = Calendar.getInstance(); + Calendar cDateTrav = Calendar.getInstance(); cDateTrav.setTime(dateFrom); Map<String, Object> position = dayEndCapacityAvailable(techDataCalendarWeek, cDateTrav.get(Calendar.DAY_OF_WEEK)); Time startTime = (Time) position.get("startTime"); @@ -474,8 +469,7 @@ public class TechDataServices { Timestamp endAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateTo).getTime() + startTime.getTime() + capacity.longValue() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET)); if (dateTo.after(endAvailablePeriod)) { dateTo = endAvailablePeriod; - } - else { + } else { dateTo = UtilDateTime.getDayStart(dateTo, -1); cDateTrav.setTime(dateTo); position = dayEndCapacityAvailable(techDataCalendarWeek, cDateTrav.get(Calendar.DAY_OF_WEEK)); @@ -497,21 +491,21 @@ public class TechDataServices { * @param amount the amount of millisecond to move backward * @return the dateTo */ - public static Timestamp addBackward(GenericValue techDataCalendar, Timestamp dateFrom, long amount) { + public static Timestamp addBackward(GenericValue techDataCalendar, Timestamp dateFrom, long amount) { Timestamp dateTo = (Timestamp) dateFrom.clone(); long previousCapacity = capacityRemainingBackward(techDataCalendar, dateFrom); if (amount <= previousCapacity) { - dateTo.setTime(dateTo.getTime()-amount); + dateTo.setTime(dateTo.getTime() - amount); amount = 0; } else amount -= previousCapacity; Map<String, Object> result = new HashMap<>(); - while (amount > 0) { + while (amount > 0) { result = endPreviousDay(techDataCalendar, dateTo); dateTo = (Timestamp) result.get("dateTo"); previousCapacity = ((Double) result.get("previousCapacity")).longValue(); if (amount <= previousCapacity) { - dateTo.setTime(dateTo.getTime()-amount); + dateTo.setTime(dateTo.getTime() - amount); amount = 0; } else amount -= previousCapacity; } diff --git a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java index 692525d..a92d95b 100644 --- a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java +++ b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java @@ -178,11 +178,15 @@ public class TrackingCodeEvents { //check effective dates java.sql.Timestamp nowStamp = UtilDateTime.nowTimestamp(); if (trackingCode.get("fromDate") != null && nowStamp.before(trackingCode.getTimestamp("fromDate"))) { - if (Debug.infoOn()) Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has not yet gone into effect, ignoring this trackingCodeId", MODULE); + if (Debug.infoOn()) { + Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has not yet gone into effect, ignoring this trackingCodeId", MODULE); + } return "success"; } if (trackingCode.get("thruDate") != null && nowStamp.after(trackingCode.getTimestamp("thruDate"))) { - if (Debug.infoOn()) Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has expired, ignoring this trackingCodeId", MODULE); + if (Debug.infoOn()) { + Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has expired, ignoring this trackingCodeId", MODULE); + } return "success"; } @@ -355,11 +359,15 @@ public class TrackingCodeEvents { //check effective dates if (trackingCode.get("fromDate") != null && nowStamp.before(trackingCode.getTimestamp("fromDate"))) { - if (Debug.infoOn()) Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has not yet gone into effect, ignoring this trackingCodeId", MODULE); + if (Debug.infoOn()) { + Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has not yet gone into effect, ignoring this trackingCodeId", MODULE); + } continue; } if (trackingCode.get("thruDate") != null && nowStamp.after(trackingCode.getTimestamp("thruDate"))) { - if (Debug.infoOn()) Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has expired, ignoring this trackingCodeId", MODULE); + if (Debug.infoOn()) { + Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has expired, ignoring this trackingCodeId", MODULE); + } continue; } @@ -506,10 +514,14 @@ public class TrackingCodeEvents { if (trackingCode != null) { //check effective dates if (trackingCode.get("fromDate") != null && nowStamp.before(trackingCode.getTimestamp("fromDate"))) { - if (Debug.infoOn()) Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has not yet gone into effect, ignoring this trackingCodeId", MODULE); + if (Debug.infoOn()) { + Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has not yet gone into effect, ignoring this trackingCodeId", MODULE); + } } if (trackingCode.get("thruDate") != null && nowStamp.after(trackingCode.getTimestamp("thruDate"))) { - if (Debug.infoOn()) Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has expired, ignoring this trackingCodeId", MODULE); + if (Debug.infoOn()) { + Debug.logInfo("The TrackingCode with ID [" + trackingCodeId + "] has expired, ignoring this trackingCodeId", MODULE); + } } GenericValue trackingCodeOrder = delegator.makeValue("TrackingCodeOrder", UtilMisc.toMap("trackingCodeTypeId", trackingCode.get("trackingCodeTypeId"), diff --git a/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java b/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java index 8b4e69b..b6932b1 100644 --- a/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java +++ b/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java @@ -252,7 +252,7 @@ public class VCard { GenericValue postalAddress = PartyWorker.findPartyLatestPostalAddress(partyId, delegator); if (postalAddress != null) { - Address address = new Address(); + Address address = new Address(); address.setStreetAddress(postalAddress.getString("address1")); address.setLocality(postalAddress.getString("city")); address.setPostalCode(postalAddress.getString("postalCode")); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java index 01fee2e..c3c671c 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java @@ -1821,7 +1821,7 @@ public class OrderReadHelper { String orderItemSeqId = returnedItem.getString("orderItemSeqId"); BigDecimal returnedQuantity = returnedItem.getBigDecimal("returnQuantity"); if (orderItemSeqId != null && returnedQuantity != null) { - BigDecimal existingQuantity = itemReturnedQuantities.get(orderItemSeqId); + BigDecimal existingQuantity = itemReturnedQuantities.get(orderItemSeqId); if (existingQuantity == null) { itemReturnedQuantities.put(orderItemSeqId, returnedQuantity); } else { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java index 873c0c1..bd6d293 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java @@ -475,8 +475,7 @@ public class OrderReturnServices { // OrderItems which have been issued may be returned. EntityConditionList<EntityExpr> whereConditions = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderHeader.getString("orderId")), - EntityCondition.makeCondition("orderItemStatusId", EntityOperator.IN, UtilMisc.toList("ITEM_APPROVED", "ITEM_COMPLETED")) - ), EntityOperator.AND); + EntityCondition.makeCondition("orderItemStatusId", EntityOperator.IN, UtilMisc.toList("ITEM_APPROVED", "ITEM_COMPLETED"))), EntityOperator.AND); List<GenericValue> orderItemQuantitiesIssued = null; try { orderItemQuantitiesIssued = EntityQuery.use(delegator).select("orderId", "orderItemSeqId", "quantityIssued").from("OrderItemQuantityReportGroupByItem").where(whereConditions).orderBy("orderItemSeqId").queryList(); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java index f339a99..842204b 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java @@ -2072,7 +2072,7 @@ public class OrderServices { "OrderErrorCannotCancelItemItemNotFound", UtilMisc.toMap("itemMsgInfo", itemMsgInfo), locale)); } - BigDecimal aisgaCancelQuantity = orderItemShipGroupAssoc.getBigDecimal("cancelQuantity"); + BigDecimal aisgaCancelQuantity = orderItemShipGroupAssoc.getBigDecimal("cancelQuantity"); if (aisgaCancelQuantity == null) { aisgaCancelQuantity = BigDecimal.ZERO; } @@ -2891,8 +2891,8 @@ public class OrderServices { String orderId = (String) context.get("orderId"); Locale locale = (Locale) context.get("locale"); //appears to not be used: GenericValue v = null; - String purpose[] = { "BILLING_LOCATION", "SHIPPING_LOCATION" }; - String outKey[] = { "billingAddress", "shippingAddress" }; + String purpose[] = {"BILLING_LOCATION", "SHIPPING_LOCATION" }; + String outKey[] = {"billingAddress", "shippingAddress" }; GenericValue orderHeader = null; try { @@ -3825,7 +3825,7 @@ public class OrderServices { // Create Estimated Delivery dates if (null != itemEstimatedDeliveryDateMap) { for (Map.Entry<String, String> entry : itemEstimatedDeliveryDateMap.entrySet()) { - String itemSeqId = entry.getKey(); + String itemSeqId = entry.getKey(); // ignore internationalised variant of dates if (!itemSeqId.endsWith("_i18n")) { @@ -3842,7 +3842,7 @@ public class OrderServices { // Create Estimated ship dates if (null != itemEstimatedShipDateMap) { for (Map.Entry<String, String> entry : itemEstimatedShipDateMap.entrySet()) { - String itemSeqId = entry.getKey(); + String itemSeqId = entry.getKey(); // ignore internationalised variant of dates if (!itemSeqId.endsWith("_i18n")) { @@ -3858,7 +3858,7 @@ public class OrderServices { //Update Reserve After Date if (null != itemReserveAfterDateMap) { for (Map.Entry<String, String> entry : itemReserveAfterDateMap.entrySet()) { - String itemSeqId = entry.getKey(); + String itemSeqId = entry.getKey(); // ignore internationalised variant of dates if (!itemSeqId.endsWith("_i18n")) { String reserveAfterDateStr = entry.getValue(); @@ -6493,7 +6493,7 @@ public class OrderServices { } //Get the list of associated products OrderReadHelper orderReadHelper = new OrderReadHelper(delegator, orderId); - List<GenericValue> orderItems = orderReadHelper.getOrderItems(); + List<GenericValue> orderItems = orderReadHelper.getOrderItems(); Map<String, Object> serviceCtx = new HashMap<>(); for (GenericValue orderItem : orderItems) { String orderItemSeqId = orderItem.getString("orderItemSeqId"); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java index ba8a2a2..713c118 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java @@ -119,7 +119,7 @@ public class RequirementServices { BigDecimal requiredQuantity = requirement.getBigDecimal("quantity"); // get an available supplier product, preferably the one with the smallest minimum quantity to order, followed by price - String supplierKey = partyId + "^" + productId; + String supplierKey = partyId + "^" + productId; GenericValue supplierProduct = suppliers.get(supplierKey); if (supplierProduct == null) { // TODO: it is possible to restrict to quantity > minimumOrderQuantity, but then the entire requirement must be skipped @@ -171,8 +171,7 @@ public class RequirementServices { EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"), EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_IN, UtilMisc.toList("ORDER_REJECTED", "ORDER_CANCELLED")), EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_IN, UtilMisc.toList("ITEM_REJECTED", "ITEM_CANCELLED")), - EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, timePeriodStart) - ), EntityOperator.AND); + EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, timePeriodStart)), EntityOperator.AND); GenericValue count = EntityQuery.use(delegator).select("quantityOrdered").from("OrderItemQuantityReportGroupByProduct").where(prodConditions).queryFirst(); if (count != null) { sold = count.getBigDecimal("quantityOrdered"); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java index 580e5b4..14a100b 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java @@ -158,7 +158,7 @@ public class CheckOutEvents { String giftMessage = request.getParameter("gift_message"); String isGift = request.getParameter("is_gift"); String internalCode = request.getParameter("internalCode"); - String shipBeforeDate = request.getParameter("shipBeforeDate"); + String shipBeforeDate = request.getParameter("shipBeforeDate"); String shipAfterDate = request.getParameter("shipAfterDate"); Map<String, ? extends Object> callResult = ServiceUtil.returnSuccess(); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java index 3d170f1..23f0eb6 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java @@ -259,7 +259,7 @@ public class CheckOutHelper { if (UtilValidate.isNotEmpty(billingAccountId)) { Map<String, Object> billingAccountMap = selectedPaymentMethods.get("EXT_BILLACT"); - BigDecimal billingAccountAmt = (BigDecimal)billingAccountMap.get("amount"); + BigDecimal billingAccountAmt = (BigDecimal) billingAccountMap.get("amount"); // set cart billing account data and generate a payment method containing the amount we will be charging cart.setBillingAccount(billingAccountId, (billingAccountAmt != null ? billingAccountAmt: BigDecimal.ZERO)); // copy the billing account terms as order terms diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java index 2c5dd91..01d3f37 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java @@ -155,12 +155,14 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { private Timestamp defaultShipBeforeDate = null; private Timestamp defaultReserveAfterDate = null; - /** Contains a List for each productPromoId (key) containing a productPromoCodeId (or empty string for no code) for each use of the productPromoId */ + /** Contains a List for each productPromoId (key) containing a productPromoCodeId + * (or empty string for no code) for each use of the productPromoId */ private List<ProductPromoUseInfo> productPromoUseInfoList = new LinkedList<>(); /** Contains the promo codes entered */ private Set<String> productPromoCodes = new HashSet<>(); private List<GenericValue> freeShippingProductPromoActions = new ArrayList<>(); - /** Note that even though this is promotion info, it should NOT be cleared when the promos are cleared, it is a preference that will be used in the next promo calculation */ + /** Note that even though this is promotion info, it should NOT be cleared when the promos are cleared, + * it is a preference that will be used in the next promo calculation */ private Map<GenericPK, String> desiredAlternateGiftByAction = new HashMap<>(); private Timestamp cartCreatedTs = UtilDateTime.nowTimestamp(); @@ -263,14 +265,16 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } /** Creates new empty ShoppingCart object. */ - public ShoppingCart(Delegator delegator, String productStoreId, String webSiteId, Locale locale, String currencyUom, String billToCustomerPartyId, String billFromVendorPartyId) { + public ShoppingCart(Delegator delegator, String productStoreId, String webSiteId, Locale locale, String currencyUom, + String billToCustomerPartyId, String billFromVendorPartyId) { this.delegator = delegator; this.delegatorName = delegator.getDelegatorName(); this.productStoreId = productStoreId; this.webSiteId = webSiteId; this.locale = (locale != null) ? locale : Locale.getDefault(); - this.currencyUom = (currencyUom != null) ? currencyUom : EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator); + this.currencyUom = (currencyUom != null) ? currencyUom : EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", + delegator); this.billToCustomerPartyId = billToCustomerPartyId; this.billFromVendorPartyId = billFromVendorPartyId; @@ -450,7 +454,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { /** Sets the currency for the cart. */ public void setCurrency(LocalDispatcher dispatcher, String currencyUom) throws CartItemModifyException { if (isReadOnlyCart()) { - throw new CartItemModifyException("Cart items cannot be changed"); + throw new CartItemModifyException("Cart items cannot be changed"); } String previousCurrency = this.currencyUom; this.currencyUom = currencyUom; @@ -659,12 +663,18 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } /** Add an item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, String itemType, ProductConfigWrapper configWrapper, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { - return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, null, null, null, null, null, features, attributes, prodCatalogId, configWrapper, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, Boolean.FALSE, Boolean.FALSE)); + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap<String, GenericValue> features, + HashMap<String, Object> attributes, String prodCatalogId, String itemType, ProductConfigWrapper configWrapper, LocalDispatcher dispatcher, + Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { + return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, null, null, null, null, null, features, + attributes, prodCatalogId, configWrapper, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, + Boolean.FALSE, Boolean.FALSE)); } /** Add an item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap<String, GenericValue> features, + HashMap<String, Object> attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, + Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(productId, amount, quantity, unitPrice, features, attributes, prodCatalogId, itemType, dispatcher, triggerExternalOps, triggerPriceRules, Boolean.FALSE, Boolean.FALSE); } @@ -694,7 +704,9 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } /** Add an accommodation(rental/aggregated)item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersonsDbl, String accommodationMapId, String accommodationSpotId, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInvent [...] + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, + BigDecimal reservLength, BigDecimal reservPersonsDbl, String accommodationMapId, String accommodationSpotId, HashMap<String, GenericValue> features, HashMap<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, + Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, reservStart, reservLength, reservPersonsDbl, accommodationMapId, accommodationSpotId, null, null, features, attributes, prodCatalogId, configWrapper, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, skipInventoryChecks, skipProductChecks)); } @@ -761,7 +773,6 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } if (CategoryWorker.isProductInCategory(delegator, cartItem.getProductId(), productCategoryId)) { itemsToReturn.add(cartItem); - } else { } } } catch (GenericEntityException e) { @@ -1170,34 +1181,33 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { * @param idx * @param shipBeforeDate */ - public void setShipBeforeDate(int idx, Timestamp shipBeforeDate) { - CartShipInfo csi = this.getShipInfo(idx); - csi.shipBeforeDate = shipBeforeDate; - } + public void setShipBeforeDate(int idx, Timestamp shipBeforeDate) { + CartShipInfo csi = this.getShipInfo(idx); + csi.shipBeforeDate = shipBeforeDate; + } - /** + /** * Set ship before date for ship group 0 * @param shipBeforeDate */ - public void setShipBeforeDate(Timestamp shipBeforeDate) { + public void setShipBeforeDate(Timestamp shipBeforeDate) { this.setShipBeforeDate(0, shipBeforeDate); - } - - /** + } + /** * Get ship before date for a particular ship group * @param idx the ship group number * @return ship before date for a given ship group */ - public Timestamp getShipBeforeDate(int idx) { + public Timestamp getShipBeforeDate(int idx) { CartShipInfo csi = this.getShipInfo(idx); return csi.shipBeforeDate; - } + } - /** + /** * Get ship before date for ship group 0 * @return ship before date for the first ship group */ - public Timestamp getShipBeforeDate() { + public Timestamp getShipBeforeDate() { return this.getShipBeforeDate(0); } @@ -1206,16 +1216,16 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { * @param idx the ship group number * @param shipAfterDate the ship after date to be set for the given ship group */ - public void setShipAfterDate(int idx, Timestamp shipAfterDate) { - CartShipInfo csi = this.getShipInfo(idx); - csi.shipAfterDate = shipAfterDate; - } + public void setShipAfterDate(int idx, Timestamp shipAfterDate) { + CartShipInfo csi = this.getShipInfo(idx); + csi.shipAfterDate = shipAfterDate; + } /** * Set ship after date for a particular ship group * @param shipAfterDate the ship after date to be set for the first ship group */ - public void setShipAfterDate(Timestamp shipAfterDate) { + public void setShipAfterDate(Timestamp shipAfterDate) { this.setShipAfterDate(0, shipAfterDate); } @@ -1224,30 +1234,30 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { * @param idx the ship group number * @return return the ship after date for the given ship group */ - public Timestamp getShipAfterDate(int idx) { - CartShipInfo csi = this.getShipInfo(idx); - return csi.shipAfterDate; - } + public Timestamp getShipAfterDate(int idx) { + CartShipInfo csi = this.getShipInfo(idx); + return csi.shipAfterDate; + } /** * Get ship after date for ship group 0 * @return return the ship after date for the first ship group */ - public Timestamp getShipAfterDate() { + public Timestamp getShipAfterDate() { return this.getShipAfterDate(0); } - public void setDefaultShipBeforeDate(Timestamp defaultShipBeforeDate) { - this.defaultShipBeforeDate = defaultShipBeforeDate != null ? (Timestamp) defaultShipBeforeDate.clone() : null; - } + public void setDefaultShipBeforeDate(Timestamp defaultShipBeforeDate) { + this.defaultShipBeforeDate = defaultShipBeforeDate != null ? (Timestamp) defaultShipBeforeDate.clone() : null; + } - public Timestamp getDefaultShipBeforeDate() { - return this.defaultShipBeforeDate != null ? (Timestamp) this.defaultShipBeforeDate.clone() : null; - } + public Timestamp getDefaultShipBeforeDate() { + return this.defaultShipBeforeDate != null ? (Timestamp) this.defaultShipBeforeDate.clone() : null; + } - public void setDefaultShipAfterDate(Timestamp defaultShipAfterDate) { - this.defaultShipAfterDate = defaultShipAfterDate != null ? (Timestamp) defaultShipAfterDate.clone() : null; - } + public void setDefaultShipAfterDate(Timestamp defaultShipAfterDate) { + this.defaultShipAfterDate = defaultShipAfterDate != null ? (Timestamp) defaultShipAfterDate.clone() : null; + } public void setCancelBackOrderDate(Timestamp cancelBackOrderDate) { this.cancelBackOrderDate = cancelBackOrderDate != null ? (Timestamp) cancelBackOrderDate.clone() : null; @@ -1257,16 +1267,16 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { return this.cancelBackOrderDate != null ? (Timestamp) this.cancelBackOrderDate.clone() : null; } - public Timestamp getDefaultShipAfterDate() { + public Timestamp getDefaultShipAfterDate() { return this.defaultShipAfterDate != null ? (Timestamp) this.defaultShipAfterDate.clone() : null; - } - public void setDefaultReserveAfterDate(Timestamp defaultReserveAfterDate) { + } + public void setDefaultReserveAfterDate(Timestamp defaultReserveAfterDate) { this.defaultReserveAfterDate = defaultReserveAfterDate != null ? (Timestamp) defaultReserveAfterDate.clone() : null; - } + } - public Timestamp getDefaultReserveAfterDate() { + public Timestamp getDefaultReserveAfterDate() { return this.defaultReserveAfterDate != null ? (Timestamp) this.defaultReserveAfterDate.clone() : null; - } + } public String getOrderPartyId() { return this.orderPartyId != null ? this.orderPartyId : this.getPartyId(); @@ -2087,7 +2097,9 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { csi.shipItemInfo.remove(item); } - // DEJ20100107: commenting this out because we do NOT want to clear out ship group info since there is information there that will be lost; good enough to clear the item/group association which can be restored later (though questionable, the whole processes using this should be rewritten to not destroy information! + // DEJ20100107: commenting this out because we do NOT want to clear out ship group info since there is information there that will be lost; + // good enough to clear the item/group association which can be restored later (though questionable, the whole processes using this should + // be rewritten to not destroy information! // this.cleanUpShipGroups(); } @@ -2254,13 +2266,13 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { public int getItemShipGroupIndex(int itemId) { int shipGroupIndex = this.getShipGroupSize() - 1; ShoppingCartItem item = this.findCartItem(itemId); - int result=0; - for (int i = 0; i <(shipGroupIndex + 1); i++) { - CartShipInfo csi = this.getShipInfo(i); - Iterator<ShoppingCartItem> it = csi.shipItemInfo.keySet().iterator(); + int result = 0; + for (int i = 0; i < (shipGroupIndex + 1); i++) { + CartShipInfo csi = this.getShipInfo(i); + Iterator<ShoppingCartItem> it = csi.shipItemInfo.keySet().iterator(); while (it.hasNext()) { ShoppingCartItem item2 = it.next(); - if (item.equals(item2) ) { + if (item.equals(item2)) { result = i; } } @@ -2304,7 +2316,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { * @param shippingContactMechId */ public void setAllShippingContactMechId(String shippingContactMechId) { - for (int x=0; x < shipInfo.size(); x++) { + for (int x = 0; x < shipInfo.size(); x++) { this.setShippingContactMechId(x, shippingContactMechId); } } @@ -2332,7 +2344,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { * @param shipmentMethodTypeId */ public void setAllShipmentMethodTypeId(String shipmentMethodTypeId) { - for (int x=0; x < shipInfo.size(); x++) { + for (int x = 0; x < shipInfo.size(); x++) { this.setShipmentMethodTypeId(x, shipmentMethodTypeId); } } @@ -2400,7 +2412,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { * @param shippingInstructions */ public void setAllShippingInstructions(String shippingInstructions) { - for (int x=0; x < shipInfo.size(); x++) { + for (int x = 0; x < shipInfo.size(); x++) { this.setShippingInstructions(x, shippingInstructions); } } @@ -2423,13 +2435,13 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } /** - * Sets @param maySplit in all ShipInfo(ShipGroups) associated - * with this ShoppingCart - * <p> - * @param maySplit - */ + * Sets @param maySplit in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param maySplit + */ public void setAllMaySplit(Boolean maySplit) { - for (int x=0; x < shipInfo.size(); x++) { + for (int x = 0; x < shipInfo.size(); x++) { this.setMaySplit(x, maySplit); } } @@ -2451,13 +2463,13 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } /** - * Sets @param giftMessage in all ShipInfo(ShipGroups) associated - * with this ShoppingCart - * <p> - * @param giftMessage - */ + * Sets @param giftMessage in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param giftMessage + */ public void setAllGiftMessage(String giftMessage) { - for (int x=0; x < shipInfo.size(); x++) { + for (int x = 0; x < shipInfo.size(); x++) { this.setGiftMessage(x, giftMessage); } } @@ -2479,13 +2491,13 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } /** - * Sets @param isGift in all ShipInfo(ShipGroups) associated - * with this ShoppingCart - * <p> - * @param isGift - */ + * Sets @param isGift in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param isGift + */ public void setAllIsGift(Boolean isGift) { - for (int x=0; x < shipInfo.size(); x++) { + for (int x = 0; x < shipInfo.size(); x++) { this.setIsGift(x, isGift); } } @@ -2505,13 +2517,13 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } /** - * Sets @param carrierPartyId in all ShipInfo(ShipGroups) associated - * with this ShoppingCart - * <p> - * @param carrierPartyId - */ + * Sets @param carrierPartyId in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param carrierPartyId + */ public void setAllCarrierPartyId(String carrierPartyId) { - for (int x=0; x < shipInfo.size(); x++) { + for (int x = 0; x < shipInfo.size(); x++) { this.setCarrierPartyId(x, carrierPartyId); } } @@ -2540,13 +2552,13 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } /** - * Sets @param productStoreShipMethId in all ShipInfo(ShipGroups) associated - * with this ShoppingCart - * <p> - * @param productStoreShipMethId - */ + * Sets @param productStoreShipMethId in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param productStoreShipMethId + */ public void setAllProductStoreShipMethId(String productStoreShipMethId) { - for (int x=0; x < shipInfo.size(); x++) { + for (int x = 0; x < shipInfo.size(); x++) { this.setProductStoreShipMethId(x, productStoreShipMethId); } } @@ -2812,9 +2824,9 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } /** - * Get the total payment amount by payment type. Specify null to get amount - * over all types. - */ + * Get the total payment amount by payment type. Specify null to get amount + * over all types. + */ public BigDecimal getOrderPaymentPreferenceTotalByType(String paymentMethodTypeId) { BigDecimal total = BigDecimal.ZERO; String thisPaymentMethodTypeId = null; @@ -3470,7 +3482,6 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { parties = new LinkedList<>(); additionalPartyRole.put(roleTypeId, parties); } - parties.add(0, partyId); } @@ -3538,8 +3549,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { serviceContext.put("description", description); if (ProductWorker.isAggregateService(delegator, item.getProductId())) { serviceContext.put("productTypeId", "AGGREGATEDSERV_CONF"); - } - else { + } else { serviceContext.put("productTypeId", "AGGREGATED_CONF"); } @@ -3801,9 +3811,9 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { if ("SHIPPING_CHARGES".equals(orderAdjustment.get("orderAdjustmentTypeId"))) { Iterator<GenericValue> fsppas = this.freeShippingProductPromoActions.iterator(); - while (fsppas.hasNext()) { + //while (fsppas.hasNext()) { // TODO - fix the free shipping promotions!! - } + //} } } } @@ -4038,7 +4048,6 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } public List<GenericValue> makeAllOrderAttributes() { - return makeAllOrderAttributes(null, ALL); } @@ -5377,7 +5386,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { BigDecimal minQuantity = BigDecimal.ZERO; BigDecimal minimumOrderPrice = BigDecimal.ZERO; - List<GenericValue> minimumOrderPriceList = EntityQuery.use(delegator).from("ProductPrice") + List<GenericValue> minimumOrderPriceList = EntityQuery.use(delegator).from("ProductPrice") .where("productId", itemProductId, "productPriceTypeId", "MINIMUM_ORDER_PRICE") .filterByDate() .queryList(); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java index 4f0b7ce..94861ef 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java @@ -78,7 +78,7 @@ public class ShoppingCartEvents { private static final String NON_CRITICAL_ERROR = "noncritical"; private static final String ERROR = "error"; - public static final MathContext generalRounding = new MathContext(10); + public static final MathContext GEN_ROUNDING = new MathContext(10); public static String addProductPromoCode(HttpServletRequest request, HttpServletResponse response) { Locale locale = UtilHttp.getLocale(request); @@ -401,7 +401,7 @@ public class ShoppingCartEvents { } if (reservStart != null && reservEnd != null) { - reservLength = new BigDecimal(UtilDateTime.getInterval(reservStart, reservEnd)).divide(new BigDecimal("86400000"), generalRounding); + reservLength = new BigDecimal(UtilDateTime.getInterval(reservStart, reservEnd)).divide(new BigDecimal("86400000"), GEN_ROUNDING); } if (reservStart != null && paramMap.containsKey("reservLength")) { @@ -1251,8 +1251,8 @@ public class ShoppingCartEvents { String agreementId = request.getParameter("agreementId"); Map<String, Object> result = cartHelper.selectAgreement(agreementId); if (ServiceUtil.isError(result)) { - request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(result)); - return "error"; + request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(result)); + return "error"; } return "success"; } @@ -1266,8 +1266,8 @@ public class ShoppingCartEvents { String currencyUomId = request.getParameter("currencyUomId"); Map<String, Object> result = cartHelper.setCurrency(currencyUomId); if (ServiceUtil.isError(result)) { - request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(result)); - return "error"; + request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(result)); + return "error"; } return "success"; } @@ -1499,7 +1499,7 @@ public class ShoppingCartEvents { } if ("SALES_TAX".equals(adjustment.get("orderAdjustmentTypeId"))) { if (adjustment.get("description") != null - && ((String)adjustment.get("description")).startsWith("Tax adjustment due")) { + && ((String) adjustment.get("description")).startsWith("Tax adjustment due")) { cart.addAdjustment(adjustment); } if ("Y".equals(adjustment.getString("isManual"))) { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java index 4833b95..26c16ad 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java @@ -77,10 +77,10 @@ public class ShoppingCartItem implements java.io.Serializable { private static final String MODULE = ShoppingCartItem.class.getName(); private static final String RESOURCE = "OrderUiLabels"; private static final String RES_ERROR = "OrderErrorUiLabels"; - protected static final String[] attributeNames = { "shoppingListId", "shoppingListItemSeqId", "surveyResponses", + protected static final String[] attributeNames = {"shoppingListId", "shoppingListItemSeqId", "surveyResponses", "itemDesiredDeliveryDate", "itemComment", "fromInventoryItemId"}; - public static final MathContext generalRounding = new MathContext(10); + public static final MathContext GEN_ROUNDING = new MathContext(10); private transient Delegator delegator = null; /** the actual or variant product */ @@ -1084,7 +1084,7 @@ public class ShoppingCartItem implements java.io.Serializable { .filterByDate().queryFirst(); if (UtilValidate.isNotEmpty(depositAmount)) { Boolean updatedDepositAmount = false; - BigDecimal adjustmentAmount = depositAmount.getBigDecimal("price").multiply(this.getQuantity(), generalRounding); + BigDecimal adjustmentAmount = depositAmount.getBigDecimal("price").multiply(this.getQuantity(), GEN_ROUNDING); // itemAdjustments is a reference so directly setting updated amount to the same. for (GenericValue itemAdjustment : itemAdjustments) { if ("DEPOSIT_ADJUSTMENT".equals(itemAdjustment.getString("orderAdjustmentTypeId"))) { @@ -2564,7 +2564,7 @@ public class ShoppingCartItem implements java.io.Serializable { // we use != because adjustments can be +/- if (adjAmount != null && adjAmount.compareTo(BigDecimal.ZERO) != 0) { - newAdjustment.set("amount", adjAmount.divide(baseQuantity, generalRounding)); + newAdjustment.set("amount", adjAmount.divide(baseQuantity, GEN_ROUNDING)); } Debug.logInfo("Cloned adj: " + newAdjustment, MODULE); item.addAdjustment(newAdjustment); @@ -2594,7 +2594,7 @@ public class ShoppingCartItem implements java.io.Serializable { // we use != becuase adjustments can be +/- if (adjAmount != null && adjAmount.compareTo(BigDecimal.ZERO) != 0) { - newAdjustment.set("amount", adjAmount.divide(baseQuantity, generalRounding)); + newAdjustment.set("amount", adjAmount.divide(baseQuantity, GEN_ROUNDING)); } Debug.logInfo("Updated adj: " + newAdjustment, MODULE); this.addAdjustment(newAdjustment); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java index 711c960..c8cebba 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java @@ -65,7 +65,7 @@ public class ShoppingCartServices { private static final String MODULE = ShoppingCartServices.class.getName(); private static final String RES_ERROR = "OrderErrorUiLabels"; - public static final MathContext generalRounding = new MathContext(10); + public static final MathContext GEN_ROUNDING = new MathContext(10); public static Map<String, Object> assignItemShipGroup(DispatchContext dctx, Map<String, Object> context) { ShoppingCart cart = (ShoppingCart) context.get("shoppingCart"); Integer fromGroupIndex = (Integer) context.get("fromGroupIndex"); @@ -859,7 +859,7 @@ public class ShoppingCartServices { if (amount.compareTo(BigDecimal.ZERO) > 0) { // If, in the quote, an amount is set, we need to // pass to the cart the quoteUnitPrice/amount value. - quoteUnitPrice = quoteUnitPrice.divide(amount, generalRounding); + quoteUnitPrice = quoteUnitPrice.divide(amount, GEN_ROUNDING); } //rental product data @@ -1232,4 +1232,4 @@ public class ShoppingCartServices { } return result; } -} +} \ No newline at end of file diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java index 21438eb..4f04d8c 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java @@ -447,7 +447,7 @@ public final class ProductPromoWorker { Set<String> enteredCodes = cart.getProductPromoCodesEntered(); // Check whether any promotion code is applied on order. if (cart.getOrderId() != null) { - List<GenericValue> orderproductPromoCodes = EntityQuery.use(delegator).from("OrderProductPromoCode").where("orderId", cart.getOrderId()).queryList(); + List<GenericValue> orderproductPromoCodes = EntityQuery.use(delegator).from("OrderProductPromoCode").where("orderId", cart.getOrderId()).queryList(); Iterator<GenericValue> orderproductPromoCodesItr = UtilMisc.toIterator(orderproductPromoCodes); while (orderproductPromoCodesItr != null && orderproductPromoCodesItr.hasNext()) { GenericValue orderproductPromoCode = orderproductPromoCodesItr.next(); @@ -977,7 +977,9 @@ public final class ProductPromoWorker { if (condResult.containsKey("operatorEnumId")) { operatorEnumId = (String) condResult.get("operatorEnumId"); } - if (Debug.verboseOn()) Debug.logVerbose("Condition compare done, compareBase=" + compareBase, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Condition compare done, compareBase=" + compareBase, MODULE); + } if (compareBase != null) { int compare = compareBase; if ("PPC_EQ".equals(operatorEnumId)) { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java index fb0984b..7142f40 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java @@ -182,7 +182,7 @@ public class ShoppingListEvents { String shoppingListId = request.getParameter("shoppingListId"); String includeChild = request.getParameter("includeChild"); - String prodCatalogId = CatalogWorker.getCurrentCatalogId(request); + String prodCatalogId = CatalogWorker.getCurrentCatalogId(request); try { addListToCart(delegator, dispatcher, cart, prodCatalogId, shoppingListId, (includeChild != null), true, true); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/taxware/TaxwareUTL.java b/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/taxware/TaxwareUTL.java index a20be9e..e772ccc 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/taxware/TaxwareUTL.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/taxware/TaxwareUTL.java @@ -115,8 +115,12 @@ public class TaxwareUTL { outBuffer.append(outItem.writeDataFile()); // print out the datafile - if (Debug.verboseOn()) Debug.logVerbose("::Out String::", MODULE); - if (Debug.verboseOn()) Debug.logVerbose("\"" + outBuffer.toString() + "\"", MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("::Out String::", MODULE); + } + if (Debug.verboseOn()) { + Debug.logVerbose("\"" + outBuffer.toString() + "\"", MODULE); + } File outFile = new File("TAXWARE-TEST.IN"); FileOutputStream fos = null; @@ -240,12 +244,18 @@ public class TaxwareUTL { StringBuilder inBuffer = new StringBuilder(); int result = callTaxware(outBuffer.toString(), inBuffer); - if (Debug.verboseOn()) Debug.logVerbose("Taxware Return: " + result, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Taxware Return: " + result, MODULE); + } if (result != 1) throw new TaxwareException("Taxware processing failed (" + result + ")"); - if (Debug.verboseOn()) Debug.logVerbose("::Return String::", MODULE); - if (Debug.verboseOn()) Debug.logVerbose("\"" + inBuffer.toString() + "\"", MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("::Return String::", MODULE); + } + if (Debug.verboseOn()) { + Debug.logVerbose("\"" + inBuffer.toString() + "\"", MODULE); + } return inBuffer; } @@ -272,7 +282,9 @@ public class TaxwareUTL { String headStr = retBuffer.toString().substring(0, 283); String itemStr = retBuffer.toString().substring(284); - if (Debug.verboseOn()) Debug.logVerbose("Return Size: " + retBuffer.length(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Return Size: " + retBuffer.length(), MODULE); + } Delegator delegator = shipToAddress.getDelegator(); retHead.readDataFile(headStr); @@ -281,8 +293,12 @@ public class TaxwareUTL { List retRecords = retItem.getRecords(); Iterator i = retRecords.iterator(); - if (Debug.verboseOn()) Debug.logVerbose("Returned Records: " + retRecords.size(), MODULE); - if (Debug.verboseOn()) Debug.logVerbose("Sent Items: " + records.size(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Returned Records: " + retRecords.size(), MODULE); + } + if (Debug.verboseOn()) { + Debug.logVerbose("Sent Items: " + records.size(), MODULE); + } while (i.hasNext()) { Record rec = (Record) i.next(); @@ -293,7 +309,9 @@ public class TaxwareUTL { List currentItem = new ArrayList(); if (rec.getBigDecimal("TAX_AMT_COUNTRY").compareTo(BigDecimal.ZERO) > 0) { - if (Debug.verboseOn()) Debug.logVerbose("Country Tax Amount: " + rec.getBigDecimal("TAX_AMT_COUNTRY"), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Country Tax Amount: " + rec.getBigDecimal("TAX_AMT_COUNTRY"), MODULE); + } BigDecimal rate = rec.getBigDecimal("TAX_RATE_COUNTRY").movePointRight(2); String type = "S".equals(rec.getString("TAX_TYPE_COUNTRY")) ? "SALES TAX" : "USE TAX"; String jur = rec.get("JUR_COUNTRY") != null ? rec.getString("JUR_COUNTRY").trim() : ""; @@ -460,7 +478,9 @@ public class TaxwareUTL { String name = mf.name; String value = rec.getString(name); - if (Debug.verboseOn()) Debug.logVerbose("Field: " + name + " => " + value, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Field: " + name + " => " + value, MODULE); + } } } return retRecords.size(); diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java index 35c4db8..aaf2515 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java @@ -2315,7 +2315,7 @@ public class PartyServices { try (BufferedReader csvReader = new BufferedReader(new StringReader(csvString))) { for (final CSVRecord rec : fmt.parse(csvReader)) { if (UtilValidate.isNotEmpty(rec.get("partyId"))) { - currentPartyId = rec.get("partyId"); + currentPartyId = rec.get("partyId"); } if (lastPartyId == null || !currentPartyId.equals(lastPartyId)) { newPartyId = null; diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java index fa46065..0bd7a91 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java @@ -140,7 +140,7 @@ public class PartyWorker { GenericValue latestPostalAddress = findPartyLatestPostalAddress(partyId, delegator); if (latestPostalAddress != null) { try { - GenericValue latestGeoPoint = latestPostalAddress.getRelatedOne("GeoPoint", false); + GenericValue latestGeoPoint = latestPostalAddress.getRelatedOne("GeoPoint", false); if (latestGeoPoint != null) { return latestGeoPoint; } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java index 9063ae6..e155ae5 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java @@ -174,7 +174,9 @@ public final class CatalogWorker { } if (!fromSession) { - if (Debug.verboseOn()) Debug.logVerbose("[CatalogWorker.getCurrentCatalogId] Setting new catalog name: " + prodCatalogId, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("[CatalogWorker.getCurrentCatalogId] Setting new catalog name: " + prodCatalogId, MODULE); + } session.setAttribute("CURRENT_CATALOG_ID", prodCatalogId); CategoryWorker.setTrail(request, new LinkedList<>()); } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlDirective.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlDirective.java index c15e8fa..8e74952 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlDirective.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlDirective.java @@ -35,12 +35,10 @@ import freemarker.template.utility.DeepUnwrap; /** * CatalogUrlDirective - Freemarker Template Directive for generating URLs suitable for use by the CatalogUrlServlet - * * Accepts the following arguments (see CatalogUrlServlet for their definition): * productId * currentCategoryId * previousCategoryId - * */ public class CatalogUrlDirective implements TemplateDirectiveModel { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java index 124b232..8657289 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java @@ -84,7 +84,7 @@ public class CatalogUrlServlet extends HttpServlet { if (lastPathElement.startsWith("p_")) { productId = lastPathElement.substring(2); } else { - GenericValue productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", lastPathElement).cache(true).queryOne(); + GenericValue productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", lastPathElement).cache(true).queryOne(); if (productCategory != null) { categoryId = lastPathElement; } else { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java index bd6f804..900a2a9 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java @@ -68,7 +68,9 @@ public class CategoryServices { try { productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", categoryId).cache().queryOne(); members = EntityUtil.filterByDate(productCategory.getRelated("ProductCategoryMember", null, UtilMisc.toList("sequenceNum"), true), true); - if (Debug.verboseOn()) Debug.logVerbose("Category: " + productCategory + " Member Size: " + members.size() + " Members: " + members, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Category: " + productCategory + " Member Size: " + members.size() + " Members: " + members, MODULE); + } } catch (GenericEntityException e) { Debug.logError(e, "Problem reading product categories: " + e.getMessage(), MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java index 2cc26f7..984f356 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java @@ -76,7 +76,9 @@ public final class CategoryWorker { topCatName = "CATALOG1"; if (!fromSession) { - if (Debug.infoOn()) Debug.logInfo("[CategoryWorker.getCatalogTopCategory] Setting new top category: " + topCatName, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("[CategoryWorker.getCatalogTopCategory] Setting new top category: " + topCatName, MODULE); + } httpRequest.getSession().setAttribute("CATALOG_TOP_CATEGORY", topCatName); } return topCatName; @@ -109,7 +111,9 @@ public final class CategoryWorker { if (requestId.equals("")) return; - if (Debug.infoOn()) Debug.logInfo("[CategoryWorker.getRelatedCategories] RequestID: " + requestId, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("[CategoryWorker.getRelatedCategories] RequestID: " + requestId, MODULE); + } getRelatedCategories(request, attributeName, requestId, limitView); } @@ -140,7 +144,9 @@ public final class CategoryWorker { public static List<GenericValue> getRelatedCategoriesRet(Delegator delegator, String attributeName, String parentId, boolean limitView, boolean excludeEmpty, boolean recursive) { List<GenericValue> categories = new LinkedList<>(); - if (Debug.verboseOn()) Debug.logVerbose("[CategoryWorker.getRelatedCategories] ParentID: " + parentId, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("[CategoryWorker.getRelatedCategories] ParentID: " + parentId, MODULE); + } List<GenericValue> rollups = null; @@ -229,7 +235,9 @@ public final class CategoryWorker { } public static void setTrail(ServletRequest request, String currentCategory, String previousCategory) { - if (Debug.verboseOn()) Debug.logVerbose("[CategoryWorker.setTrail] Start: previousCategory=" + previousCategory + " currentCategory=" + currentCategory, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("[CategoryWorker.setTrail] Start: previousCategory=" + previousCategory + " currentCategory=" + currentCategory, MODULE); + } // if there is no current category, just return and do nothing to that the last settings will stay if (UtilValidate.isEmpty(currentCategory)) { @@ -289,7 +297,9 @@ public final class CategoryWorker { // add the current category to the end of the list trail.add(currentCategoryId); - if (Debug.verboseOn()) Debug.logVerbose("[CategoryWorker.setTrail] Continuing list: Added currentCategory: " + currentCategoryId, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("[CategoryWorker.setTrail] Continuing list: Added currentCategory: " + currentCategoryId, MODULE); + } return trail; } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java index 758fed0..4973b0b 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java @@ -46,7 +46,6 @@ import org.xml.sax.SAXException; /** * SeoConfigUtil - SEO Configuration file utility. - * */ public final class SeoConfigUtil { private static final String MODULE = SeoConfigUtil.class.getName(); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java index e8cebee..5d21ac3 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java @@ -133,7 +133,7 @@ public class FrameImage { } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - result = ServiceUtil.returnError(e.getMessage()); + result = ServiceUtil.returnError(e.getMessage()); result.putAll(context); } @@ -148,7 +148,7 @@ public class FrameImage { } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - result = ServiceUtil.returnError(e.getMessage()); + result = ServiceUtil.returnError(e.getMessage()); result.putAll(context); } @@ -188,7 +188,7 @@ public class FrameImage { } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - result = ServiceUtil.returnError(e.getMessage()); + result = ServiceUtil.returnError(e.getMessage()); result.putAll(context); } @@ -206,7 +206,7 @@ public class FrameImage { } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - result = ServiceUtil.returnError(e.getMessage()); + result = ServiceUtil.returnError(e.getMessage()); result.putAll(context); } @@ -220,13 +220,13 @@ public class FrameImage { } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - result = ServiceUtil.returnError(e.getMessage()); + result = ServiceUtil.returnError(e.getMessage()); result.putAll(context); } } else { String errMsg = UtilProperties.getMessage(RES_ERROR, "ProductPleaseSelectImage", locale); Debug.logFatal(errMsg, MODULE); - result = ServiceUtil.returnError(errMsg); + result = ServiceUtil.returnError(errMsg); result.putAll(context); } String successMsg = UtilProperties.getMessage(RESOURCE, "ProductFrameImageSuccessfully", locale); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java index b2e54b1..eda6459 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java @@ -61,7 +61,7 @@ public class InventoryServices { public final static String MODULE = InventoryServices.class.getName(); private static final String RESOURCE = "ProductUiLabels"; - public static final MathContext generalRounding = new MathContext(10); + public static final MathContext GEN_ROUNDING = new MathContext(10); public static Map<String, Object> prepareInventoryTransfer(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); @@ -193,17 +193,17 @@ public class InventoryServices { } } else if ("SERIALIZED_INV_ITEM".equals(inventoryType)) { // set the status to avoid re-moving or something - if (newItem != null) { + if (newItem != null) { newItem.refresh(); newItem.set("statusId", "INV_BEING_TRANSFERED"); newItem.store(); results.put("inventoryItemId", newItem.get("inventoryItemId")); - } else { + } else { inventoryItem.refresh(); inventoryItem.set("statusId", "INV_BEING_TRANSFERED"); inventoryItem.store(); results.put("inventoryItemId", inventoryItem.get("inventoryItemId")); - } + } } return results; @@ -696,7 +696,8 @@ public class InventoryServices { // if there is no quantity for the associated product in ProductAssoc entity, default it to 1.0 if (assocQuantity == null) { - Debug.logWarning("ProductAssoc from [" + productAssoc.getString("productId") + "] to [" + productAssoc.getString("productIdTo") + "] has no quantity, assuming 1.0", MODULE); + Debug.logWarning("ProductAssoc from [" + productAssoc.getString("productId") + "] to [" + productAssoc.getString("productIdTo") + + "] has no quantity, assuming 1.0", MODULE); assocQuantity = BigDecimal.ONE; } @@ -718,8 +719,8 @@ public class InventoryServices { // Figure out what the QOH and ATP inventory would be with this associated product BigDecimal currentQuantityOnHandTotal = (BigDecimal) resultOutput.get("quantityOnHandTotal"); BigDecimal currentAvailableToPromiseTotal = (BigDecimal) resultOutput.get("availableToPromiseTotal"); - BigDecimal tmpQuantityOnHandTotal = currentQuantityOnHandTotal.divideToIntegralValue(assocQuantity, generalRounding); - BigDecimal tmpAvailableToPromiseTotal = currentAvailableToPromiseTotal.divideToIntegralValue(assocQuantity, generalRounding); + BigDecimal tmpQuantityOnHandTotal = currentQuantityOnHandTotal.divideToIntegralValue(assocQuantity, GEN_ROUNDING); + BigDecimal tmpAvailableToPromiseTotal = currentAvailableToPromiseTotal.divideToIntegralValue(assocQuantity, GEN_ROUNDING); // reset the minimum QOH and ATP quantities if those quantities for this product are less if (minQuantityOnHandTotal == null || tmpQuantityOnHandTotal.compareTo(minQuantityOnHandTotal) < 0) { @@ -730,8 +731,9 @@ public class InventoryServices { } if (Debug.verboseOn()) { - Debug.logVerbose("productIdTo = " + productIdTo + " assocQuantity = " + assocQuantity + "current QOH " + currentQuantityOnHandTotal + - "currentATP = " + currentAvailableToPromiseTotal + " minQOH = " + minQuantityOnHandTotal + " minATP = " + minAvailableToPromiseTotal, MODULE); + Debug.logVerbose("productIdTo = " + productIdTo + " assocQuantity = " + assocQuantity + "current QOH " + currentQuantityOnHandTotal + + "currentATP = " + currentAvailableToPromiseTotal + " minQOH = " + minQuantityOnHandTotal + " minATP = " + + minAvailableToPromiseTotal, MODULE); } } // the final QOH and ATP quantities are the minimum of all the products @@ -745,7 +747,6 @@ public class InventoryServices { return result; } - public static Map<String, Object> getProductInventorySummaryForItems(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -847,8 +848,6 @@ public class InventoryServices { results.put("mktgPkgQOHMap", mktgPkgQohMap); return results; } - - public static Map<String, Object> getProductInventoryAndFacilitySummary(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -967,8 +966,7 @@ public class InventoryServices { EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId), EntityCondition.makeCondition("statusId", EntityOperator.IN, UtilMisc.toList("ORDER_COMPLETED", "ORDER_APPROVED", "ORDER_HELD")), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"), - EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, checkTime) - ), + EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, checkTime)), EntityOperator.AND); try (EntityListIterator salesUsageIt = EntityQuery.use(delegator).from(salesUsageViewEntity).where(cond).queryIterator()) { @@ -987,8 +985,7 @@ public class InventoryServices { EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId), EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId), EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "PROD_ORDER_TASK"), - EntityCondition.makeCondition("actualCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, checkTime) - ), + EntityCondition.makeCondition("actualCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, checkTime)), EntityOperator.AND); try (EntityListIterator productionUsageIt = EntityQuery.use(delegator).from(productionUsageViewEntity).where(conditions).queryIterator()) { @@ -1013,5 +1010,4 @@ public class InventoryServices { } return result; } - } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java index 5d6ff8f..f1b76ec 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java @@ -176,7 +176,8 @@ public class PriceServices { List<GenericValue> virtualProductPrices = null; if (virtualProductId != null) { try { - virtualProductPrices = EntityQuery.use(delegator).from("ProductPrice").where("productId", virtualProductId, "currencyUomId", currencyDefaultUomId, "productStoreGroupId", productStoreGroupId).orderBy("-fromDate").cache(true).queryList(); + virtualProductPrices = EntityQuery.use(delegator).from("ProductPrice").where("productId", virtualProductId, "currencyUomId", + currencyDefaultUomId, "productStoreGroupId", productStoreGroupId).orderBy("-fromDate").cache(true).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "An error occurred while getting the product prices", MODULE); } @@ -203,7 +204,8 @@ public class PriceServices { List<EntityCondition> productPriceEcList = new LinkedList<>(); productPriceEcList.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)); - // this funny statement is for backward compatibility purposes; the productPricePurposeId is a new pk field on the ProductPrice entity and in order databases may not be populated, until the pk is updated and such; this will ease the transition somewhat + // this funny statement is for backward compatibility purposes; the productPricePurposeId is a new pk field on the ProductPrice entity and + // in order databases may not be populated, until the pk is updated and such; this will ease the transition somewhat if ("PURCHASE".equals(productPricePurposeId)) { productPriceEcList.add(EntityCondition.makeCondition( EntityCondition.makeCondition("productPricePurposeId", EntityOperator.EQUALS, productPricePurposeId), @@ -263,12 +265,14 @@ public class PriceServices { if (defaultPriceValue == null) { //use the cache to find the variant with the lowest default price try { - List<GenericValue> variantAssocList = EntityQuery.use(delegator).from("ProductAssoc").where("productId", product.get("productId"), "productAssocTypeId", "PRODUCT_VARIANT").orderBy("-fromDate").cache(true).filterByDate().queryList(); + List<GenericValue> variantAssocList = EntityQuery.use(delegator).from("ProductAssoc").where("productId", product.get("productId"), + "productAssocTypeId", "PRODUCT_VARIANT").orderBy("-fromDate").cache(true).filterByDate().queryList(); BigDecimal minDefaultPrice = null; List<GenericValue> variantProductPrices = null; for (GenericValue variantAssoc: variantAssocList) { String curVariantProductId = variantAssoc.getString("productIdTo"); - List<GenericValue> curVariantPriceList = EntityQuery.use(delegator).from("ProductPrice").where("productId", curVariantProductId).orderBy("-fromDate").cache(true).filterByDate(nowTimestamp).queryList(); + List<GenericValue> curVariantPriceList = EntityQuery.use(delegator).from("ProductPrice") + .where("productId", curVariantProductId).orderBy("-fromDate").cache(true).filterByDate(nowTimestamp).queryList(); List<GenericValue> tempDefaultPriceList = EntityUtil.filterByAnd(curVariantPriceList, UtilMisc.toMap("productPriceTypeId", "DEFAULT_PRICE")); GenericValue curDefaultPriceValue = EntityUtil.getFirst(tempDefaultPriceList); if (curDefaultPriceValue != null) { @@ -410,7 +414,8 @@ public class PriceServices { if (errorResult != null) return errorResult; } else { try { - List<GenericValue> allProductPriceRules = makeProducePriceRuleList(delegator, optimizeForLargeRuleSet, productId, virtualProductId, prodCatalogId, productStoreGroupId, webSiteId, partyId, currencyDefaultUomId); + List<GenericValue> allProductPriceRules = makeProducePriceRuleList(delegator, optimizeForLargeRuleSet, productId, virtualProductId, + prodCatalogId, productStoreGroupId, webSiteId, partyId, currencyDefaultUomId); allProductPriceRules = EntityUtil.filterByDate(allProductPriceRules, true); List<GenericValue> quantityProductPriceRules = null; @@ -420,7 +425,8 @@ public class PriceServices { quantityProductPriceRules = new LinkedList<>(); nonQuantityProductPriceRules = new LinkedList<>(); for (GenericValue productPriceRule: allProductPriceRules) { - List<GenericValue> productPriceCondList = EntityQuery.use(delegator).from("ProductPriceCond").where("productPriceRuleId", productPriceRule.get("productPriceRuleId")).cache(true).queryList(); + List<GenericValue> productPriceCondList = EntityQuery.use(delegator).from("ProductPriceCond").where("productPriceRuleId", + productPriceRule.get("productPriceRuleId")).cache(true).queryList(); boolean foundQuantityInputParam = false; // only consider a rule if all conditions except the quantity condition are true @@ -429,7 +435,8 @@ public class PriceServices { if ("PRIP_QUANTITY".equals(productPriceCond.getString("inputParamEnumId"))) { foundQuantityInputParam = true; } else { - if (!checkPriceCondition(productPriceCond, productId, virtualProductId, prodCatalogId, productStoreGroupId, webSiteId, partyId, quantity, listPrice, currencyDefaultUomId, delegator, nowTimestamp)) { + if (!checkPriceCondition(productPriceCond, productId, virtualProductId, prodCatalogId, productStoreGroupId, + webSiteId, partyId, quantity, listPrice, currencyDefaultUomId, delegator, nowTimestamp)) { allExceptQuantTrue = false; } } @@ -564,7 +571,11 @@ public class PriceServices { List<GenericValue> filteredPrices = EntityUtil.filterByAnd(productPriceList, UtilMisc.toMap("productPriceTypeId", productPriceTypeId)); GenericValue priceValue = EntityUtil.getFirst(filteredPrices); if (filteredPrices != null && filteredPrices.size() > 1) { - if (Debug.infoOn()) Debug.logInfo("There is more than one " + productPriceTypeId + " with the currencyUomId " + priceValue.getString("currencyUomId") + " and productId " + priceValue.getString("productId") + ", using the latest found with price: " + priceValue.getBigDecimal("price"), MODULE); + if (Debug.infoOn()) { + Debug.logInfo("There is more than one " + productPriceTypeId + " with the currencyUomId " + priceValue.getString("currencyUomId") + + " and productId " + priceValue.getString("productId") + ", using the latest found with price: " + + priceValue.getBigDecimal("price"), MODULE); + } } if (priceValue == null && secondaryPriceList != null) { return getPriceValueForType(productPriceTypeId, secondaryPriceList, null); @@ -572,8 +583,9 @@ public class PriceServices { return priceValue; } - public static Map<String, Object> addGeneralResults(Map<String, Object> result, GenericValue competitivePriceValue, GenericValue specialPromoPriceValue, GenericValue productStore, - String checkIncludeVat, String currencyUomId, String productId, BigDecimal quantity, String partyId, LocalDispatcher dispatcher, Locale locale) { + public static Map<String, Object> addGeneralResults(Map<String, Object> result, GenericValue competitivePriceValue, + GenericValue specialPromoPriceValue, GenericValue productStore, String checkIncludeVat, String currencyUomId, String productId, + BigDecimal quantity, String partyId, LocalDispatcher dispatcher, Locale locale) { result.put("competitivePrice", competitivePriceValue != null ? competitivePriceValue.getBigDecimal("price") : null); result.put("specialPromoPrice", specialPromoPriceValue != null ? specialPromoPriceValue.getBigDecimal("price") : null); result.put("currencyUsed", currencyUomId); @@ -624,7 +636,9 @@ public class PriceServices { return null; } - public static List<GenericValue> makeProducePriceRuleList(Delegator delegator, boolean optimizeForLargeRuleSet, String productId, String virtualProductId, String prodCatalogId, String productStoreGroupId, String webSiteId, String partyId, String currencyUomId) throws GenericEntityException { + public static List<GenericValue> makeProducePriceRuleList(Delegator delegator, boolean optimizeForLargeRuleSet, String productId, + String virtualProductId, String prodCatalogId, String productStoreGroupId, String webSiteId, String partyId, String currencyUomId) + throws GenericEntityException { List<GenericValue> productPriceRules = null; // At this point we have two options: optimize for large ruleset, or optimize for small ruleset @@ -678,7 +692,8 @@ public class PriceServices { // later: (by partyClassificationTypeId) // by listPrice - Collection<GenericValue> listPriceConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", "PRIP_LIST_PRICE").cache(true).queryList(); + Collection<GenericValue> listPriceConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", + "PRIP_LIST_PRICE").cache(true).queryList(); if (UtilValidate.isNotEmpty(listPriceConds)) { for (GenericValue listPriceCond: listPriceConds) { productPriceRuleIds.add(listPriceCond.getString("productPriceRuleId")); @@ -688,7 +703,8 @@ public class PriceServices { // ------- These are all of them that DO depend on the current inputs ------- // by productId - Collection<GenericValue> productIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", "PRIP_PRODUCT_ID", "condValue", productId).cache(true).queryList(); + Collection<GenericValue> productIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", + "PRIP_PRODUCT_ID", "condValue", productId).cache(true).queryList(); if (UtilValidate.isNotEmpty(productIdConds)) { for (GenericValue productIdCond: productIdConds) { productPriceRuleIds.add(productIdCond.getString("productPriceRuleId")); @@ -697,7 +713,8 @@ public class PriceServices { // by virtualProductId, if not null if (virtualProductId != null) { - Collection<GenericValue> virtualProductIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", "PRIP_PRODUCT_ID", "condValue", virtualProductId).cache(true).queryList(); + Collection<GenericValue> virtualProductIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", + "PRIP_PRODUCT_ID", "condValue", virtualProductId).cache(true).queryList(); if (UtilValidate.isNotEmpty(virtualProductIdConds)) { for (GenericValue virtualProductIdCond: virtualProductIdConds) { productPriceRuleIds.add(virtualProductIdCond.getString("productPriceRuleId")); @@ -707,7 +724,8 @@ public class PriceServices { // by prodCatalogId - which is optional in certain cases if (UtilValidate.isNotEmpty(prodCatalogId)) { - Collection<GenericValue> prodCatalogIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", "PRIP_PROD_CLG_ID", "condValue", prodCatalogId).cache(true).queryList(); + Collection<GenericValue> prodCatalogIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", + "PRIP_PROD_CLG_ID", "condValue", prodCatalogId).cache(true).queryList(); if (UtilValidate.isNotEmpty(prodCatalogIdConds)) { for (GenericValue prodCatalogIdCond: prodCatalogIdConds) { productPriceRuleIds.add(prodCatalogIdCond.getString("productPriceRuleId")); @@ -717,7 +735,8 @@ public class PriceServices { // by productStoreGroupId if (UtilValidate.isNotEmpty(productStoreGroupId)) { - Collection<GenericValue> storeGroupConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", "PRIP_PROD_SGRP_ID", "condValue", productStoreGroupId).cache(true).queryList(); + Collection<GenericValue> storeGroupConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", + "PRIP_PROD_SGRP_ID", "condValue", productStoreGroupId).cache(true).queryList(); if (UtilValidate.isNotEmpty(storeGroupConds)) { for (GenericValue storeGroupCond: storeGroupConds) { productPriceRuleIds.add(storeGroupCond.getString("productPriceRuleId")); @@ -727,7 +746,8 @@ public class PriceServices { // by webSiteId if (UtilValidate.isNotEmpty(webSiteId)) { - Collection<GenericValue> webSiteIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", "PRIP_WEBSITE_ID", "condValue", webSiteId).cache(true).queryList(); + Collection<GenericValue> webSiteIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", + "PRIP_WEBSITE_ID", "condValue", webSiteId).cache(true).queryList(); if (UtilValidate.isNotEmpty(webSiteIdConds)) { for (GenericValue webSiteIdCond: webSiteIdConds) { productPriceRuleIds.add(webSiteIdCond.getString("productPriceRuleId")); @@ -737,7 +757,8 @@ public class PriceServices { // by partyId if (UtilValidate.isNotEmpty(partyId)) { - Collection<GenericValue> partyIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", "PRIP_PARTY_ID", "condValue", partyId).cache(true).queryList(); + Collection<GenericValue> partyIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", + "PRIP_PARTY_ID", "condValue", partyId).cache(true).queryList(); if (UtilValidate.isNotEmpty(partyIdConds)) { for (GenericValue partyIdCond: partyIdConds) { productPriceRuleIds.add(partyIdCond.getString("productPriceRuleId")); @@ -746,7 +767,8 @@ public class PriceServices { } // by currencyUomId - Collection<GenericValue> currencyUomIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", "PRIP_CURRENCY_UOMID", "condValue", currencyUomId).cache(true).queryList(); + Collection<GenericValue> currencyUomIdConds = EntityQuery.use(delegator).from("ProductPriceCond").where("inputParamEnumId", + "PRIP_CURRENCY_UOMID", "condValue", currencyUomId).cache(true).queryList(); if (UtilValidate.isNotEmpty(currencyUomIdConds)) { for (GenericValue currencyUomIdCond: currencyUomIdConds) { productPriceRuleIds.add(currencyUomIdCond.getString("productPriceRuleId")); @@ -755,7 +777,8 @@ public class PriceServices { productPriceRules = new LinkedList<>(); for (String productPriceRuleId: productPriceRuleIds) { - GenericValue productPriceRule = EntityQuery.use(delegator).from("ProductPriceRule").where("productPriceRuleId", productPriceRuleId).cache().queryOne(); + GenericValue productPriceRule = EntityQuery.use(delegator).from("ProductPriceRule").where("productPriceRuleId", productPriceRuleId) + .cache().queryOne(); if (productPriceRule == null) continue; productPriceRules.add(productPriceRule); } @@ -814,7 +837,8 @@ public class PriceServices { totalConds++; - if (!checkPriceCondition(productPriceCond, productId, virtualProductId, prodCatalogId, productStoreGroupId, webSiteId, partyId, quantity, listPrice, currencyUomId, delegator, nowTimestamp)) { + if (!checkPriceCondition(productPriceCond, productId, virtualProductId, prodCatalogId, productStoreGroupId, webSiteId, partyId, + quantity, listPrice, currencyUomId, delegator, nowTimestamp)) { allTrue = false; break; } @@ -980,7 +1004,9 @@ public class PriceServices { Debug.logVerbose("Unchecked Calculated price: " + price, MODULE); Debug.logVerbose("PriceInfo:", MODULE); for (GenericValue orderItemPriceInfo: orderItemPriceInfos) { - if (Debug.verboseOn()) Debug.logVerbose(" --- " + orderItemPriceInfo, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose(" --- " + orderItemPriceInfo, MODULE); + } } } @@ -1006,7 +1032,9 @@ public class PriceServices { validPriceFound = true; } - if (Debug.verboseOn()) Debug.logVerbose("Final Calculated price: " + price + ", rules: " + totalRules + ", conds: " + totalConds + ", actions: " + totalActions, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Final Calculated price: " + price + ", rules: " + totalRules + ", conds: " + totalConds + ", actions: " + totalActions, MODULE); + } calcResults.put("basePrice", price); calcResults.put("price", price); @@ -1023,7 +1051,9 @@ public class PriceServices { public static boolean checkPriceCondition(GenericValue productPriceCond, String productId, String virtualProductId, String prodCatalogId, String productStoreGroupId, String webSiteId, String partyId, BigDecimal quantity, BigDecimal listPrice, String currencyUomId, Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException { - if (Debug.verboseOn()) Debug.logVerbose("Checking price condition: " + productPriceCond, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Checking price condition: " + productPriceCond, MODULE); + } int compare = 0; if ("PRIP_PRODUCT_ID".equals(productPriceCond.getString("inputParamEnumId"))) { @@ -1049,7 +1079,8 @@ public class PriceServices { // NOTE: we may want to parameterize this in the future, ie with an indicator on the ProductPriceCond entity if (compare == 1 && UtilValidate.isNotEmpty(virtualProductId)) { // and from/thru date within range - List<GenericValue> virtualProductCategoryMembers = EntityQuery.use(delegator).from("ProductCategoryMember").where("productId", virtualProductId, "productCategoryId", productCategoryId).cache(true).filterByDate(nowTimestamp).queryList(); + List<GenericValue> virtualProductCategoryMembers = EntityQuery.use(delegator).from("ProductCategoryMember").where("productId", + virtualProductId, "productCategoryId", productCategoryId).cache(true).filterByDate(nowTimestamp).queryList(); if (UtilValidate.isNotEmpty(virtualProductCategoryMembers)) { // we found a member record? great, then this condition is satisfied compare = 0; @@ -1061,7 +1092,8 @@ public class PriceServices { // if a ProductFeatureAppl exists for this productId and the specified productFeatureId String productFeatureId = productPriceCond.getString("condValue"); // and from/thru date within range - List<GenericValue> productFeatureAppls = EntityQuery.use(delegator).from("ProductFeatureAppl").where("productId", productId, "productFeatureId", productFeatureId).cache(true).filterByDate(nowTimestamp).queryList(); + List<GenericValue> productFeatureAppls = EntityQuery.use(delegator).from("ProductFeatureAppl").where("productId", productId, + "productFeatureId", productFeatureId).cache(true).filterByDate(nowTimestamp).queryList(); // then 0 (equals), otherwise 1 (not equals) if (UtilValidate.isNotEmpty(productFeatureAppls)) { compare = 0; @@ -1113,7 +1145,8 @@ public class PriceServices { // partyRelationshipTypeId=GROUP_ROLLUP, the partyIdTo is // the group member, so the partyIdFrom is the groupPartyId // and from/thru date within range - List<GenericValue> partyRelationshipList = EntityQuery.use(delegator).from("PartyRelationship").where("partyIdFrom", groupPartyId, "partyIdTo", partyId, "partyRelationshipTypeId", "GROUP_ROLLUP").cache(true).filterByDate(nowTimestamp).queryList(); + List<GenericValue> partyRelationshipList = EntityQuery.use(delegator).from("PartyRelationship").where("partyIdFrom", groupPartyId, + "partyIdTo", partyId, "partyRelationshipTypeId", "GROUP_ROLLUP").cache(true).filterByDate(nowTimestamp).queryList(); // then 0 (equals), otherwise 1 (not equals) if (UtilValidate.isNotEmpty(partyRelationshipList)) { compare = 0; @@ -1129,7 +1162,8 @@ public class PriceServices { String partyClassificationGroupId = productPriceCond.getString("condValue"); // find any PartyClassification // and from/thru date within range - List<GenericValue> partyClassificationList = EntityQuery.use(delegator).from("PartyClassification").where("partyId", partyId, "partyClassificationGroupId", partyClassificationGroupId).cache(true).filterByDate(nowTimestamp).queryList(); + List<GenericValue> partyClassificationList = EntityQuery.use(delegator).from("PartyClassification").where("partyId", partyId, + "partyClassificationGroupId", partyClassificationGroupId).cache(true).filterByDate(nowTimestamp).queryList(); // then 0 (equals), otherwise 1 (not equals) if (UtilValidate.isNotEmpty(partyClassificationList)) { compare = 0; @@ -1140,7 +1174,8 @@ public class PriceServices { } else if ("PRIP_ROLE_TYPE".equals(productPriceCond.getString("inputParamEnumId"))) { if (partyId != null) { // if a PartyRole exists for this partyId and the specified roleTypeId - GenericValue partyRole = EntityQuery.use(delegator).from("PartyRole").where("partyId", partyId, "roleTypeId", productPriceCond.getString("condValue")).cache(true).queryOne(); + GenericValue partyRole = EntityQuery.use(delegator).from("PartyRole").where("partyId", partyId, "roleTypeId", + productPriceCond.getString("condValue")).cache(true).queryOne(); // then 0 (equals), otherwise 1 (not equals) if (partyRole != null) { @@ -1162,7 +1197,9 @@ public class PriceServices { return false; } - if (Debug.verboseOn()) Debug.logVerbose("Price Condition compare done, compare=" + compare, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("Price Condition compare done, compare=" + compare, MODULE); + } if ("PRC_EQ".equals(productPriceCond.getString("operatorEnumId"))) { if (compare == 0) return true; @@ -1184,7 +1221,8 @@ public class PriceServices { } private static int checkConditionPartyHierarchy(Delegator delegator, Timestamp nowTimestamp, String groupPartyId, String partyId) throws GenericEntityException { - List<GenericValue> partyRelationshipList = EntityQuery.use(delegator).from("PartyRelationship").where("partyIdTo", partyId, "partyRelationshipTypeId", "GROUP_ROLLUP").cache(true).filterByDate(nowTimestamp).queryList(); + List<GenericValue> partyRelationshipList = EntityQuery.use(delegator).from("PartyRelationship").where("partyIdTo", partyId, + "partyRelationshipTypeId", "GROUP_ROLLUP").cache(true).filterByDate(nowTimestamp).queryList(); for (GenericValue genericValue : partyRelationshipList) { String partyIdFrom = (String) genericValue.get("partyIdFrom"); if (partyIdFrom.equals(groupPartyId)) { @@ -1218,7 +1256,9 @@ public class PriceServices { Locale locale = (Locale) context.get("locale"); // a) Get the Price from the Agreement* data model - if (Debug.infoOn()) Debug.logInfo("Try to resolve purchase price from agreement " + agreementId, MODULE); + if (Debug.infoOn()) { + Debug.logInfo("Try to resolve purchase price from agreement " + agreementId, MODULE); + } if (UtilValidate.isNotEmpty(agreementId)) { //TODO Search before if agreement is associate to SupplierProduct. //confirm that agreement is price application on purchase type and contains a value for the product diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java index c34cc97..258c625 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java @@ -1099,7 +1099,7 @@ public class ProductEvents { try { product = ProductWorker.findProduct(delegator, productId); } catch (GenericEntityException e) { - productId = null; + productId = null; Debug.logError(e, MODULE); } } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java index c827f53..02aa096 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java @@ -135,7 +135,7 @@ public class ProductSearchEvents { } GenericValue searchResultView = null; - int numExpired=0; + int numExpired = 0; while ((searchResultView = eli.next()) != null) { String productId = searchResultView.getString("mainProductId"); //get all tuples that match product and category diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java index c13130c..9603f22 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java @@ -814,9 +814,9 @@ public class ProductSearchSession { if (UtilValidate.isEmpty(include)) { include = "Y"; } - Boolean inc = Boolean.TRUE; + Boolean inc = Boolean.TRUE; if ("N".equalsIgnoreCase(include)) { - inc = Boolean.FALSE; + inc = Boolean.FALSE; } searchAddConstraint(new ProductSearch.GoodIdentificationConstraint((String) parameters.get("SEARCH_GOOD_IDENTIFICATION_TYPE"), diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java index 80df49f..ca3ee88 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java @@ -481,8 +481,7 @@ public class ProductServices { EntityCondition cond = EntityCondition.makeCondition( UtilMisc.toList( EntityCondition.makeCondition("productId", productId), - EntityCondition.makeCondition("productIdTo", productId) - ), EntityJoinOperator.OR); + EntityCondition.makeCondition("productIdTo", productId)), EntityJoinOperator.OR); productAssocs = EntityQuery.use(delegator).from("ProductAssoc").where(EntityCondition.makeCondition(cond, EntityCondition.makeCondition("productAssocTypeId", type))).orderBy(orderBy).cache(true).queryList(); } else { if (productIdTo == null) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java index 1f89da9..23849b0 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java @@ -72,8 +72,7 @@ public final class ProductUtilServices { EntityCondition conditionOne = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("isVariant", EntityOperator.EQUALS, "Y"), EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.NOT_EQUAL, null), - EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp) - ), EntityOperator.AND); + EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp)), EntityOperator.AND); try (EntityListIterator eliOne = EntityQuery.use(delegator).from("Product").where(conditionOne).queryIterator()) { GenericValue productOne = null; @@ -103,8 +102,7 @@ public final class ProductUtilServices { // get all non-discontinued virtuals, see if all variant ProductAssocs are expired, if discontinue EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, "Y"), - EntityCondition.makeCondition(EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) - ), EntityOperator.AND); + EntityCondition.makeCondition(EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp))), EntityOperator.AND); try (EntityListIterator eli = EntityQuery.use(delegator).from("Product").where(condition).queryIterator()) { GenericValue product = null; int numSoFar = 0; @@ -144,8 +142,7 @@ public final class ProductUtilServices { String errMsg = null; EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.NOT_EQUAL, null), - EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp) - ), EntityOperator.AND); + EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp)), EntityOperator.AND); try (EntityListIterator eli = EntityQuery.use(delegator).from("Product").where(condition).queryIterator()) { GenericValue product = null; @@ -190,8 +187,7 @@ public final class ProductUtilServices { EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, nowTimestamp), - EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null) - ), EntityOperator.AND); + EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)), EntityOperator.AND); EntityCondition havingCond = EntityCondition.makeCondition("productIdCount", EntityOperator.GREATER_THAN, 1L); try (EntityListIterator eli = EntityQuery.use(delegator).select("productId", "productCategoryId", "productIdCount").from(dve).where(condition).having(havingCond).queryIterator()) { @@ -246,8 +242,7 @@ public final class ProductUtilServices { EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_VARIANT"), EntityCondition.makeCondition(EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, - EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN, nowTimestamp)) - ), EntityOperator.AND); + EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN, nowTimestamp))), EntityOperator.AND); EntityCondition havingCond = EntityCondition.makeCondition("productIdToCount", EntityOperator.EQUALS, 1L); EntityQuery eq = EntityQuery.use(delegator) .select("productId", "productIdToCount") @@ -282,8 +277,7 @@ public final class ProductUtilServices { EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_VARIANT"), EntityCondition.makeCondition(EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN, nowTimestamp)), EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), - EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) - ), EntityOperator.AND); + EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp))), EntityOperator.AND); eq = EntityQuery.use(delegator). select("productId", "productIdToCount"). from(dve) @@ -650,8 +644,7 @@ public final class ProductUtilServices { EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId), EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), - EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) - ), EntityOperator.AND); + EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp))), EntityOperator.AND); try (EntityListIterator productFeatureAndApplEli = EntityQuery.use(delegator).from("ProductFeatureAndAppl").where(condition).queryIterator()) { GenericValue productFeatureAndAppl = null; @@ -699,8 +692,7 @@ public final class ProductUtilServices { EntityCondition.makeCondition("productFeatureId", EntityOperator.EQUALS, productFeatureId), EntityCondition.makeCondition("productFeatureGroupId", EntityOperator.EQUALS, productFeatureGroupId), EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), - EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) - ), EntityOperator.AND); + EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp))), EntityOperator.AND); if (EntityQuery.use(delegator).from("ProductFeatureGroupAppl").where(condition).queryCount() == 0) { // if no valid ones, create one GenericValue productFeatureGroupAppl = delegator.makeValue("ProductFeatureGroupAppl", UtilMisc.toMap("productFeatureGroupId", productFeatureGroupId, "productFeatureId", productFeatureId, "fromDate", nowTimestamp)); @@ -715,8 +707,7 @@ public final class ProductUtilServices { condition = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("productCategoryId", EntityOperator.EQUALS, subProductCategoryId), EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), - EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) - ), EntityOperator.AND); + EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp))), EntityOperator.AND); try (EntityListIterator productFeatureCatGrpApplEli = EntityQuery.use(delegator).from("ProductFeatureCatGrpAppl").where(condition).queryIterator()) { GenericValue productFeatureCatGrpAppl = null; while ((productFeatureCatGrpAppl = productFeatureCatGrpApplEli.next()) != null) { @@ -725,8 +716,7 @@ public final class ProductUtilServices { EntityCondition.makeCondition("productCategoryId", EntityOperator.EQUALS, productCategoryId), EntityCondition.makeCondition("productFeatureGroupId", EntityOperator.EQUALS, productFeatureGroupId), EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp), - EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)) - ), EntityOperator.AND); + EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp))), EntityOperator.AND); if (EntityQuery.use(delegator).from("ProductFeatureCatGrpAppl").where(checkCondition).queryCount() == 0) { // if no valid ones, create one GenericValue productFeatureGroupAppl = delegator.makeValue("ProductFeatureCatGrpAppl", UtilMisc.toMap("productFeatureGroupId", productFeatureGroupId, "productCategoryId", productCategoryId, "fromDate", nowTimestamp)); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java index 917231c..bf2b8ee 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java @@ -56,8 +56,7 @@ import org.apache.ofbiz.service.ModelService; public final class ProductWorker { private static final String MODULE = ProductWorker.class.getName(); - - private static final MathContext generalRounding = new MathContext(10); + private static final MathContext GEN_ROUNDING = new MathContext(10); private ProductWorker() { } @@ -665,7 +664,7 @@ public final class ProductWorker { } } if (ratingTally.compareTo(BigDecimal.ZERO) > 0 && numRatings.compareTo(BigDecimal.ZERO) > 0) { - productRating = ratingTally.divide(numRatings, generalRounding); + productRating = ratingTally.divide(numRatings, GEN_ROUNDING); } if ("PRDR_MIN".equals(entityFieldType)) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java index 14abe69..9d37851 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java @@ -196,7 +196,7 @@ public final class ProductStoreWorker { String payProps = "payment.properties"; if (setting != null && setting.get("paymentPropertiesPath") != null) { - payProps = setting.getString("paymentPropertiesPath"); + payProps = setting.getString("paymentPropertiesPath"); } return payProps; } @@ -679,7 +679,9 @@ public final class ProductStoreWorker { // if prodCatalog is set to not check inventory break here if ("N".equals(productStore.getString("checkInventory"))) { // note: if not set, defaults to yes, check inventory - if (Debug.verboseOn()) Debug.logVerbose("ProductStore with id " + productStoreId + ", is set to NOT check inventory, returning true for inventory available check", MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("ProductStore with id " + productStoreId + ", is set to NOT check inventory, returning true for inventory available check", MODULE); + } return true; } boolean isInventoryAvailable = false; diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java index b63bfa7..f6c2c7d 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java @@ -193,7 +193,7 @@ public class PackingServices { } catch (NumberFormatException nex) { } } - for (int numPackage=0; numPackage<numPackages; numPackage++) { + for (int numPackage = 0; numPackage < numPackages; numPackage++) { session.addOrIncreaseLine(orderId, orderItemSeqId, shipGroupSeqId, prdStr, quantity, packageSeq+numPackage, weightSeq, updateQuantity); } } catch (GeneralException e) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java index 7b67e4a..ffa8c84 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java @@ -685,7 +685,7 @@ public class PackingSession implements java.io.Serializable { protected void checkReservations(boolean ignore) throws GeneralException { List<String> errors = new LinkedList<>(); for (PackingSessionLine line: this.getLines()) { - BigDecimal reservedQty = this.getCurrentReservedQuantity(line.getOrderId(), line.getOrderItemSeqId(), line.getShipGroupSeqId(), line.getProductId()); + BigDecimal reservedQty = this.getCurrentReservedQuantity(line.getOrderId(), line.getOrderItemSeqId(), line.getShipGroupSeqId(), line.getProductId()); BigDecimal packedQty = this.getPackedQuantity(line.getOrderId(), line.getOrderItemSeqId(), line.getShipGroupSeqId(), line.getProductId()); if (packedQty.compareTo(reservedQty) != 0) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java index af85f97..8b534e8 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java @@ -45,7 +45,7 @@ import org.apache.ofbiz.service.ServiceUtil; public final class ShipmentWorker { private static final String MODULE = ShipmentWorker.class.getName(); - private static final MathContext generalRounding = new MathContext(10); + private static final MathContext GEN_ROUNDING = new MathContext(10); private ShipmentWorker() { } @@ -123,9 +123,9 @@ public final class ShipmentWorker { if (pieces < 1) { pieces = 1; // can NEVER be less than one } - BigDecimal weight = totalWeight.divide(BigDecimal.valueOf(pieces), generalRounding); + BigDecimal weight = totalWeight.divide(BigDecimal.valueOf(pieces), GEN_ROUNDING); for (int z = 1; z <= totalQuantity.intValue(); z++) { - BigDecimal partialQty = pieces > 1 ? BigDecimal.ONE.divide(BigDecimal.valueOf(pieces), generalRounding) : BigDecimal.ONE; + BigDecimal partialQty = pieces > 1 ? BigDecimal.ONE.divide(BigDecimal.valueOf(pieces), GEN_ROUNDING) : BigDecimal.ONE; for (long x = 0; x < pieces; x++) { if (weight.compareTo(maxWeight) >= 0) { Map<String, BigDecimal> newPackage = new HashMap<>(); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java index 02c681f..9bbdd91 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java @@ -1854,7 +1854,9 @@ public class UpsServices { if (response == null) { throw new UpsConnectException(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsReceivedNullResponse", locale)); } - if (Debug.verboseOn()) Debug.logVerbose("UPS Response : " + response, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("UPS Response : " + response, MODULE); + } return response; } @@ -2041,7 +2043,9 @@ public class UpsServices { StringBuilder xmlString = new StringBuilder(); xmlString.append(accessRequestString); xmlString.append(rateRequestString); - if (Debug.verboseOn()) Debug.logVerbose(xmlString.toString(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose(xmlString.toString(), MODULE); + } // send the request String rateResponseString = null; try { @@ -2872,7 +2876,9 @@ public class UpsServices { StringBuilder xmlString = new StringBuilder(); xmlString.append(accessRequestString); xmlString.append(rateRequestString); - if (Debug.verboseOn()) Debug.logVerbose(xmlString.toString(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose(xmlString.toString(), MODULE); + } // send the request try { rateResponseString = sendUpsRequest("Rate", xmlString.toString(), shipmentGatewayConfigId, resource, delegator, locale); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java index 38c3a1a..05ab643 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java @@ -1554,8 +1554,7 @@ public class UspsServices { UtilMisc.toList( shipmentRouteSegment.get("shipmentId"), shipmentPackageRouteSeg.get("shipmentPackageSeqId"), - shipmentRouteSegment.get("shipmentRouteSegementId") - ), ':'); + shipmentRouteSegment.get("shipmentRouteSegementId")), ':'); UtilXml.addChildElementValue(rootElement, "FromCustomsReference", fromCustomsReference, packageDocument); // Determine the container type for this package String container = "VARIABLE"; diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java index de58732..2912517 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java @@ -326,7 +326,7 @@ public class VerifyPickSession implements Serializable { protected void checkReservedQty(String orderId, Locale locale) throws GeneralException { List<String> errorList = new LinkedList<>(); for (VerifyPickSessionRow pickRow : this.getPickRows(orderId)) { - BigDecimal reservedQty = this.getReservedQty(pickRow.getOrderId(), pickRow.getOrderItemSeqId(), pickRow.getShipGroupSeqId()); + BigDecimal reservedQty = this.getReservedQty(pickRow.getOrderId(), pickRow.getOrderItemSeqId(), pickRow.getShipGroupSeqId()); BigDecimal verifiedQty = this.getReadyToVerifyQuantity(pickRow.getOrderId(), pickRow.getOrderItemSeqId()); if (verifiedQty.compareTo(reservedQty) != 0) { errorList.add(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorVerifiedQtyDoesNotMatchTheReservedQtyForItem", UtilMisc.toMap("productId", pickRow.getProductId(), "verifiedQty", pickRow.getReadyToVerifyQty(), "reservedQty", reservedQty), locale)); diff --git a/applications/securityext/src/main/java/org/apache/ofbiz/securityext/cert/CertificateServices.java b/applications/securityext/src/main/java/org/apache/ofbiz/securityext/cert/CertificateServices.java index d9ed4e6..adc6578 100644 --- a/applications/securityext/src/main/java/org/apache/ofbiz/securityext/cert/CertificateServices.java +++ b/applications/securityext/src/main/java/org/apache/ofbiz/securityext/cert/CertificateServices.java @@ -58,7 +58,7 @@ public class CertificateServices { // read the certificate X509Certificate cert; try { - cert = (X509Certificate) KeyStoreUtil.pemToCert(certString); + cert = (X509Certificate) KeyStoreUtil.pemToCert(certString); } catch (CertificateException | IOException e) { return ServiceUtil.returnError(e.getMessage()); } diff --git a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java index db7c95f..479cb73 100644 --- a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java +++ b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java @@ -370,7 +370,9 @@ public class ICalConverter { alarm.validate(true); Debug.logVerbose("iCalendar alarm passes validation", MODULE); } catch (ValidationException e) { - if (Debug.verboseOn()) Debug.logVerbose("iCalendar alarm fails validation: " + e, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("iCalendar alarm fails validation: " + e, MODULE); + } } } } @@ -415,7 +417,9 @@ public class ICalConverter { calendar.validate(true); Debug.logVerbose("iCalendar passes validation", MODULE); } catch (ValidationException e) { - if (Debug.verboseOn()) Debug.logVerbose("iCalendar fails validation: " + e, MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("iCalendar fails validation: " + e, MODULE); + } } } return ICalWorker.createOkResponse(calendar.toString()); @@ -578,10 +582,14 @@ public class ICalConverter { boolean newCalendar = true; Calendar calendar = null; if (iCalData == null) { - if (Debug.verboseOn()) Debug.logVerbose("iCalendar Data not found, creating new Calendar", MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("iCalendar Data not found, creating new Calendar", MODULE); + } calendar = new Calendar(); } else { - if (Debug.verboseOn()) Debug.logVerbose("iCalendar Data found, using saved Calendar", MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose("iCalendar Data found, using saved Calendar", MODULE); + } try (StringReader reader = new StringReader(iCalData)) { CalendarBuilder builder = new CalendarBuilder(); calendar = builder.build(reader); diff --git a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java index f41bcb1..55fdc9e 100644 --- a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java +++ b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java @@ -425,16 +425,14 @@ public class WorkEffortServices { entityExprList.add( EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("partyId", EntityOperator.IN, partyIds), - EntityCondition.makeCondition(publicEvents, EntityJoinOperator.AND) - ), EntityJoinOperator.OR)); + EntityCondition.makeCondition(publicEvents, EntityJoinOperator.AND)), EntityJoinOperator.OR)); } } if ("CAL_MANUFACTURING".equals(calendarType)) { entityExprList.add( EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "PROD_ORDER_HEADER"), - EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "PROD_ORDER_TASK") - ), EntityJoinOperator.OR)); + EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, "PROD_ORDER_TASK")), EntityJoinOperator.OR)); } EntityCondition typesCondition = null; if (typesList.size() == 0) { @@ -591,8 +589,7 @@ public class WorkEffortServices { // should have at least a start date EntityCondition startDateRequired = EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( EntityCondition.makeCondition("estimatedStartDate", EntityOperator.NOT_EQUAL, null), - EntityCondition.makeCondition("actualStartDate", EntityOperator.NOT_EQUAL, null) - ), EntityJoinOperator.OR); + EntityCondition.makeCondition("actualStartDate", EntityOperator.NOT_EQUAL, null)), EntityJoinOperator.OR); List<EntityCondition> periodCheckAndlList = UtilMisc.<EntityCondition>toList( startDateRequired, @@ -601,32 +598,30 @@ public class WorkEffortServices { EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( EntityCondition.makeCondition("actualStartDate", EntityOperator.EQUALS, null), EntityCondition.makeCondition("estimatedStartDate", EntityOperator.NOT_EQUAL, null), - EntityCondition.makeCondition("estimatedStartDate", EntityOperator.LESS_THAN_EQUAL_TO, endStamp) - ), EntityJoinOperator.AND), + EntityCondition.makeCondition("estimatedStartDate", EntityOperator.LESS_THAN_EQUAL_TO, endStamp)), + EntityJoinOperator.AND), EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( EntityCondition.makeCondition("actualStartDate", EntityOperator.NOT_EQUAL, null), - EntityCondition.makeCondition("actualStartDate", EntityOperator.LESS_THAN_EQUAL_TO, endStamp) - ), EntityJoinOperator.AND) - ), EntityJoinOperator.OR), + EntityCondition.makeCondition("actualStartDate", EntityOperator.LESS_THAN_EQUAL_TO, endStamp)), EntityJoinOperator.AND)), + EntityJoinOperator.OR), // if the completion date is not null then it should be larger than the period start EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( // can also be empty EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( EntityCondition.makeCondition("estimatedCompletionDate", EntityOperator.EQUALS, null), - EntityCondition.makeCondition("actualCompletionDate", EntityOperator.EQUALS, null) - ), EntityJoinOperator.AND), + EntityCondition.makeCondition("actualCompletionDate", EntityOperator.EQUALS, null)), + EntityJoinOperator.AND), // check estimated value if the actual is not provided EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( EntityCondition.makeCondition("actualCompletionDate", EntityOperator.EQUALS, null), EntityCondition.makeCondition("estimatedCompletionDate", EntityOperator.NOT_EQUAL, null), - EntityCondition.makeCondition("estimatedCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, startStamp) - ), EntityJoinOperator.AND), + EntityCondition.makeCondition("estimatedCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, startStamp)), + EntityJoinOperator.AND), // at last check the actual value EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( EntityCondition.makeCondition("actualCompletionDate", EntityOperator.NOT_EQUAL, null), - EntityCondition.makeCondition("actualCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, startStamp) - ), EntityJoinOperator.AND) - ), EntityJoinOperator.OR)); + EntityCondition.makeCondition("actualCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, startStamp)), + EntityJoinOperator.AND)), EntityJoinOperator.OR)); entityExprList.addAll(periodCheckAndlList); |
Free forum by Nabble | Edit this page |