You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by su...@apache.org on 2020/08/17 06:57:14 UTC
[ofbiz-framework] branch trunk updated: Improved: Added missing
Javadocs for some methods,
this is required for all classes which looks like designed for extension
(can be subclassed). (OFBIZ-11947) This is done for applications component.
Also corrected some variables as per naming convention best practices.
Thanks Jacques for review.
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 413e0ec Improved: Added missing Javadocs for some methods, this is required for all classes which looks like designed for extension (can be subclassed). (OFBIZ-11947) This is done for applications component. Also corrected some variables as per naming convention best practices. Thanks Jacques for review.
413e0ec is described below
commit 413e0ec3ec851357ea2c97cb54d302961f6ac5fe
Author: Suraj Khurana <su...@apache.org>
AuthorDate: Mon Aug 17 12:25:56 2020 +0530
Improved: Added missing Javadocs for some methods, this is required for all classes which looks like designed for extension (can be subclassed).
(OFBIZ-11947)
This is done for applications component. Also corrected some variables as per naming convention best practices.
Thanks Jacques for review.
---
.../ofbiz/accounting/invoice/InvoiceServices.java | 1 -
.../ofbiz/accounting/invoice/InvoiceWorker.java | 3 -
.../accounting/payment/PaymentGatewayServices.java | 3 -
.../ofbiz/accounting/payment/PaymentWorker.java | 1 -
.../ofbiz/accounting/tax/TaxAuthorityServices.java | 1 -
.../authorizedotnet/AIMPaymentServices.java | 214 +--
.../thirdparty/eway/GatewayConnector.java | 2 -
.../accounting/thirdparty/eway/GatewayRequest.java | 4 -
.../thirdparty/eway/GatewayResponse.java | 2 -
.../accounting/thirdparty/sagepay/SagePayUtil.java | 1 -
.../ofbiz/accounting/util/UtilAccounting.java | 55 +-
.../ofbiz/content/ContentManagementWorker.java | 4 -
.../ofbiz/content/compdoc/CompDocEvents.java | 2 -
.../ofbiz/content/compdoc/CompDocServices.java | 1 -
.../ofbiz/content/content/ContentEvents.java | 1 -
.../content/content/ContentPermissionServices.java | 7 -
.../ofbiz/content/content/ContentSearch.java | 1 -
.../ofbiz/content/content/ContentWorker.java | 1 -
.../ofbiz/content/data/DataResourceWorker.java | 1 -
.../ofbiz/content/ftp/FtpClientInterface.java | 2 -
.../ofbiz/content/survey/PdfSurveyServices.java | 2 -
.../apache/ofbiz/manufacturing/bom/BOMHelper.java | 2 -
.../apache/ofbiz/manufacturing/bom/BOMNode.java | 19 -
.../apache/ofbiz/manufacturing/bom/BOMTree.java | 13 -
.../jobshopmgt/ProductionRunServices.java | 8 -
.../mrp/InventoryEventPlannedServices.java | 2 -
.../ofbiz/manufacturing/mrp/MrpServices.java | 3 -
.../manufacturing/techdata/TechDataServices.java | 13 -
.../ofbiz/order/finaccount/FinAccountHelper.java | 7 -
.../org/apache/ofbiz/order/order/OrderEvents.java | 2 +-
.../apache/ofbiz/order/order/OrderReadHelper.java | 1110 +++++++++++--
.../ofbiz/order/order/OrderReturnServices.java | 288 ++--
.../apache/ofbiz/order/order/OrderServices.java | 7 -
.../order/requirement/RequirementServices.java | 2 -
.../ofbiz/order/shoppingcart/CheckOutEvents.java | 73 +-
.../ofbiz/order/shoppingcart/CheckOutHelper.java | 289 +++-
.../ofbiz/order/shoppingcart/ShoppingCart.java | 269 +++-
.../order/shoppingcart/ShoppingCartEvents.java | 3 -
.../order/shoppingcart/ShoppingCartHelper.java | 3 -
.../ofbiz/order/shoppingcart/ShoppingCartItem.java | 1653 +++++++++++++-------
.../order/shoppingcart/ShoppingCartServices.java | 2 +-
.../shipping/ShippingEstimateWrapper.java | 77 +-
.../shoppingcart/shipping/ShippingEvents.java | 2 -
.../order/shoppinglist/ShoppingListServices.java | 3 -
.../communication/CommunicationEventServices.java | 8 -
.../ofbiz/party/contact/ContactMechServices.java | 1 -
.../ofbiz/party/contact/ContactMechWorker.java | 1 -
.../apache/ofbiz/party/party/PartyServices.java | 1 -
.../org/apache/ofbiz/party/party/PartyWorker.java | 2 -
.../ofbiz/product/category/SeoContextFilter.java | 1 -
.../category/ftl/CatalogUrlSeoTransform.java | 12 -
.../ofbiz/product/category/ftl/SeoTransform.java | 2 -
.../product/category/ftl/UrlRegexpTransform.java | 3 -
.../ofbiz/product/config/ProductConfigWorker.java | 2 +-
.../ofbiz/product/feature/ParametricSearch.java | 1 -
.../org/apache/ofbiz/product/image/ScaleImage.java | 1 -
.../ofbiz/product/inventory/InventoryWorker.java | 1 -
.../ofbiz/product/product/ProductEvents.java | 3 -
.../ofbiz/product/product/ProductSearch.java | 606 +++++--
.../ofbiz/product/product/ProductSearchEvents.java | 6 -
.../product/product/ProductSearchSession.java | 162 +-
.../ofbiz/product/product/ProductUtilServices.java | 73 +-
.../ofbiz/product/product/ProductWorker.java | 5 +-
.../spreadsheetimport/ImportProductServices.java | 2 -
.../ofbiz/product/store/ProductStoreWorker.java | 1 -
.../ofbiz/shipment/packing/PackingSession.java | 576 ++++++-
.../ofbiz/shipment/thirdparty/dhl/DhlServices.java | 1 -
.../shipment/thirdparty/fedex/FedexServices.java | 2 -
.../ofbiz/shipment/thirdparty/ups/UpsServices.java | 1 -
.../ofbiz/securityext/login/LoginEvents.java | 3 -
.../ofbiz/workeffort/workeffort/ICalConverter.java | 1 -
.../workeffort/workeffort/ICalHandlerFactory.java | 4 +-
.../ofbiz/workeffort/workeffort/ICalWorker.java | 3 -
.../workeffort/workeffort/WorkEffortSearch.java | 1 -
74 files changed, 4083 insertions(+), 1562 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 51a1c25..719c9a9 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
@@ -3489,7 +3489,6 @@ public class InvoiceServices {
/**
* Update/add to the paymentApplication table and making sure no duplicate
* record exist
- *
* @param delegator
* @param paymentApplication
* @return map results
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java
index df4ba2d..a102565 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java
@@ -201,7 +201,6 @@ public final class InvoiceWorker {
}
/**
- *
* Return the total amount of the invoice (including tax) using the the invoice GenericValue as input.
* with the ability to specify if the actual currency is required.
* @param invoice GenericValue object of the Invoice
@@ -448,7 +447,6 @@ public final class InvoiceWorker {
}
/**
* Returns amount not applied (i.e., still outstanding) of an invoice at an asOfDate, based on Payment.effectiveDate <= asOfDateTime
- *
* @param invoice GenericValue object of the invoice
* @param asOfDateTime the date to use
* @return Returns amount not applied of the invoice
@@ -470,7 +468,6 @@ public final class InvoiceWorker {
/**
* Returns amount applied to invoice before an asOfDateTime, based on Payment.effectiveDate <= asOfDateTime
- *
* @param delegator the delegator
* @param invoiceId the invoice id
* @param asOfDateTime - a Timestamp
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 0e4a575..8126447 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
@@ -97,7 +97,6 @@ public class PaymentGatewayServices {
* "errors" and "finished" which notify the user if there were any errors and if the authorization was finished.
* There is also a List "messages" for the authorization response messages and a BigDecimal, "processAmount" as the
* amount processed.
- *
* TODO: it might be nice to return the paymentGatewayResponseId
*/
public static Map<String, Object> authOrderPaymentPreference(DispatchContext dctx, Map<String, ? extends Object> context) {
@@ -710,7 +709,6 @@ public class PaymentGatewayServices {
}
/**
- *
* Releases authorizations through service calls to the defined processing service for the ProductStore/PaymentMethodType
* @return COMPLETE|FAILED|ERROR for complete processing of ALL payments.
*/
@@ -879,7 +877,6 @@ public class PaymentGatewayServices {
}
/**
- *
* Releases authorization for a single OrderPaymentPreference through service calls to the defined processing service for the ProductStore/PaymentMethodType
* @return SUCCESS|FAILED|ERROR for complete processing of payment.
*/
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java
index e033712..209a1fd 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java
@@ -217,7 +217,6 @@ public final class PaymentWorker {
/**
* Returns the total from a list of Payment entities
- *
* @param payments List of Payment GenericValue items
* @return total payments as BigDecimal
*/
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java
index b4eeb49..2cdf18d 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java
@@ -661,7 +661,6 @@ public class TaxAuthorityServices {
/**
* Private helper method which determines, based on the state of the product,
* how the ProdCondition should be set for the main condition.
- *
* @param delegator
* @param product
* which may be null
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
index e337e35..3bbb539 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
@@ -67,7 +67,7 @@ public class AIMPaymentServices {
// transaction to be still valid
private static final int TIME_LIMIT_VERIFICATION_DAYS = 120;
- private static Properties AIMProperties = null;
+ private static Properties aimProperties = null;
// A routine to check whether a given refund failure response code will cause the
// ccRefund service to attempt to void the refund's associated authorization transaction
@@ -143,7 +143,7 @@ public class AIMPaymentServices {
processCaptureTransResult(request, reply, results);
// if there is no captureRefNum, then the capture failed
if (results.get("captureRefNum") == null) {
- return ServiceUtil.returnError((String) results.get("captureMessage"));
+ return ServiceUtil.returnError((String) results.get("captureMessage"));
}
return results;
}
@@ -307,7 +307,7 @@ public class AIMPaymentServices {
processAuthCaptureTransResult(request, reply, results);
// if there is no captureRefNum, then the capture failed
if (results.get("captureRefNum") == null) {
- return ServiceUtil.returnError((String) results.get("captureMessage"));
+ return ServiceUtil.returnError((String) results.get("captureMessage"));
}
return results;
}
@@ -338,9 +338,11 @@ public class AIMPaymentServices {
if (ar.isApproved()) {
result.put("authResult", Boolean.TRUE);
}
- //When the transaction is already expired in Authorize.net, then the response is an error message with reason code 16 (i.e. "The transaction cannot be found");
+
+ // When the transaction is already expired in Authorize.net, then the response is an error message with reason code 16
+ // (i.e. "The transaction cannot be found");
// in this case we proceed without generating an error in order to void/cancel the transaction record in OFBiz as well.
- //This else if block takes care of the expired transaction.
+ // This else if block takes care of the expired transaction.
else if ("VOID".equals(props.get("transType")) && "16".equals(ar.getReasonCode())) {
result.put("authResult", Boolean.TRUE);
} else {
@@ -362,7 +364,7 @@ public class AIMPaymentServices {
}
private static boolean isTestMode() {
- return "true".equalsIgnoreCase((String) AIMProperties.get("testReq"));
+ return "true".equalsIgnoreCase((String) aimProperties.get("testReq"));
}
private static Properties buildAIMProperties(Map<String, Object> context, Delegator delegator) {
@@ -372,24 +374,36 @@ public class AIMPaymentServices {
configStr = "payment.properties";
}
GenericValue cc = (GenericValue) context.get("creditCard");
- String url = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "transactionUrl", configStr, "payment.authorizedotnet.url");
- String certificateAlias = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "certificateAlias", configStr, "payment.authorizedotnet.certificateAlias");
- String ver = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "apiVersion", configStr, "payment.authorizedotnet.version");
- String delimited = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "delimitedData", configStr, "payment.authorizedotnet.delimited");
- String delimiter = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "delimiterChar", configStr, "payment.authorizedotnet.delimiter");
- String cpVersion = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "cpVersion", configStr, "payment.authorizedotnet.cpVersion");
- String cpMarketType = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "cpMarketType", configStr, "payment.authorizedotnet.cpMarketType");
- String cpDeviceType = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "cpDeviceType", configStr, "payment.authorizedotnet.cpDeviceType");
+ String url = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "transactionUrl", configStr,
+ "payment.authorizedotnet.url");
+ String certificateAlias = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "certificateAlias", configStr,
+ "payment.authorizedotnet.certificateAlias");
+ String ver = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "apiVersion", configStr,
+ "payment.authorizedotnet.version");
+ String delimited = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "delimitedData", configStr,
+ "payment.authorizedotnet.delimited");
+ String delimiter = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "delimiterChar", configStr,
+ "payment.authorizedotnet.delimiter");
+ String cpVersion = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "cpVersion", configStr,
+ "payment.authorizedotnet.cpVersion");
+ String cpMarketType = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "cpMarketType", configStr,
+ "payment.authorizedotnet.cpMarketType");
+ String cpDeviceType = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "cpDeviceType", configStr,
+ "payment.authorizedotnet.cpDeviceType");
String method = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "method", configStr, "payment.authorizedotnet.method");
- String emailCustomer = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "emailCustomer", configStr, "payment.authorizedotnet.emailcustomer");
- String emailMerchant = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "emailMerchant", configStr, "payment.authorizedotnet.emailmerchant");
+ String emailCustomer = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "emailCustomer", configStr,
+ "payment.authorizedotnet.emailcustomer");
+ String emailMerchant = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "emailMerchant", configStr,
+ "payment.authorizedotnet.emailmerchant");
String testReq = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "testMode", configStr, "payment.authorizedotnet.test");
String relay = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "relayResponse", configStr, "payment.authorizedotnet.relay");
String tranKey = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "tranKey", configStr, "payment.authorizedotnet.trankey");
String login = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "userId", configStr, "payment.authorizedotnet.login");
String password = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "pwd", configStr, "payment.authorizedotnet.password");
- String transDescription = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "transDescription", configStr, "payment.authorizedotnet.transdescription");
- String duplicateWindow = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "duplicateWindow", configStr, "payment.authorizedotnet.duplicateWindow");
+ String transDescription = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "transDescription", configStr,
+ "payment.authorizedotnet.transdescription");
+ String duplicateWindow = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "duplicateWindow", configStr,
+ "payment.authorizedotnet.duplicateWindow");
if (UtilValidate.isEmpty(ver)) {
ver = "3.0";
}
@@ -431,8 +445,8 @@ public class AIMPaymentServices {
if (cc != null) {
props.put("cardtype", cc.get("cardType"));
}
- if (AIMProperties == null) {
- AIMProperties = props;
+ if (aimProperties == null) {
+ aimProperties = props;
}
if (isTestMode()) {
Debug.logInfo("Created Authorize.Net properties file: " + props.toString(), MODULE);
@@ -440,58 +454,58 @@ public class AIMPaymentServices {
return props;
}
- private static void buildMerchantInfo(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
- AIMRequest.put("x_Login", props.getProperty("login"));
+ private static void buildMerchantInfo(Map<String, Object> params, Properties props, Map<String, Object> aimRequest) {
+ aimRequest.put("x_Login", props.getProperty("login"));
String trankey = props.getProperty("trankey");
if (UtilValidate.isNotEmpty(trankey)) {
- AIMRequest.put("x_Tran_Key", props.getProperty("trankey"));
+ aimRequest.put("x_Tran_Key", props.getProperty("trankey"));
} else {
// only send password if no tran key
- AIMRequest.put("x_Password", props.getProperty("password"));
+ aimRequest.put("x_Password", props.getProperty("password"));
}
// api version (non Card Present)
String apiVersion = props.getProperty("ver");
if (UtilValidate.isNotEmpty(apiVersion)) {
- AIMRequest.put("x_Version", props.getProperty("ver"));
+ aimRequest.put("x_Version", props.getProperty("ver"));
}
// CP version
String cpVersion = props.getProperty("cpver");
if (UtilValidate.isNotEmpty(cpVersion)) {
- AIMRequest.put("x_cpversion", cpVersion);
+ aimRequest.put("x_cpversion", cpVersion);
}
// Check duplicateWindow time frame. If same transaction happens in the predefined time frame then return error.
String duplicateWindow = props.getProperty("duplicateWindow");
if (UtilValidate.isNotEmpty(duplicateWindow)) {
- AIMRequest.put("x_duplicate_window", props.getProperty("duplicateWindow"));
+ aimRequest.put("x_duplicate_window", props.getProperty("duplicateWindow"));
}
// CP market type
String cpMarketType = props.getProperty("cpMarketType");
if (UtilValidate.isNotEmpty(cpMarketType)) {
- AIMRequest.put("x_market_type", cpMarketType);
+ aimRequest.put("x_market_type", cpMarketType);
// CP test mode
if ("true".equalsIgnoreCase(props.getProperty("testReq"))) {
- AIMRequest.put("x_test_request", props.getProperty("testReq"));
+ aimRequest.put("x_test_request", props.getProperty("testReq"));
}
}
// CP device typ
String cpDeviceType = props.getProperty("cpDeviceType");
if (UtilValidate.isNotEmpty(cpDeviceType)) {
- AIMRequest.put("x_device_type", cpDeviceType);
+ aimRequest.put("x_device_type", cpDeviceType);
}
}
- private static void buildGatewayResponeConfig(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
- if (AIMRequest.get("x_market_type") != null) {
+ private static void buildGatewayResponeConfig(Map<String, Object> params, Properties props, Map<String, Object> aimRequest) {
+ if (aimRequest.get("x_market_type") != null) {
// card present transaction
- AIMRequest.put("x_response_format", "true".equalsIgnoreCase(props.getProperty("delimited")) ? "1" : "0");
+ aimRequest.put("x_response_format", "true".equalsIgnoreCase(props.getProperty("delimited")) ? "1" : "0");
} else {
- AIMRequest.put("x_Delim_Data", props.getProperty("delimited"));
+ aimRequest.put("x_Delim_Data", props.getProperty("delimited"));
}
- AIMRequest.put("x_Delim_Char", props.getProperty("delimiter"));
+ aimRequest.put("x_Delim_Char", props.getProperty("delimiter"));
}
- private static void buildCustomerBillingInfo(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+ private static void buildCustomerBillingInfo(Map<String, Object> params, Properties props, Map<String, Object> aimRequest) {
try {
// this would be used in the case of a capture, where one of the parameters is an OrderPaymentPreference
if (params.get("orderPaymentPreference") != null) {
@@ -502,17 +516,17 @@ public class AIMPaymentServices {
if (creditCard == null || !(opp.get("paymentMethodId").equals(creditCard.get("paymentMethodId")))) {
creditCard = opp.getRelatedOne("CreditCard", false);
}
- AIMRequest.put("x_First_Name", UtilFormatOut.checkNull(creditCard.getString("firstNameOnCard")));
- AIMRequest.put("x_Last_Name", UtilFormatOut.checkNull(creditCard.getString("lastNameOnCard")));
- AIMRequest.put("x_Company", UtilFormatOut.checkNull(creditCard.getString("companyNameOnCard")));
+ aimRequest.put("x_First_Name", UtilFormatOut.checkNull(creditCard.getString("firstNameOnCard")));
+ aimRequest.put("x_Last_Name", UtilFormatOut.checkNull(creditCard.getString("lastNameOnCard")));
+ aimRequest.put("x_Company", UtilFormatOut.checkNull(creditCard.getString("companyNameOnCard")));
if (UtilValidate.isNotEmpty(creditCard.getString("contactMechId"))) {
GenericValue address = creditCard.getRelatedOne("PostalAddress", false);
if (address != null) {
- AIMRequest.put("x_Address", UtilFormatOut.checkNull(address.getString("address1")));
- AIMRequest.put("x_City", UtilFormatOut.checkNull(address.getString("city")));
- AIMRequest.put("x_State", UtilFormatOut.checkNull(address.getString("stateProvinceGeoId")));
- AIMRequest.put("x_Zip", UtilFormatOut.checkNull(address.getString("postalCode")));
- AIMRequest.put("x_Country", UtilFormatOut.checkNull(address.getString("countryGeoId")));
+ aimRequest.put("x_Address", UtilFormatOut.checkNull(address.getString("address1")));
+ aimRequest.put("x_City", UtilFormatOut.checkNull(address.getString("city")));
+ aimRequest.put("x_State", UtilFormatOut.checkNull(address.getString("stateProvinceGeoId")));
+ aimRequest.put("x_Zip", UtilFormatOut.checkNull(address.getString("postalCode")));
+ aimRequest.put("x_Country", UtilFormatOut.checkNull(address.getString("countryGeoId")));
}
}
} else {
@@ -522,13 +536,13 @@ public class AIMPaymentServices {
// this would be the case for an authorization
GenericValue cp = (GenericValue) params.get("billToParty");
GenericValue ba = (GenericValue) params.get("billingAddress");
- AIMRequest.put("x_First_Name", UtilFormatOut.checkNull(cp.getString("firstName")));
- AIMRequest.put("x_Last_Name", UtilFormatOut.checkNull(cp.getString("lastName")));
- AIMRequest.put("x_Address", UtilFormatOut.checkNull(ba.getString("address1")));
- AIMRequest.put("x_City", UtilFormatOut.checkNull(ba.getString("city")));
- AIMRequest.put("x_State", UtilFormatOut.checkNull(ba.getString("stateProvinceGeoId")));
- AIMRequest.put("x_Zip", UtilFormatOut.checkNull(ba.getString("postalCode")));
- AIMRequest.put("x_Country", UtilFormatOut.checkNull(ba.getString("countryGeoId")));
+ aimRequest.put("x_First_Name", UtilFormatOut.checkNull(cp.getString("firstName")));
+ aimRequest.put("x_Last_Name", UtilFormatOut.checkNull(cp.getString("lastName")));
+ aimRequest.put("x_Address", UtilFormatOut.checkNull(ba.getString("address1")));
+ aimRequest.put("x_City", UtilFormatOut.checkNull(ba.getString("city")));
+ aimRequest.put("x_State", UtilFormatOut.checkNull(ba.getString("stateProvinceGeoId")));
+ aimRequest.put("x_Zip", UtilFormatOut.checkNull(ba.getString("postalCode")));
+ aimRequest.put("x_Country", UtilFormatOut.checkNull(ba.getString("countryGeoId")));
}
return;
} catch (GenericEntityException ex) {
@@ -537,16 +551,16 @@ public class AIMPaymentServices {
}
}
- private static void buildEmailSettings(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+ private static void buildEmailSettings(Map<String, Object> params, Properties props, Map<String, Object> aimRequest) {
GenericValue ea = (GenericValue) params.get("billToEmail");
- AIMRequest.put("x_Email_Customer", props.getProperty("emailCustomer"));
- AIMRequest.put("x_Email_Merchant", props.getProperty("emailMerchant"));
+ aimRequest.put("x_Email_Customer", props.getProperty("emailCustomer"));
+ aimRequest.put("x_Email_Merchant", props.getProperty("emailMerchant"));
if (ea != null) {
- AIMRequest.put("x_Email", UtilFormatOut.checkNull(ea.getString("infoString")));
+ aimRequest.put("x_Email", UtilFormatOut.checkNull(ea.getString("infoString")));
}
}
- private static void buildInvoiceInfo(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+ private static void buildInvoiceInfo(Map<String, Object> params, Properties props, Map<String, Object> aimRequest) {
String description = UtilFormatOut.checkNull(props.getProperty("transDescription"));
String orderId = UtilFormatOut.checkNull((String) params.get("orderId"));
if (UtilValidate.isEmpty(orderId)) {
@@ -555,87 +569,87 @@ public class AIMPaymentServices {
orderId = (String) orderPaymentPreference.get("orderId");
}
}
- AIMRequest.put("x_Invoice_Num", "Order " + orderId);
- AIMRequest.put("x_Description", description);
+ aimRequest.put("x_Invoice_Num", "Order " + orderId);
+ aimRequest.put("x_Description", description);
}
- private static void buildAuthTransaction(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+ private static void buildAuthTransaction(Map<String, Object> params, Properties props, Map<String, Object> aimRequest) {
GenericValue cc = (GenericValue) params.get("creditCard");
String currency = (String) params.get("currency");
String amount = ((BigDecimal) params.get("processAmount")).toString();
String number = UtilFormatOut.checkNull(cc.getString("cardNumber"));
String expDate = UtilFormatOut.checkNull(cc.getString("expireDate"));
String cardSecurityCode = (String) params.get("cardSecurityCode");
- AIMRequest.put("x_Amount", amount);
- AIMRequest.put("x_Currency_Code", currency);
- AIMRequest.put("x_Method", props.getProperty("method"));
- AIMRequest.put("x_Type", props.getProperty("transType"));
- AIMRequest.put("x_Card_Num", number);
- AIMRequest.put("x_Exp_Date", expDate);
+ aimRequest.put("x_Amount", amount);
+ aimRequest.put("x_Currency_Code", currency);
+ aimRequest.put("x_Method", props.getProperty("method"));
+ aimRequest.put("x_Type", props.getProperty("transType"));
+ aimRequest.put("x_Card_Num", number);
+ aimRequest.put("x_Exp_Date", expDate);
if (UtilValidate.isNotEmpty(cardSecurityCode)) {
- AIMRequest.put("x_card_code", cardSecurityCode);
+ aimRequest.put("x_card_code", cardSecurityCode);
}
- if (AIMRequest.get("x_market_type") != null) {
- AIMRequest.put("x_card_type", getCardType(UtilFormatOut.checkNull(cc.getString("cardType"))));
+ if (aimRequest.get("x_market_type") != null) {
+ aimRequest.put("x_card_type", getCardType(UtilFormatOut.checkNull(cc.getString("cardType"))));
}
}
- private static void buildCaptureTransaction(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+ private static void buildCaptureTransaction(Map<String, Object> params, Properties props, Map<String, Object> aimRequest) {
GenericValue at = (GenericValue) params.get("authTransaction");
GenericValue cc = (GenericValue) params.get("creditCard");
String currency = (String) params.get("currency");
String amount = ((BigDecimal) params.get("captureAmount")).toString();
String number = UtilFormatOut.checkNull(cc.getString("cardNumber"));
String expDate = UtilFormatOut.checkNull(cc.getString("expireDate"));
- AIMRequest.put("x_Amount", amount);
- AIMRequest.put("x_Currency_Code", currency);
- AIMRequest.put("x_Method", props.getProperty("method"));
- AIMRequest.put("x_Type", props.getProperty("transType"));
- AIMRequest.put("x_Card_Num", number);
- AIMRequest.put("x_Exp_Date", expDate);
- AIMRequest.put("x_Trans_ID", at.get("referenceNum"));
- AIMRequest.put("x_ref_trans_id", at.get("referenceNum"));
- AIMRequest.put("x_Auth_Code", at.get("gatewayCode"));
- if (AIMRequest.get("x_market_type") != null) {
- AIMRequest.put("x_card_type", getCardType(UtilFormatOut.checkNull(cc.getString("cardType"))));
+ aimRequest.put("x_Amount", amount);
+ aimRequest.put("x_Currency_Code", currency);
+ aimRequest.put("x_Method", props.getProperty("method"));
+ aimRequest.put("x_Type", props.getProperty("transType"));
+ aimRequest.put("x_Card_Num", number);
+ aimRequest.put("x_Exp_Date", expDate);
+ aimRequest.put("x_Trans_ID", at.get("referenceNum"));
+ aimRequest.put("x_ref_trans_id", at.get("referenceNum"));
+ aimRequest.put("x_Auth_Code", at.get("gatewayCode"));
+ if (aimRequest.get("x_market_type") != null) {
+ aimRequest.put("x_card_type", getCardType(UtilFormatOut.checkNull(cc.getString("cardType"))));
}
}
- private static void buildRefundTransaction(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+ private static void buildRefundTransaction(Map<String, Object> params, Properties props, Map<String, Object> aimRequest) {
GenericValue at = (GenericValue) params.get("authTransaction");
GenericValue cc = (GenericValue) params.get("creditCard");
String currency = (String) params.get("currency");
String amount = ((BigDecimal) params.get("refundAmount")).toString();
String number = UtilFormatOut.checkNull(cc.getString("cardNumber"));
String expDate = UtilFormatOut.checkNull(cc.getString("expireDate"));
- AIMRequest.put("x_Amount", amount);
- AIMRequest.put("x_Currency_Code", currency);
- AIMRequest.put("x_Method", props.getProperty("method"));
- AIMRequest.put("x_Type", props.getProperty("transType"));
- AIMRequest.put("x_Card_Num", number);
- AIMRequest.put("x_Exp_Date", expDate);
- AIMRequest.put("x_Trans_ID", at.get("referenceNum"));
- AIMRequest.put("x_Auth_Code", at.get("gatewayCode"));
- AIMRequest.put("x_ref_trans_id", at.get("referenceNum"));
- if (AIMRequest.get("x_market_type") != null) {
- AIMRequest.put("x_card_type", getCardType(UtilFormatOut.checkNull(cc.getString("cardType"))));
+ aimRequest.put("x_Amount", amount);
+ aimRequest.put("x_Currency_Code", currency);
+ aimRequest.put("x_Method", props.getProperty("method"));
+ aimRequest.put("x_Type", props.getProperty("transType"));
+ aimRequest.put("x_Card_Num", number);
+ aimRequest.put("x_Exp_Date", expDate);
+ aimRequest.put("x_Trans_ID", at.get("referenceNum"));
+ aimRequest.put("x_Auth_Code", at.get("gatewayCode"));
+ aimRequest.put("x_ref_trans_id", at.get("referenceNum"));
+ if (aimRequest.get("x_market_type") != null) {
+ aimRequest.put("x_card_type", getCardType(UtilFormatOut.checkNull(cc.getString("cardType"))));
}
Debug.logInfo("buildCaptureTransaction. " + at.toString(), MODULE);
}
- private static void buildVoidTransaction(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+ private static void buildVoidTransaction(Map<String, Object> params, Properties props, Map<String, Object> aimRequest) {
GenericValue at = (GenericValue) params.get("authTransaction");
String currency = (String) params.get("currency");
- AIMRequest.put("x_Currency_Code", currency);
- AIMRequest.put("x_Method", props.getProperty("method"));
- AIMRequest.put("x_Type", props.getProperty("transType"));
- AIMRequest.put("x_ref_trans_id", at.get("referenceNum"));
- AIMRequest.put("x_Trans_ID", at.get("referenceNum"));
- AIMRequest.put("x_Auth_Code", at.get("gatewayCode"));
+ aimRequest.put("x_Currency_Code", currency);
+ aimRequest.put("x_Method", props.getProperty("method"));
+ aimRequest.put("x_Type", props.getProperty("transType"));
+ aimRequest.put("x_ref_trans_id", at.get("referenceNum"));
+ aimRequest.put("x_Trans_ID", at.get("referenceNum"));
+ aimRequest.put("x_Auth_Code", at.get("gatewayCode"));
Debug.logInfo("buildVoidTransaction. " + at.toString(), MODULE);
}
- private static Map<String, Object> validateRequest(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+ private static Map<String, Object> validateRequest(Map<String, Object> params, Properties props, Map<String, Object> aimRequest) {
Map<String, Object> result = new HashMap<>();
result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
return result;
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayConnector.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayConnector.java
index df7e61a..e022c44 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayConnector.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayConnector.java
@@ -48,7 +48,6 @@ public class GatewayConnector {
/**
* Get the timeout value set in the corresponding setter.
- *
* @return timeout value in seconds, 0 for infinite
*/
public int getTimeout() {
@@ -59,7 +58,6 @@ public class GatewayConnector {
* Set the timout value. Note that setting the timeout for an HttpURLConnection
* is possible only since Java 1.5. This method has no effect on earlier
* versions.
- *
* @param time timeout value in seconds, 0 for infinite
*/
public void setTimeout(int time) {
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayRequest.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayRequest.java
index d1b1df9..5682ed6 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayRequest.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayRequest.java
@@ -105,7 +105,6 @@ public class GatewayRequest {
/**
* Constructor to be used with the CVN and Beagle payment methods.
- *
* @param method
* Logical combination of the REQUEST_METHOD_CVN and
* REQUEST_METHOD_BEAGLE constants.
@@ -116,7 +115,6 @@ public class GatewayRequest {
/**
* Gets the request method given when constructing the object.
- *
* @return the request method as a logical combination of the REQUEST_METHOD_CVN
* and REQUEST_METHOD_BEAGLE constants.
*/
@@ -337,7 +335,6 @@ public class GatewayRequest {
* examine the xml content. The special fields of the CVN and Beagle requests
* are added only if the request belongs to the CVN or Beagle types,
* respectively.
- *
* @return The GatewayRequest object as an xml string.
*/
public String toXml() {
@@ -400,7 +397,6 @@ public class GatewayRequest {
/**
* Helper method to build an XML node.
- *
* @param nodeName
* The name of the node being created.
* @param nodeValue
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 14f8284..7c5078d 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
@@ -106,7 +106,6 @@ public class GatewayResponse {
/**
* Gets the beagle score. Defaults to -1 in case of non-Beagle payment methods
* or if the response does not contain this field.
- *
* @return The beagle score or -1 if it was not defined in the response
*/
public double getBeagleScore() {
@@ -117,7 +116,6 @@ public class GatewayResponse {
* Creates the GatewayResponse object by parsing an xml from a stream. Fills in
* the fields of the object that are available through getters after this method
* returns.
- *
* @param xmlstream
* the stream to parse the response from
* @throws Exception
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java
index c351f70..1216738 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java
@@ -181,7 +181,6 @@ public final class SagePayUtil {
/**
* Builds HttpHost with the given SagePayProperties.
- *
* @param props SagePay properties
* @return
* @throws IllegalArgumentException if neither productionHost nor testingHost found in properties.
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java
index 46db0a6..89ab9d8 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java
@@ -46,16 +46,15 @@ public final class UtilAccounting {
* getProductOrgGlAccount. First it will look in ProductGlAccount using the primary keys productId and
* productGlAccountTypeId. If none is found, it will look up GlAccountTypeDefault to find the default account for
* organizationPartyId with type glAccountTypeId.
- *
- * @param productId When searching for ProductGlAccounts, specify the productId
- * @param glAccountTypeId The default glAccountTypeId to look for if no ProductGlAccount is found
- * @param organizationPartyId The organization party of the default account
- * @return The account ID (glAccountId) found
- * @throws AccountingException When the no accounts found or an entity exception occurs
+ * @param productId When searching for ProductGlAccounts, specify the productId
+ * @param glAccountTypeId The default glAccountTypeId to look for if no ProductGlAccount is found
+ * @param organizationPartyId The organization party of the default account
+ * @return The account ID (glAccountId) found
+ * @throws AccountingException When the no accounts found or an entity exception occurs
*/
public static String getProductOrgGlAccountId(String productId,
- String glAccountTypeId, String organizationPartyId, Delegator delegator)
- throws AccountingException {
+ String glAccountTypeId, String organizationPartyId, Delegator delegator)
+ throws AccountingException {
GenericValue account = null;
try {
@@ -64,21 +63,28 @@ public final class UtilAccounting {
.where("productId", productId, "glAccountTypeId", glAccountTypeId, "organizationPartyId", organizationPartyId)
.cache().queryOne();
} catch (GenericEntityException e) {
- throw new AccountingException("Failed to find a ProductGLAccount for productId [" + productId + "], organization [" + organizationPartyId + "], and productGlAccountTypeId [" + glAccountTypeId + "].", e);
+ throw new AccountingException("Failed to find a ProductGLAccount for productId [" + productId + "], organization [" + organizationPartyId
+ + "], and productGlAccountTypeId [" + glAccountTypeId + "].", e);
}
// otherwise try the default accounts
if (account == null) {
try {
- account = EntityQuery.use(delegator).from("GlAccountTypeDefault").where("glAccountTypeId", glAccountTypeId, "organizationPartyId", organizationPartyId).cache().queryOne();
+ account = EntityQuery.use(delegator).from("GlAccountTypeDefault").where("glAccountTypeId", glAccountTypeId, "organizationPartyId",
+ organizationPartyId).cache().queryOne();
} catch (GenericEntityException e) {
- throw new AccountingException("Failed to find a GlAccountTypeDefault for glAccountTypeId [" + glAccountTypeId + "] and organizationPartyId [" + organizationPartyId+ "].", e);
+ throw new AccountingException("Failed to find a GlAccountTypeDefault for glAccountTypeId [" + glAccountTypeId
+ + "] and organizationPartyId [" + organizationPartyId + "].", e);
}
}
// if no results yet, serious problem
if (account == null) {
- throw new AccountingException("Failed to find any accounts for productId [" + productId + "], organization [" + organizationPartyId + "], and productGlAccountTypeId [" + glAccountTypeId + "] or any accounts in GlAccountTypeDefault for glAccountTypeId [" + glAccountTypeId + "] and organizationPartyId [" + organizationPartyId+ "]. Please check your data to make sure that at least a GlAccountTypeDefault is defined for this account type and organization.");
+ throw new AccountingException("Failed to find any accounts for productId [" + productId + "], organization [" + organizationPartyId
+ + "], and productGlAccountTypeId [" + glAccountTypeId + "] or any accounts in GlAccountTypeDefault for glAccountTypeId ["
+ + glAccountTypeId + "] and organizationPartyId [" + organizationPartyId
+ + "]. Please check your data to make sure that at least a GlAccountTypeDefault is defined for this account type and"
+ + "organization.");
}
// otherwise return the glAccountId
@@ -87,11 +93,10 @@ public final class UtilAccounting {
/**
* As above, but explicitly looking for default account for given type and organization
- *
- * @param glAccountTypeId The type of account
- * @param organizationPartyId The organization of the account
- * @return The default account ID (glAccountId) for this type
- * @throws AccountingException When the default is not configured
+ * @param glAccountTypeId The type of account
+ * @param organizationPartyId The organization of the account
+ * @return The default account ID (glAccountId) for this type
+ * @throws AccountingException When the default is not configured
*/
public static String getDefaultAccountId(String glAccountTypeId, String organizationPartyId, Delegator delegator) throws AccountingException {
return getProductOrgGlAccountId(null, glAccountTypeId, organizationPartyId, delegator);
@@ -102,6 +107,7 @@ public final class UtilAccounting {
getGlAccountClassChildren(glAccountClass, glAccountClassIds);
return glAccountClassIds;
}
+
private static void getGlAccountClassChildren(GenericValue glAccountClass, List<String> glAccountClassIds) throws GenericEntityException {
glAccountClassIds.add(glAccountClass.getString("glAccountClassId"));
List<GenericValue> glAccountClassChildren = glAccountClass.getRelated("ChildGlAccountClass", null, null, true);
@@ -284,14 +290,17 @@ public final class UtilAccounting {
EntityCondition.makeCondition("acctgTransTypeId", "PURCHASE_INVOICE"),
EntityCondition.makeCondition("invoiceId", paymentApplication.getString("invoiceId")));
EntityCondition whereCondition = EntityCondition.makeCondition(andConditions, EntityJoinOperator.AND);
- GenericValue amounts = EntityQuery.use(delegator).select("origAmount", "amount").from("AcctgTransAndEntries").where(whereCondition).queryFirst();
+ GenericValue amounts = EntityQuery.use(delegator).select("origAmount", "amount").from("AcctgTransAndEntries")
+ .where(whereCondition).queryFirst();
if (amounts == null) {
return exchangeRate;
}
BigDecimal origAmount = amounts.getBigDecimal("origAmount");
BigDecimal amount = amounts.getBigDecimal("amount");
- if (origAmount != null && amount != null && BigDecimal.ZERO.compareTo(origAmount) != 0 && BigDecimal.ZERO.compareTo(amount) != 0 && amount.compareTo(origAmount) != 0) {
- exchangeRate = amount.divide(origAmount, UtilNumber.getBigDecimalScale("ledger.decimals"), UtilNumber.getRoundingMode("invoice.rounding"));
+ if (origAmount != null && amount != null && BigDecimal.ZERO.compareTo(origAmount) != 0 && BigDecimal.ZERO.compareTo(amount)
+ != 0 && amount.compareTo(origAmount) != 0) {
+ exchangeRate = amount.divide(origAmount, UtilNumber.getBigDecimalScale("ledger.decimals"),
+ UtilNumber.getRoundingMode("invoice.rounding"));
}
return exchangeRate;
}
@@ -311,8 +320,10 @@ public final class UtilAccounting {
}
BigDecimal origAmount = amounts.getBigDecimal("origAmount");
BigDecimal amount = amounts.getBigDecimal("amount");
- if (origAmount != null && amount != null && BigDecimal.ZERO.compareTo(origAmount) != 0 && BigDecimal.ZERO.compareTo(amount) != 0 && amount.compareTo(origAmount) != 0) {
- exchangeRate = amount.divide(origAmount, UtilNumber.getBigDecimalScale("ledger.decimals"), UtilNumber.getRoundingMode("invoice.rounding"));
+ if (origAmount != null && amount != null && BigDecimal.ZERO.compareTo(origAmount) != 0 && BigDecimal.ZERO.compareTo(amount) != 0
+ && amount.compareTo(origAmount) != 0) {
+ exchangeRate = amount.divide(origAmount, UtilNumber.getBigDecimalScale("ledger.decimals"),
+ UtilNumber.getRoundingMode("invoice.rounding"));
}
return exchangeRate;
}
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 3fd62b7..f4f918d 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
@@ -92,7 +92,6 @@ public final class ContentManagementWorker {
/**
* Makes an entry in the "most recently used" cache. It picks the cache
* by the entity name and builds a signature from the primary key values.
- *
* @param entityName
* @param lookupCaches
* @param pk either a GenericValue or GenericPK - populated
@@ -125,7 +124,6 @@ public final class ContentManagementWorker {
/**
* Builds a string signature from a GenericValue or GenericPK.
- *
* @param pk either a populated GenericValue or GenericPK.
* @param suffix a string that can be used to distinguish the signature (probably not used).
*/
@@ -316,7 +314,6 @@ public final class ContentManagementWorker {
/**
* Returns a list of WebSitePublishPoint entities that are children of parentPubPt
* The name should be "getAllTopLevelPublishPoints" or "getAllChildPublishPoints"
- *
* @param parentPubPt The parent publish point.
*/
public static List<GenericValue> getAllPublishPoints(Delegator delegator, String parentPubPt) throws GeneralException {
@@ -596,7 +593,6 @@ public final class ContentManagementWorker {
/**
* Returns a list of "department" (having ContentAssoc of type "DEPARTMENT")
* Content entities that are children of parentPubPt
- *
* @param parentPubPt The parent publish point.
*/
public static List<GenericValue> getAllDepartmentContent(Delegator delegator, String parentPubPt) throws GeneralException {
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java
index 43a1c24..14c97c6 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java
@@ -55,11 +55,9 @@ public class CompDocEvents {
private static final String ERR_RESOURCE = "WebappUiLabels";
/**
- *
* @param request
* @param response
* @return
- *
* Creates the topmost Content entity of a Composite Document tree.
* Also creates an "empty" Composite Document Instance Content entity.
* Creates ContentRevision/Item records for each, as well.
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java
index 0f66ad9..0d13d4e 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java
@@ -66,7 +66,6 @@ public class CompDocServices {
* Creates the topmost Content entity of a Composite Document tree.
* Also creates an "empty" Composite Document Instance Content entity.
* Creates ContentRevision/Item records for each, as well.
- *
* @param dctx the dispatch context
* @param context the context
* @return Creates the topmost Content entity of a Composite Document tree
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentEvents.java
index 3444800..db44e06 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentEvents.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentEvents.java
@@ -47,7 +47,6 @@ public class ContentEvents {
/**
* Updates/adds keywords for all contents
- *
* @param request HTTPRequest object for the current request
* @param response HTTPResponse object for the current request
* @return String specifying the exit status of this event
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java
index b6a682e..10a0bbb 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java
@@ -57,14 +57,11 @@ public class ContentPermissionServices {
/**
* checkContentPermission
- *
*@param dctx The DispatchContext that this service is operating in
*@param context Map containing the input parameters
*@return Map with the result of the service, the output parameters
- *
* This service goes thru a series of test to determine if the user has
* authority to performed anyone of the passed in target operations.
- *
* It expects a Content entity in "currentContent"
* It expects a list of contentOperationIds in "targetOperationList" rather
* than a scalar because it is thought that sometimes more than one operation
@@ -74,20 +71,16 @@ public class ContentPermissionServices {
* entity could have multiple purposes associated with it.
* The userLogin GenericValue is also required.
* A list of roleTypeIds is also possible.
- *
* The basic sequence of testing events is:
* First the ContentPurposeOperation table is checked to see if there are any
* entries with matching purposes (and operations) with no roleTypeId (ie. _NA_).
* This is done because it would be the most common scenario and is quick to check.
- *
* Secondly, the CONTENTMGR permission is checked.
- *
* Thirdly, the ContentPurposeOperation table is rechecked to see if there are
* any conditions with roleTypeIds that match associated ContentRoles tied to the
* user.
* If a Party of "PARTY_GROUP" type is found, the PartyRelationship table is checked
* to see if the current user is linked to that group.
- *
* If no match is found to this point and the current Content entity has a value for
* ownerContentId, then the last step is recusively applied, using the ContentRoles
* associated with the ownerContent entity.
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 37efd90..43fc746 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
@@ -881,7 +881,6 @@ public class ContentSearch {
* [contentName]
* [totalQuantityOrdered] for most popular or most purchased
* [lastModifiedDate]
- *
* You can also include any other field on the Content entity.
*/
public SortContentField(String fieldName, boolean ascending) {
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 b92ea7a..965b166 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
@@ -1509,7 +1509,6 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor
/*
* Tries to find the mime type of the associated content and parent content.
- *
* @param delegator
* @param view SubContentDataResourceView
* @param parentContent Content entity
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
index 904746d..aa1661b 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
@@ -1023,7 +1023,6 @@ public class DataResourceWorker implements org.apache.ofbiz.widget.content.Data
/**
* getDataResourceStream - gets an InputStream and Content-Length of a DataResource
- *
* @param dataResource
* @param https
* @param webSiteId
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpClientInterface.java b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpClientInterface.java
index 2ae2016..90ae808 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpClientInterface.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpClientInterface.java
@@ -28,7 +28,6 @@ public interface FtpClientInterface {
/**
* Initialization of a file transfer client, and connection to the given server
- *
* @param hostname hostname to connect to
* @param username username to login with
* @param password password to login with
@@ -40,7 +39,6 @@ public interface FtpClientInterface {
/**
* Copy of the give file to the connected server into the path.
- *
* @param path path to copy the file to
* @param fileName name of the copied file
* @param file data to copy
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java
index 74b8c0e..d43a2e0 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java
@@ -73,7 +73,6 @@ public class PdfSurveyServices {
private static final String RESOURCE = "ContentUiLabels";
/**
- *
*/
public static Map<String, Object> buildSurveyFromPdf(DispatchContext dctx, Map<String, ? extends Object> context) {
Delegator delegator = dctx.getDelegator();
@@ -218,7 +217,6 @@ public class PdfSurveyServices {
}
/**
- *
*/
public static Map<String, Object> buildSurveyResponseFromPdf(DispatchContext dctx, Map<String, ? extends Object> context) {
String surveyResponseId = null;
diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java
index 3ff500b..ed9fd35 100644
--- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java
+++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java
@@ -52,7 +52,6 @@ public final class BOMHelper {
* Returns the product's low level code (llc) i.e. the maximum depth
* in which the productId can be found in any of the
* bills of materials of bomType type.
- *
* @param productId The product id
* @param bomType The bill of materials type (e.g. manufacturing, engineering,...)
* @param delegator Validity date (if null, today is used).
@@ -93,7 +92,6 @@ public final class BOMHelper {
* ancestor if present, null otherwise.
* Useful to avoid loops when adding new assocs (components)
* to a bill of materials.
- *
* @param productId The product to which we want to add a new child.
* @param productIdKey The new component we want to add to the existing bom.
* @param bomType The bill of materials type (e.g. manufacturing, engineering).
diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java
index ebfc874..cd2ebdd 100644
--- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java
+++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java
@@ -360,7 +360,6 @@ public class BOMNode {
/** Getter for property parentNode.
* @return Value of property parentNode.
- *
*/
public BOMNode getParentNode() {
return parentNode;
@@ -371,7 +370,6 @@ public class BOMNode {
}
/** Setter for property parentNode.
* @param parentNode New value of property parentNode.
- *
*/
public void setParentNode(BOMNode parentNode) {
this.parentNode = parentNode;
@@ -695,7 +693,6 @@ public class BOMNode {
/** Getter for property quantity.
* @return Value of property quantity.
- *
*/
public BigDecimal getQuantity() {
return quantity;
@@ -707,7 +704,6 @@ public class BOMNode {
/** Getter for property depth.
* @return Value of property depth.
- *
*/
public int getDepth() {
@@ -720,7 +716,6 @@ public class BOMNode {
/** Getter for property substitutedNode.
* @return Value of property substitutedNode.
- *
*/
public BOMNode getSubstitutedNode() {
return substitutedNode;
@@ -728,7 +723,6 @@ public class BOMNode {
/** Setter for property substitutedNode.
* @param substitutedNode New value of property substitutedNode.
- *
*/
public void setSubstitutedNode(BOMNode substitutedNode) {
this.substitutedNode = substitutedNode;
@@ -740,7 +734,6 @@ public class BOMNode {
/** Getter for property productForRules.
* @return Value of property productForRules.
- *
*/
public String getProductForRules() {
return productForRules;
@@ -748,7 +741,6 @@ public class BOMNode {
/** Setter for property productForRules.
* @param productForRules New value of property productForRules.
- *
*/
public void setProductForRules(String productForRules) {
this.productForRules = productForRules;
@@ -756,7 +748,6 @@ public class BOMNode {
/** Getter for property bomTypeId.
* @return Value of property bomTypeId.
- *
*/
public java.lang.String getBomTypeId() {
return bomTypeId;
@@ -764,7 +755,6 @@ public class BOMNode {
/** Getter for property quantityMultiplier.
* @return Value of property quantityMultiplier.
- *
*/
public BigDecimal getQuantityMultiplier() {
return quantityMultiplier;
@@ -772,7 +762,6 @@ public class BOMNode {
/** Setter for property quantityMultiplier.
* @param quantityMultiplier New value of property quantityMultiplier.
- *
*/
public void setQuantityMultiplier(BigDecimal quantityMultiplier) {
if (quantityMultiplier != null) {
@@ -782,7 +771,6 @@ public class BOMNode {
/** Getter for property ruleApplied.
* @return Value of property ruleApplied.
- *
*/
public org.apache.ofbiz.entity.GenericValue getRuleApplied() {
return ruleApplied;
@@ -790,7 +778,6 @@ public class BOMNode {
/** Setter for property ruleApplied.
* @param ruleApplied New value of property ruleApplied.
- *
*/
public void setRuleApplied(org.apache.ofbiz.entity.GenericValue ruleApplied) {
this.ruleApplied = ruleApplied;
@@ -798,7 +785,6 @@ public class BOMNode {
/** Getter for property scrapFactor.
* @return Value of property scrapFactor.
- *
*/
public BigDecimal getScrapFactor() {
return scrapFactor;
@@ -806,7 +792,6 @@ public class BOMNode {
/** Setter for property scrapFactor.
* @param scrapFactor New value of property scrapFactor.
- *
*/
public void setScrapFactor(BigDecimal scrapFactor) {
if (scrapFactor != null) {
@@ -816,7 +801,6 @@ public class BOMNode {
/** Getter for property childrenNodes.
* @return Value of property childrenNodes.
- *
*/
public List<BOMNode> getChildrenNodes() {
return childrenNodes;
@@ -824,7 +808,6 @@ public class BOMNode {
/** Setter for property childrenNodes.
* @param childrenNodes New value of property childrenNodes.
- *
*/
public void setChildrenNodes(List<BOMNode> childrenNodes) {
this.childrenNodes = childrenNodes;
@@ -832,7 +815,6 @@ public class BOMNode {
/** Getter for property productAssoc.
* @return Value of property productAssoc.
- *
*/
public org.apache.ofbiz.entity.GenericValue getProductAssoc() {
return productAssoc;
@@ -840,7 +822,6 @@ public class BOMNode {
/** Setter for property productAssoc.
* @param productAssoc New value of property productAssoc.
- *
*/
public void setProductAssoc(org.apache.ofbiz.entity.GenericValue productAssoc) {
this.productAssoc = productAssoc;
diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java
index bbe2a57..fbd752d 100644
--- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java
+++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java
@@ -62,10 +62,8 @@ public class BOMTree {
* @param productId The product for which we want to get the bom.
* @param bomTypeId The bill of materials type (e.g. manufacturing, engineering, ...)
* @param inDate Validity date (if null, today is used).
- *
* @param delegator The delegator used.
* @throws GenericEntityException If a db problem occurs.
- *
*/
public BOMTree(String productId, String bomTypeId, Date inDate, Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) throws GenericEntityException {
this(productId, bomTypeId, inDate, EXPLOSION, delegator, dispatcher, userLogin);
@@ -78,15 +76,12 @@ public class BOMTree {
* @param productId The product for which we want to get the bom.
* @param bomTypeId The bill of materials type (e.g. manufacturing, engineering, ...)
* @param inDate Validity date (if null, today is used).
- *
* @param type if equals to EXPLOSION, a downward visit is performed (explosion);
* if equals to EXPLOSION_SINGLE_LEVEL, a single level explosion is performed;
* if equals to EXPLOSION_MANUFACTURING, a downward visit is performed (explosion), including only the product that needs manufacturing;
* if equals to IMPLOSION an upward visit is done (implosion);
- *
* @param delegator The delegator used.
* @throws GenericEntityException If a db problem occurs.
- *
*/
public BOMTree(String productId, String bomTypeId, Date inDate, int type, Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) throws GenericEntityException {
// If the parameters are not valid, return.
@@ -180,7 +175,6 @@ public class BOMTree {
* a product's bill of materials is completely configured
* or not.
* @return true if no virtual nodes (products) are present in the tree.
- *
*/
public boolean isConfigured() {
List<BOMNode> notConfiguredParts = new LinkedList<>();
@@ -190,7 +184,6 @@ public class BOMTree {
/** Getter for property rootQuantity.
* @return Value of property rootQuantity.
- *
*/
public BigDecimal getRootQuantity() {
return rootQuantity;
@@ -198,7 +191,6 @@ public class BOMTree {
/** Setter for property rootQuantity.
* @param rootQuantity New value of property rootQuantity.
- *
*/
public void setRootQuantity(BigDecimal rootQuantity) {
this.rootQuantity = rootQuantity;
@@ -206,7 +198,6 @@ public class BOMTree {
/** Getter for property rootAmount.
* @return Value of property rootAmount.
- *
*/
public BigDecimal getRootAmount() {
return rootAmount;
@@ -214,7 +205,6 @@ public class BOMTree {
/** Setter for property rootAmount.
* @param rootAmount New value of property rootAmount.
- *
*/
public void setRootAmount(BigDecimal rootAmount) {
this.rootAmount = rootAmount;
@@ -222,7 +212,6 @@ public class BOMTree {
/** Getter for property root.
* @return Value of property root.
- *
*/
public BOMNode getRoot() {
return root;
@@ -230,7 +219,6 @@ public class BOMTree {
/** Getter for property inDate.
* @return Value of property inDate.
- *
*/
public Date getInDate() {
return inDate;
@@ -238,7 +226,6 @@ public class BOMTree {
/** Getter for property bomTypeId.
* @return Value of property bomTypeId.
- *
*/
public String getBomTypeId() {
return bomTypeId;
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 6d1fa15..5720c60 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
@@ -75,7 +75,6 @@ public class ProductionRunServices {
/**
* Cancels a ProductionRun.
- *
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input parameters.
* @return Map with the result of the service, the output parameters.
@@ -179,7 +178,6 @@ public class ProductionRunServices {
* <li> for the first routingTask, create for all the valid productIdTo with no associateRoutingTask a WorkEffortGoodStandard</li>
* <li> for each valid routingTask of the routing and valid productIdTo associate with this RoutingTask create a WorkEffortGoodStandard</li>
* </ul>
- *
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input parameters, productId, routingId, pRQuantity, startDate, workEffortName, description
* @return Map with the result of the service, the output parameters.
@@ -530,7 +528,6 @@ public class ProductionRunServices {
* <li> for the first routingTask, create for all the valid productIdTo with no associateRoutingTask a WorkEffortGoodStandard</li>
* <li> for each valid routingTask of the routing and valid productIdTo associate with this RoutingTask create a WorkEffortGoodStandard</li>
* </ul>
- *
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input parameters, productId, routingId, quantity, estimatedStartDate, workEffortName, description
* @return Map with the result of the service, the output parameters.
@@ -1333,7 +1330,6 @@ public class ProductionRunServices {
* <li>If priority or estimatedStartDate has changed recalculated data for routingTask after that one.</li>
* </ul>
* Update the productionRun
- *
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input parameters, productId, routingId, priority, estimatedStartDate, estimatedSetupMillis,
* estimatedMilliSeconds
@@ -3095,7 +3091,6 @@ public class ProductionRunServices {
/**
* Quick runs a ProductionRun task to the completed status, also issuing components
* if necessary.
- *
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input parameters.
* @return Map with the result of the service, the output parameters.
@@ -3147,7 +3142,6 @@ public class ProductionRunServices {
/**
* Quick runs all the tasks of a ProductionRun to the completed status,
* also issuing components if necessary.
- *
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input parameters.
* @return Map with the result of the service, the output parameters.
@@ -3232,7 +3226,6 @@ public class ProductionRunServices {
/**
* Quick moves a ProductionRun to the passed in status, performing all
* the needed tasks in the way.
- *
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input parameters.
* @return Map with the result of the service, the output parameters.
@@ -3316,7 +3309,6 @@ public class ProductionRunServices {
/**
* Given a productId and an optional date, returns the total qty
* of productId reserved by production runs.
- *
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input parameters.
* @return Map with the result of the service, the output parameters.
diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java
index 9c0415e..89c2299 100644
--- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java
+++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java
@@ -39,10 +39,8 @@ public class InventoryEventPlannedServices {
private static final String RESOURCE = "ManufacturingUiLabels";
/**
- *
* Create an MrpEvent.
* Make an update if a record exist with same key, (adding the event quantity to the exiting record)
- *
* @param ctx the dispatch context
* @param context a map containing the parameters used to create an MrpEvent
* @return result a map with service status
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 92807a6..58b064e 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
@@ -513,7 +513,6 @@ public class MrpServices {
* <li>PreConditions : none</li>
* <li>Result : We get the quantity of product available in the stocks.</li>
* </ul>
- *
* @param product the product for which the Quantity Available is required
* @return the sum of all the totalAvailableToPromise of the inventoryItem related to the product, if the related facility is Mrp available
* (not yet implemented!!)
@@ -565,7 +564,6 @@ public class MrpServices {
/**
* Process the bill of material (bom) of the product to insert components in the MrpEvent table.
* Before inserting in the entity, test if there is the record already existing to add quantity rather to create a new one.
- *
* @param mrpId the mrp id
* @param product GenericValue oject of the product
* @param eventQuantity the product quantity needed
@@ -613,7 +611,6 @@ public class MrpServices {
* <li>INPUT : parameters to get from the context: <ul><li>String mrpName</li></ul></li>
* <li>OUTPUT : Result to put in the map : <ul><li>none</li></ul></li>
* </ul>
- *
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input parameters, productId routingId, quantity, startDate.
* @return Map with the result of the service, the output parameters.
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 bfbe79a..c71c0e9 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
@@ -54,9 +54,7 @@ public class TechDataServices {
private static final String RESOURCE = "ManufacturingUiLabels";
/**
- *
* Used to retrieve some RoutingTasks (WorkEffort) selected by Name or MachineGroup ordered by Name
- *
* @param ctx the dispatch context
* @param context a map containing workEffortName (routingTaskName) and fixedAssetId (MachineGroup or ANY)
* @return result a map containing lookupResult (list of RoutingTask <=> workEffortId with currentStatusId = "ROU_ACTIVE" and workEffortTypeId = "ROU_TASK"
@@ -101,9 +99,7 @@ public class TechDataServices {
}
/**
- *
* Used to check if there is not two routing task with the same SeqId valid at the same period
- *
* @param ctx The DispatchContext that this service is operating in.
* @param context a map containing workEffortIdFrom (routing) and SeqId, fromDate thruDate
* @return result a map containing sequenceNumNotOk which is equal to "Y" if it's not Ok
@@ -166,7 +162,6 @@ public class TechDataServices {
/**
* Used to get the techDataCalendar for a routingTask, if there is a entity exception
* or routingTask associated with no MachineGroup the DEFAULT TechDataCalendar is return.
- *
* @param routingTask the routingTask for which we are looking for
* @return the techDataCalendar associated
*/
@@ -209,7 +204,6 @@ public class TechDataServices {
}
/** Used to find the fisrt day in the TechDataCalendarWeek where capacity != 0, beginning at dayStart, dayStart included.
- *
* @param techDataCalendarWeek The TechDataCalendarWeek cover
* @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
@@ -262,7 +256,6 @@ public class TechDataServices {
}
/** Used to to request the remain capacity available for dateFrom in a TechDataCalenda,
* If the dateFrom (param in) is not in an available TechDataCalendar period, the return value is zero.
- *
* @param techDataCalendar The TechDataCalendar cover
* @param dateFrom the date
* @return long capacityRemaining
@@ -292,7 +285,6 @@ public class TechDataServices {
}
/** 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
- *
* @param techDataCalendar The TechDataCalendar cover
* @param dateFrom the date
* @return a map with Timestamp dateTo, Double nextCapacity
@@ -333,7 +325,6 @@ public class TechDataServices {
}
/** Used to move forward in a TechDataCalenda, start from the dateFrom and move forward only on available period.
* If the dateFrom (param in) is not a available TechDataCalendar period, the startDate is the begining of the next day available
- *
* @param techDataCalendar The TechDataCalendar cover
* @param dateFrom the start date
* @param amount the amount of millisecond to move forward
@@ -362,7 +353,6 @@ public class TechDataServices {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** Used to find the last day in the TechDataCalendarWeek where capacity != 0, ending at dayEnd, dayEnd included.
- *
* @param techDataCalendarWeek The TechDataCalendarWeek cover
* @param dayEnd
* @return a map with the capacity (Double) available, the startTime and moveDay (int): the number of day it's necessary to move to have capacity available
@@ -415,7 +405,6 @@ public class TechDataServices {
}
/** Used to request the remaining capacity available for dateFrom in a TechDataCalenda,
* If the dateFrom (param in) is not in an available TechDataCalendar period, the return value is zero.
- *
* @param techDataCalendar The TechDataCalendar cover
* @param dateFrom the date
* @return long capacityRemaining
@@ -445,7 +434,6 @@ public class TechDataServices {
}
/** 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
- *
* @param techDataCalendar The TechDataCalendar cover
* @param dateFrom the date
* @return a map with Timestamp dateTo, Double previousCapacity
@@ -488,7 +476,6 @@ public class TechDataServices {
}
/** Used to move backward in a TechDataCalendar, start from the dateFrom and move backward only on available period.
* If the dateFrom (param in) is not a available TechDataCalendar period, the startDate is the end of the previous day available
- *
* @param techDataCalendar The TechDataCalendar cover
* @param dateFrom the start date
* @param amount the amount of millisecond to move backward
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java
index a6757b7..4985e0c 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java
@@ -84,7 +84,6 @@ public final class FinAccountHelper {
/**
* A convenience method which adds transactions.get(0).get(fieldName) to initialValue, all done in BigDecimal to decimals and rounding
- *
* @param initialValue the initial value
* @param transactions a List of GenericValue objects of transactions
* @param fieldName the field name to get the value from the transaction
@@ -110,7 +109,6 @@ public final class FinAccountHelper {
/**
* Returns a unique randomly generated account code for FinAccount.finAccountCode composed of uppercase letters and numbers
- *
* @param codeLength length of code in number of characters
* @param delegator the delegator
* @return returns a unique randomly generated account code for FinAccount.finAccountCode composed of uppercase letters and numbers
@@ -147,7 +145,6 @@ public final class FinAccountHelper {
/**
* Gets the first (and should be only) FinAccount based on finAccountCode, which will be cleaned up to be only uppercase and alphanumeric
- *
* @param finAccountCode the financial account code
* @param delegator the delegator
* @return gets the first financial account by code
@@ -179,7 +176,6 @@ public final class FinAccountHelper {
/**
* Sum of all DEPOSIT and ADJUSTMENT transactions minus all WITHDRAWAL transactions whose transactionDate is before asOfDateTime
- *
* @param finAccountId the financial account id
* @param asOfDateTime the validity date
* @param delegator the delegator
@@ -221,7 +217,6 @@ public final class FinAccountHelper {
/**
* Returns the net balance (see above) minus the sum of all authorization amounts which are not expired and were authorized by the as of date
- *
* @param finAccountId the financial account id
* @param asOfDateTime the validity date
* @param delegator the delegator
@@ -253,7 +248,6 @@ public final class FinAccountHelper {
/**
* Validates a FinAccount's PIN number
- *
* @param delegator the delegator
* @param finAccountId the financial account id
* @param pinNumber a pin number
@@ -281,7 +275,6 @@ public final class FinAccountHelper {
/**
* Generate a random financial number
- *
* @param delegator the delegator
* @param length length of the number to generate (up to 19 digits)
* @param isId to be used as an ID (will check the DB to make sure it doesn't already exist)
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderEvents.java
index 202f293..b7f932e 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderEvents.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderEvents.java
@@ -99,7 +99,7 @@ public class OrderEvents {
Locale locale = UtilHttp.getLocale(request);
Map<String, Object> resultMap;
- String orderId = request.getParameter("orderId");
+ String orderId = request.getParameter("orderId");
String[] selectedItems = request.getParameterValues("selectedItem");
if (selectedItems != null) {
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 b777bc2..55e0c3f 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
@@ -74,22 +74,27 @@ public class OrderReadHelper {
private static final BigDecimal ZERO = (BigDecimal.ZERO).setScale(DECIMALS, ROUNDING);
private static final BigDecimal PERCENTAGE = (new BigDecimal("0.01")).setScale(DECIMALS, ROUNDING);
- protected GenericValue orderHeader = null;
- protected List<GenericValue> orderItemAndShipGrp = null;
- protected List<GenericValue> orderItems = null;
- protected List<GenericValue> adjustments = null;
- protected List<GenericValue> paymentPrefs = null;
- protected List<GenericValue> orderStatuses = null;
- protected List<GenericValue> orderItemPriceInfos = null;
- protected List<GenericValue> orderItemShipGrpInvResList = null;
- protected List<GenericValue> orderItemIssuances = null;
- protected List<GenericValue> orderReturnItems = null;
- protected Map<String, GenericValue> orderAttributeMap = null;
- protected List<GenericValue> orderItemAttributes = null;
- protected BigDecimal totalPrice = null;
-
+ private GenericValue orderHeader = null;
+ private List<GenericValue> orderItemAndShipGrp = null;
+ private List<GenericValue> orderItems = null;
+ private List<GenericValue> adjustments = null;
+ private List<GenericValue> paymentPrefs = null;
+ private List<GenericValue> orderStatuses = null;
+ private List<GenericValue> orderItemPriceInfos = null;
+ private List<GenericValue> orderItemShipGrpInvResList = null;
+ private List<GenericValue> orderItemIssuances = null;
+ private List<GenericValue> orderReturnItems = null;
+ private Map<String, GenericValue> orderAttributeMap = null;
+ private List<GenericValue> orderItemAttributes = null;
+ private BigDecimal totalPrice = null;
protected OrderReadHelper() { }
+ /**
+ * Instantiates a new Order read helper.
+ * @param orderHeader the order header
+ * @param adjustments the adjustments
+ * @param orderItems the order items
+ */
public OrderReadHelper(GenericValue orderHeader, List<GenericValue> adjustments, List<GenericValue> orderItems) {
this.orderHeader = orderHeader;
this.adjustments = adjustments;
@@ -119,15 +124,29 @@ public class OrderReadHelper {
}
}
+ /**
+ * Instantiates a new Order read helper.
+ * @param orderHeader the order header
+ */
public OrderReadHelper(GenericValue orderHeader) {
this(orderHeader, null, null);
}
+ /**
+ * Instantiates a new Order read helper.
+ * @param adjustments the adjustments
+ * @param orderItems the order items
+ */
public OrderReadHelper(List<GenericValue> adjustments, List<GenericValue> orderItems) {
this.adjustments = adjustments;
this.orderItems = orderItems;
}
+ /**
+ * Instantiates a new Order read helper.
+ * @param delegator the delegator
+ * @param orderId the order id
+ */
public OrderReadHelper(Delegator delegator, String orderId) {
try {
this.orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne();
@@ -145,20 +164,33 @@ public class OrderReadHelper {
// ========== Order Header Methods ==========
// ==========================================
+ /**
+ * Gets order id.
+ * @return the order id
+ */
public String getOrderId() {
return orderHeader.getString("orderId");
}
+ /**
+ * Gets web site id.
+ * @return the web site id
+ */
public String getWebSiteId() {
return orderHeader.getString("webSiteId");
}
+ /**
+ * Gets product store id.
+ * @return the product store id
+ */
public String getProductStoreId() {
return orderHeader.getString("productStoreId");
}
/**
* Returns the ProductStore of this Order or null in case of Exception
+ * @return the product store
*/
public GenericValue getProductStore() {
String productStoreId = orderHeader.getString("productStoreId");
@@ -167,23 +199,39 @@ public class OrderReadHelper {
GenericValue productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).cache().queryOne();
return productStore;
} catch (GenericEntityException ex) {
- Debug.logError(ex, "Failed to get product store for order header [" + orderHeader + "] due to exception "+ ex.getMessage(), MODULE);
+ Debug.logError(ex, "Failed to get product store for order header [" + orderHeader + "] due to exception " + ex.getMessage(), MODULE);
return null;
}
}
+ /**
+ * Gets order type id.
+ * @return the order type id
+ */
public String getOrderTypeId() {
return orderHeader.getString("orderTypeId");
}
+ /**
+ * Gets currency.
+ * @return the currency
+ */
public String getCurrency() {
return orderHeader.getString("currencyUom");
}
+ /**
+ * Gets order name.
+ * @return the order name
+ */
public String getOrderName() {
return orderHeader.getString("orderName");
}
+ /**
+ * Gets adjustments.
+ * @return the adjustments
+ */
public List<GenericValue> getAdjustments() {
if (adjustments == null) {
try {
@@ -197,7 +245,10 @@ public class OrderReadHelper {
}
return adjustments;
}
-
+ /**
+ * Gets payment preferences.
+ * @return the payment preferences
+ */
public List<GenericValue> getPaymentPreferences() {
if (paymentPrefs == null) {
try {
@@ -208,7 +259,6 @@ public class OrderReadHelper {
}
return paymentPrefs;
}
-
/**
* Returns a Map of paymentMethodId -> amount charged (BigDecimal) based on PaymentGatewayResponse.
* @return returns a Map of paymentMethodId -> amount charged (BigDecimal) based on PaymentGatewayResponse.
@@ -242,7 +292,8 @@ public class OrderReadHelper {
if (chargedToPaymentPref.compareTo(ZERO) > 0) {
// key of the resulting map is paymentMethodId or paymentMethodTypeId if the paymentMethodId is not available
- String paymentMethodKey = paymentPref.getString("paymentMethodId") != null ? paymentPref.getString("paymentMethodId") : paymentPref.getString("paymentMethodTypeId");
+ String paymentMethodKey = paymentPref.getString("paymentMethodId") != null ? paymentPref.getString("paymentMethodId")
+ : paymentPref.getString("paymentMethodTypeId");
if (paymentMethodAmounts.containsKey(paymentMethodKey)) {
BigDecimal value = paymentMethodAmounts.get(paymentMethodKey);
if (value != null) {
@@ -265,27 +316,39 @@ public class OrderReadHelper {
for (GenericValue paymentPref : paymentPrefs) {
List<GenericValue> returnItemResponses = new LinkedList<>();
try {
- returnItemResponses = orderHeader.getDelegator().findByAnd("ReturnItemResponse", UtilMisc.toMap("orderPaymentPreferenceId", paymentPref.getString("orderPaymentPreferenceId")), null, false);
+ returnItemResponses = orderHeader.getDelegator().findByAnd("ReturnItemResponse",
+ UtilMisc.toMap("orderPaymentPreferenceId", paymentPref.getString("orderPaymentPreferenceId")), null, false);
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
}
BigDecimal refundedToPaymentPref = ZERO;
for (GenericValue returnItemResponse : returnItemResponses) {
- refundedToPaymentPref = refundedToPaymentPref.add(returnItemResponse.getBigDecimal("responseAmount")).setScale(DECIMALS + 1, ROUNDING);
+ refundedToPaymentPref = refundedToPaymentPref.add(returnItemResponse.getBigDecimal("responseAmount"))
+ .setScale(DECIMALS + 1, ROUNDING);
}
if (refundedToPaymentPref.compareTo(ZERO) == 1) {
- String paymentMethodId = paymentPref.getString("paymentMethodId") != null ? paymentPref.getString("paymentMethodId") : paymentPref.getString("paymentMethodTypeId");
+ String paymentMethodId = paymentPref.getString("paymentMethodId") != null ? paymentPref.getString("paymentMethodId")
+ : paymentPref.getString("paymentMethodTypeId");
paymentMethodAmounts.put(paymentMethodId, refundedToPaymentPref.setScale(DECIMALS, ROUNDING));
}
}
return paymentMethodAmounts;
}
+ /**
+ * Gets order payments.
+ * @return the order payments
+ */
public List<GenericValue> getOrderPayments() {
return getOrderPayments(null);
}
+ /**
+ * Gets order payments.
+ * @param orderPaymentPreference the order payment preference
+ * @return the order payments
+ */
public List<GenericValue> getOrderPayments(GenericValue orderPaymentPreference) {
List<GenericValue> orderPayments = new LinkedList<>();
List<GenericValue> prefs = null;
@@ -308,6 +371,10 @@ public class OrderReadHelper {
return orderPayments;
}
+ /**
+ * Gets order statuses.
+ * @return the order statuses
+ */
public List<GenericValue> getOrderStatuses() {
if (orderStatuses == null) {
try {
@@ -319,6 +386,10 @@ public class OrderReadHelper {
return orderStatuses;
}
+ /**
+ * Gets order terms.
+ * @return the order terms
+ */
public List<GenericValue> getOrderTerms() {
try {
return orderHeader.getRelated("OrderTerm", null, null, false);
@@ -337,11 +408,17 @@ public class OrderReadHelper {
if (UtilValidate.isEmpty(orderTerms)) {
return null;
} else if (orderTerms.size() > 1) {
- Debug.logWarning("Found " + orderTerms.size() + " FIN_PAYMENT_TERM order terms for orderId [" + getOrderId() + "], using the first one ", MODULE);
+ Debug.logWarning("Found " + orderTerms.size() + " FIN_PAYMENT_TERM order terms for orderId [" + getOrderId()
+ + "], using the first one ", MODULE);
}
return orderTerms.get(0).getLong("termDays");
}
+ /**
+ * Gets shipping method.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the shipping method
+ */
public String getShippingMethod(String shipGroupSeqId) {
try {
GenericValue shipGroup = orderHeader.getDelegator().findOne("OrderItemShipGroup",
@@ -366,6 +443,11 @@ public class OrderReadHelper {
return "";
}
+ /**
+ * Gets shipping method code.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the shipping method code
+ */
public String getShippingMethodCode(String shipGroupSeqId) {
try {
GenericValue shipGroup = orderHeader.getDelegator().findOne("OrderItemShipGroup",
@@ -378,7 +460,8 @@ public class OrderReadHelper {
GenericValue shipmentMethodType = carrierShipmentMethod.getRelatedOne("ShipmentMethodType", false);
if (shipmentMethodType != null) {
- return UtilFormatOut.checkNull(shipmentMethodType.getString("shipmentMethodTypeId")) + "@" + UtilFormatOut.checkNull(shipGroup.getString("carrierPartyId"));
+ return UtilFormatOut.checkNull(shipmentMethodType.getString("shipmentMethodTypeId")) + "@"
+ + UtilFormatOut.checkNull(shipGroup.getString("carrierPartyId"));
}
}
return UtilFormatOut.checkNull(shipGroup.getString("carrierPartyId"));
@@ -389,10 +472,19 @@ public class OrderReadHelper {
return "";
}
+ /**
+ * Has shipping address boolean.
+ * @return the boolean
+ */
public boolean hasShippingAddress() {
return UtilValidate.isNotEmpty(this.getShippingLocations());
}
+ /**
+ * Has physical product items boolean.
+ * @return the boolean
+ * @throws GenericEntityException the generic entity exception
+ */
public boolean hasPhysicalProductItems() throws GenericEntityException {
for (GenericValue orderItem : this.getOrderItems()) {
GenericValue product = orderItem.getRelatedOne("Product", true);
@@ -405,7 +497,11 @@ public class OrderReadHelper {
}
return false;
}
-
+ /**
+ * Gets order item ship group.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the order item ship group
+ */
public GenericValue getOrderItemShipGroup(String shipGroupSeqId) {
try {
return orderHeader.getDelegator().findOne("OrderItemShipGroup",
@@ -416,6 +512,10 @@ public class OrderReadHelper {
return null;
}
+ /**
+ * Gets order item ship groups.
+ * @return the order item ship groups
+ */
public List<GenericValue> getOrderItemShipGroups() {
try {
return orderHeader.getRelated("OrderItemShipGroup", null, UtilMisc.toList("shipGroupSeqId"), false);
@@ -425,6 +525,10 @@ public class OrderReadHelper {
return null;
}
+ /**
+ * Gets shipping locations.
+ * @return the shipping locations
+ */
public List<GenericValue> getShippingLocations() {
List<GenericValue> shippingLocations = new LinkedList<>();
List<GenericValue> shippingCms = this.getOrderContactMechs("SHIPPING_LOCATION");
@@ -446,6 +550,11 @@ public class OrderReadHelper {
return shippingLocations;
}
+ /**
+ * Gets shipping address.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the shipping address
+ */
public GenericValue getShippingAddress(String shipGroupSeqId) {
try {
GenericValue shipGroup = orderHeader.getDelegator().findOne("OrderItemShipGroup",
@@ -461,11 +570,16 @@ public class OrderReadHelper {
return null;
}
- /** @deprecated */
+ /**
+ * Gets shipping address.
+ * @return the shipping address
+ * @deprecated
+ */
@Deprecated
public GenericValue getShippingAddress() {
try {
- GenericValue orderContactMech = EntityUtil.getFirst(orderHeader.getRelated("OrderContactMech", UtilMisc.toMap("contactMechPurposeTypeId", "SHIPPING_LOCATION"), null, false));
+ GenericValue orderContactMech = EntityUtil.getFirst(orderHeader.getRelated("OrderContactMech",
+ UtilMisc.toMap("contactMechPurposeTypeId", "SHIPPING_LOCATION"), null, false));
if (orderContactMech != null) {
GenericValue contactMech = orderContactMech.getRelatedOne("ContactMech", false);
@@ -480,6 +594,10 @@ public class OrderReadHelper {
return null;
}
+ /**
+ * Gets billing locations.
+ * @return the billing locations
+ */
public List<GenericValue> getBillingLocations() {
List<GenericValue> billingLocations = new LinkedList<>();
List<GenericValue> billingCms = this.getOrderContactMechs("BILLING_LOCATION");
@@ -501,12 +619,17 @@ public class OrderReadHelper {
return billingLocations;
}
- /** @deprecated */
+ /**
+ * Gets billing address.
+ * @return the billing address
+ * @deprecated
+ */
@Deprecated
public GenericValue getBillingAddress() {
GenericValue billingAddress = null;
try {
- GenericValue orderContactMech = EntityUtil.getFirst(orderHeader.getRelated("OrderContactMech", UtilMisc.toMap("contactMechPurposeTypeId", "BILLING_LOCATION"), null, false));
+ GenericValue orderContactMech = EntityUtil.getFirst(orderHeader.getRelated("OrderContactMech",
+ UtilMisc.toMap("contactMechPurposeTypeId", "BILLING_LOCATION"), null, false));
if (orderContactMech != null) {
GenericValue contactMech = orderContactMech.getRelatedOne("ContactMech", false);
@@ -554,6 +677,11 @@ public class OrderReadHelper {
return billingAddress;
}
+ /**
+ * Gets order contact mechs.
+ * @param purposeTypeId the purpose type id
+ * @return the order contact mechs
+ */
public List<GenericValue> getOrderContactMechs(String purposeTypeId) {
try {
return orderHeader.getRelated("OrderContactMech", UtilMisc.toMap("contactMechPurposeTypeId", purposeTypeId), null, false);
@@ -563,6 +691,10 @@ public class OrderReadHelper {
return null;
}
+ /**
+ * Gets earliest ship by date.
+ * @return the earliest ship by date
+ */
public Timestamp getEarliestShipByDate() {
try {
List<GenericValue> groups = orderHeader.getRelated("OrderItemShipGroup", null, UtilMisc.toList("shipByDate"), false);
@@ -576,6 +708,10 @@ public class OrderReadHelper {
return null;
}
+ /**
+ * Gets latest ship after date.
+ * @return the latest ship after date
+ */
public Timestamp getLatestShipAfterDate() {
try {
List<GenericValue> groups = orderHeader.getRelated("OrderItemShipGroup", null, UtilMisc.toList("shipAfterDate DESC"), false);
@@ -589,6 +725,10 @@ public class OrderReadHelper {
return null;
}
+ /**
+ * Gets current status string.
+ * @return the current status string
+ */
public String getCurrentStatusString() {
GenericValue statusItem = null;
try {
@@ -602,6 +742,11 @@ public class OrderReadHelper {
return orderHeader.getString("statusId");
}
+ /**
+ * Gets status string.
+ * @param locale the locale
+ * @return the status string
+ */
public String getStatusString(Locale locale) {
List<GenericValue> orderStatusList = this.getOrderHeaderStatuses();
@@ -644,6 +789,10 @@ public class OrderReadHelper {
return orderStatusString.toString();
}
+ /**
+ * Gets billing account.
+ * @return the billing account
+ */
public GenericValue getBillingAccount() {
GenericValue billingAccount = null;
try {
@@ -657,6 +806,7 @@ public class OrderReadHelper {
/**
* Returns the OrderPaymentPreference.maxAmount for the billing account associated with the order, or 0 if there is no
* billing account or no max amount set
+ * @return the billing account max amount
*/
public BigDecimal getBillingAccountMaxAmount() {
if (getBillingAccount() == null) {
@@ -682,6 +832,7 @@ public class OrderReadHelper {
/**
* Returns party from OrderRole of BILL_TO_CUSTOMER
+ * @return the bill to party
*/
public GenericValue getBillToParty() {
return this.getPartyFromRole("BILL_TO_CUSTOMER");
@@ -689,6 +840,7 @@ public class OrderReadHelper {
/**
* Returns party from OrderRole of BILL_FROM_VENDOR
+ * @return the bill from party
*/
public GenericValue getBillFromParty() {
return this.getPartyFromRole("BILL_FROM_VENDOR");
@@ -696,6 +848,7 @@ public class OrderReadHelper {
/**
* Returns party from OrderRole of SHIP_TO_CUSTOMER
+ * @return the ship to party
*/
public GenericValue getShipToParty() {
return this.getPartyFromRole("SHIP_TO_CUSTOMER");
@@ -703,6 +856,7 @@ public class OrderReadHelper {
/**
* Returns party from OrderRole of PLACING_CUSTOMER
+ * @return the placing party
*/
public GenericValue getPlacingParty() {
return this.getPartyFromRole("PLACING_CUSTOMER");
@@ -710,6 +864,7 @@ public class OrderReadHelper {
/**
* Returns party from OrderRole of END_USER_CUSTOMER
+ * @return the end user party
*/
public GenericValue getEndUserParty() {
return this.getPartyFromRole("END_USER_CUSTOMER");
@@ -717,11 +872,17 @@ public class OrderReadHelper {
/**
* Returns party from OrderRole of SUPPLIER_AGENT
+ * @return the supplier agent
*/
public GenericValue getSupplierAgent() {
return this.getPartyFromRole("SUPPLIER_AGENT");
}
+ /**
+ * Gets party from role.
+ * @param roleTypeId the role type id
+ * @return the party from role
+ */
public GenericValue getPartyFromRole(String roleTypeId) {
Delegator delegator = orderHeader.getDelegator();
GenericValue partyObject = null;
@@ -741,9 +902,14 @@ public class OrderReadHelper {
return partyObject;
}
+ /**
+ * Gets distributor id.
+ * @return the distributor id
+ */
public String getDistributorId() {
try {
- GenericEntity distributorRole = EntityUtil.getFirst(orderHeader.getRelated("OrderRole", UtilMisc.toMap("roleTypeId", "DISTRIBUTOR"), null, false));
+ GenericEntity distributorRole = EntityUtil.getFirst(orderHeader.getRelated("OrderRole",
+ UtilMisc.toMap("roleTypeId", "DISTRIBUTOR"), null, false));
return distributorRole == null ? null : distributorRole.getString("partyId");
} catch (GenericEntityException e) {
@@ -752,9 +918,14 @@ public class OrderReadHelper {
return null;
}
+ /**
+ * Gets affiliate id.
+ * @return the affiliate id
+ */
public String getAffiliateId() {
try {
- GenericEntity distributorRole = EntityUtil.getFirst(orderHeader.getRelated("OrderRole", UtilMisc.toMap("roleTypeId", "AFFILIATE"), null, false));
+ GenericEntity distributorRole = EntityUtil.getFirst(orderHeader.getRelated("OrderRole",
+ UtilMisc.toMap("roleTypeId", "AFFILIATE"), null, false));
return distributorRole == null ? null : distributorRole.getString("partyId");
} catch (GenericEntityException e) {
@@ -763,25 +934,44 @@ public class OrderReadHelper {
return null;
}
+ /**
+ * Gets shipping total.
+ * @return the shipping total
+ */
public BigDecimal getShippingTotal() {
return OrderReadHelper.calcOrderAdjustments(getOrderHeaderAdjustments(), getOrderItemsSubTotal(), false, false, true);
}
+ /**
+ * Gets header tax total.
+ * @return the header tax total
+ */
public BigDecimal getHeaderTaxTotal() {
return OrderReadHelper.calcOrderAdjustments(getOrderHeaderAdjustments(), getOrderItemsSubTotal(), false, true, false);
}
+ /**
+ * Gets tax total.
+ * @return the tax total
+ */
public BigDecimal getTaxTotal() {
return OrderReadHelper.calcOrderAdjustments(getAdjustments(), getOrderItemsSubTotal(), false, true, false);
}
+ /**
+ * Gets item feature set.
+ * @param item the item
+ * @return the item feature set
+ */
public Set<String> getItemFeatureSet(GenericValue item) {
Set<String> featureSet = new LinkedHashSet<>();
List<GenericValue> featureAppls = null;
if (item.get("productId") != null) {
try {
- featureAppls = item.getDelegator().findByAnd("ProductFeatureAppl", UtilMisc.toMap("productId", item.getString("productId")), null, true);
- List<EntityExpr> filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE"));
+ featureAppls = item.getDelegator().findByAnd("ProductFeatureAppl",
+ UtilMisc.toMap("productId", item.getString("productId")), null, true);
+ List<EntityExpr> filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId",
+ EntityOperator.EQUALS, "STANDARD_FEATURE"));
filterExprs.add(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE"));
featureAppls = EntityUtil.filterByOr(featureAppls, filterExprs);
} catch (GenericEntityException e) {
@@ -813,6 +1003,11 @@ public class OrderReadHelper {
return featureSet;
}
+ /**
+ * Gets feature id qty map.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the feature id qty map
+ */
public Map<String, BigDecimal> getFeatureIdQtyMap(String shipGroupSeqId) {
Map<String, BigDecimal> featureMap = new HashMap<>();
List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId);
@@ -821,8 +1016,10 @@ public class OrderReadHelper {
List<GenericValue> featureAppls = null;
if (item.get("productId") != null) {
try {
- featureAppls = item.getDelegator().findByAnd("ProductFeatureAppl", UtilMisc.toMap("productId", item.getString("productId")), null, true);
- List<EntityExpr> filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE"));
+ featureAppls = item.getDelegator().findByAnd("ProductFeatureAppl",
+ UtilMisc.toMap("productId", item.getString("productId")), null, true);
+ List<EntityExpr> filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId",
+ EntityOperator.EQUALS, "STANDARD_FEATURE"));
filterExprs.add(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE"));
featureAppls = EntityUtil.filterByOr(featureAppls, filterExprs);
} catch (GenericEntityException e) {
@@ -843,7 +1040,8 @@ public class OrderReadHelper {
// get the ADDITIONAL_FEATURE adjustments
List<GenericValue> additionalFeatures = null;
try {
- additionalFeatures = item.getRelated("OrderAdjustment", UtilMisc.toMap("orderAdjustmentTypeId", "ADDITIONAL_FEATURE"), null, false);
+ additionalFeatures = item.getRelated("OrderAdjustment", UtilMisc.toMap("orderAdjustmentTypeId", "ADDITIONAL_FEATURE"),
+ null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to get OrderAdjustment from item : " + item, MODULE);
}
@@ -866,6 +1064,10 @@ public class OrderReadHelper {
return featureMap;
}
+ /**
+ * Shipping applies boolean.
+ * @return the boolean
+ */
public boolean shippingApplies() {
boolean shippingApplies = false;
List<GenericValue> validItems = this.getValidOrderItems();
@@ -888,6 +1090,10 @@ public class OrderReadHelper {
return shippingApplies;
}
+ /**
+ * Tax applies boolean.
+ * @return the boolean
+ */
public boolean taxApplies() {
boolean taxApplies = false;
List<GenericValue> validItems = this.getValidOrderItems();
@@ -910,6 +1116,11 @@ public class OrderReadHelper {
return taxApplies;
}
+ /**
+ * Gets shippable total.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the shippable total
+ */
public BigDecimal getShippableTotal(String shipGroupSeqId) {
BigDecimal shippableTotal = ZERO;
List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId);
@@ -924,7 +1135,8 @@ public class OrderReadHelper {
}
if (product != null) {
if (ProductWorker.shippingApplies(product)) {
- shippableTotal = shippableTotal.add(OrderReadHelper.getOrderItemSubTotal(item, getAdjustments(), false, true)).setScale(DECIMALS, ROUNDING);
+ shippableTotal = shippableTotal.add(OrderReadHelper.getOrderItemSubTotal(item, getAdjustments(), false, true))
+ .setScale(DECIMALS, ROUNDING);
}
}
}
@@ -932,6 +1144,10 @@ public class OrderReadHelper {
return shippableTotal.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets shippable quantity.
+ * @return the shippable quantity
+ */
public BigDecimal getShippableQuantity() {
BigDecimal shippableQuantity = ZERO;
List<GenericValue> shipGroups = getOrderItemShipGroups();
@@ -943,6 +1159,11 @@ public class OrderReadHelper {
return shippableQuantity.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets shippable quantity.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the shippable quantity
+ */
public BigDecimal getShippableQuantity(String shipGroupSeqId) {
BigDecimal shippableQuantity = ZERO;
List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId);
@@ -965,6 +1186,11 @@ public class OrderReadHelper {
return shippableQuantity.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets shippable weight.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the shippable weight
+ */
public BigDecimal getShippableWeight(String shipGroupSeqId) {
BigDecimal shippableWeight = ZERO;
List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId);
@@ -977,6 +1203,11 @@ public class OrderReadHelper {
return shippableWeight.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets item weight.
+ * @param item the item
+ * @return the item weight
+ */
public BigDecimal getItemWeight(GenericValue item) {
Delegator delegator = orderHeader.getDelegator();
BigDecimal itemWeight = ZERO;
@@ -1016,6 +1247,10 @@ public class OrderReadHelper {
return itemWeight;
}
+ /**
+ * Gets shippable sizes.
+ * @return the shippable sizes
+ */
public List<BigDecimal> getShippableSizes() {
List<BigDecimal> shippableSizes = new LinkedList<>();
@@ -1031,6 +1266,8 @@ public class OrderReadHelper {
/**
* Get the total payment preference amount by payment type. Specify null to get amount
* for all preference types. TODO: filter by status as well?
+ * @param paymentMethodTypeId the payment method type id
+ * @return the order payment preference total by type
*/
public BigDecimal getOrderPaymentPreferenceTotalByType(String paymentMethodTypeId) {
BigDecimal total = ZERO;
@@ -1045,14 +1282,26 @@ public class OrderReadHelper {
return total;
}
+ /**
+ * Gets credit card payment preference total.
+ * @return the credit card payment preference total
+ */
public BigDecimal getCreditCardPaymentPreferenceTotal() {
return getOrderPaymentPreferenceTotalByType("CREDIT_CARD");
}
+ /**
+ * Gets billing account payment preference total.
+ * @return the billing account payment preference total
+ */
public BigDecimal getBillingAccountPaymentPreferenceTotal() {
return getOrderPaymentPreferenceTotalByType("EXT_BILLACT");
}
+ /**
+ * Gets gift card payment preference total.
+ * @return the gift card payment preference total
+ */
public BigDecimal getGiftCardPaymentPreferenceTotal() {
return getOrderPaymentPreferenceTotalByType("GIFT_CARD");
}
@@ -1061,6 +1310,8 @@ public class OrderReadHelper {
* Get the total payment received amount by payment type. Specify null to get amount
* over all types. This method works by going through all the PaymentAndApplications
* for all order Invoices that have status PMNT_RECEIVED.
+ * @param paymentMethodTypeId the payment method type id
+ * @return the order payment received total by type
*/
public BigDecimal getOrderPaymentReceivedTotalByType(String paymentMethodTypeId) {
BigDecimal total = ZERO;
@@ -1095,6 +1346,11 @@ public class OrderReadHelper {
return total;
}
+ /**
+ * Gets item size.
+ * @param item the item
+ * @return the item size
+ */
public BigDecimal getItemSize(GenericValue item) {
Delegator delegator = orderHeader.getDelegator();
BigDecimal size = BigDecimal.ZERO;
@@ -1146,7 +1402,7 @@ public class OrderReadHelper {
}
// determine girth (longest field is length)
- BigDecimal[] sizeInfo = { height, width, depth };
+ BigDecimal[] sizeInfo = {height, width, depth };
Arrays.sort(sizeInfo);
size = sizeInfo[0].multiply(new BigDecimal("2")).add(sizeInfo[1].multiply(new BigDecimal("2"))).add(sizeInfo[2]);
@@ -1156,6 +1412,11 @@ public class OrderReadHelper {
return size;
}
+ /**
+ * Gets item pieces included.
+ * @param item the item
+ * @return the item pieces included
+ */
public long getItemPiecesIncluded(GenericValue item) {
Delegator delegator = orderHeader.getDelegator();
long piecesIncluded = 1;
@@ -1202,6 +1463,11 @@ public class OrderReadHelper {
return piecesIncluded;
}
+ /**
+ * Gets shippable item info.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the shippable item info
+ */
public List<Map<String, Object>> getShippableItemInfo(String shipGroupSeqId) {
List<Map<String, Object>> shippableInfo = new LinkedList<>();
@@ -1215,6 +1481,11 @@ public class OrderReadHelper {
return shippableInfo;
}
+ /**
+ * Gets item info map.
+ * @param item the item
+ * @return the item info map
+ */
public Map<String, Object> getItemInfoMap(GenericValue item) {
Map<String, Object> itemInfo = new HashMap<>();
itemInfo.put("productId", item.getString("productId"));
@@ -1226,6 +1497,10 @@ public class OrderReadHelper {
return itemInfo;
}
+ /**
+ * Gets order email string.
+ * @return the order email string
+ */
public String getOrderEmailString() {
Delegator delegator = orderHeader.getDelegator();
// get the email addresses from the order contact mech(s)
@@ -1253,6 +1528,10 @@ public class OrderReadHelper {
return emails.toString();
}
+ /**
+ * Gets order grand total.
+ * @return the order grand total
+ */
public BigDecimal getOrderGrandTotal() {
if (totalPrice == null) {
totalPrice = getOrderGrandTotal(getValidOrderItems(), getAdjustments());
@@ -1264,6 +1543,8 @@ public class OrderReadHelper {
* Gets the amount open on the order that is not covered by the relevant OrderPaymentPreferences.
* This works by adding up the amount allocated to each unprocessed OrderPaymentPreference and the
* amounts received and refunded as payments for the settled ones.
+ * @return the order open amount
+ * @throws GenericEntityException the generic entity exception
*/
public BigDecimal getOrderOpenAmount() throws GenericEntityException {
BigDecimal total = getOrderGrandTotal();
@@ -1275,7 +1556,8 @@ public class OrderReadHelper {
if ("PAYMENT_CANCELLED".equals(pref.get("statusId")) || "PAYMENT_DECLINED".equals(pref.get("statusId"))) {
continue;
} else if ("PAYMENT_SETTLED".equals(pref.get("statusId"))) {
- List<GenericValue> responses = pref.getRelated("PaymentGatewayResponse", UtilMisc.toMap("transCodeEnumId", "PGT_CAPTURE"), null, false);
+ List<GenericValue> responses = pref.getRelated("PaymentGatewayResponse", UtilMisc.toMap("transCodeEnumId", "PGT_CAPTURE"), null,
+ false);
for (GenericValue response : responses) {
BigDecimal amount = response.getBigDecimal("amount");
if (amount != null) {
@@ -1302,34 +1584,69 @@ public class OrderReadHelper {
return openAmount.compareTo(BigDecimal.ZERO) > 0 ? openAmount : BigDecimal.ZERO;
}
+ /**
+ * Gets order header adjustments.
+ * @return the order header adjustments
+ */
public List<GenericValue> getOrderHeaderAdjustments() {
return getOrderHeaderAdjustments(getAdjustments(), null);
}
+ /**
+ * Gets order header adjustments.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the order header adjustments
+ */
public List<GenericValue> getOrderHeaderAdjustments(String shipGroupSeqId) {
return getOrderHeaderAdjustments(getAdjustments(), shipGroupSeqId);
}
+ /**
+ * Gets order header adjustments tax.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the order header adjustments tax
+ */
public List<GenericValue> getOrderHeaderAdjustmentsTax(String shipGroupSeqId) {
return filterOrderAdjustments(getOrderHeaderAdjustments(getAdjustments(), shipGroupSeqId), false, true, false, false, false);
}
+ /**
+ * Gets order header adjustments to show.
+ * @return the order header adjustments to show
+ */
public List<GenericValue> getOrderHeaderAdjustmentsToShow() {
return filterOrderAdjustments(getOrderHeaderAdjustments(), true, false, false, false, false);
}
+ /**
+ * Gets order header statuses.
+ * @return the order header statuses
+ */
public List<GenericValue> getOrderHeaderStatuses() {
return getOrderHeaderStatuses(getOrderStatuses());
}
+ /**
+ * Gets order adjustments total.
+ * @return the order adjustments total
+ */
public BigDecimal getOrderAdjustmentsTotal() {
return getOrderAdjustmentsTotal(getValidOrderItems(), getAdjustments());
}
+ /**
+ * Gets order adjustment total.
+ * @param adjustment the adjustment
+ * @return the order adjustment total
+ */
public BigDecimal getOrderAdjustmentTotal(GenericValue adjustment) {
return calcOrderAdjustment(adjustment, getOrderItemsSubTotal());
}
+ /**
+ * Has survey int.
+ * @return the int
+ */
public int hasSurvey() {
Delegator delegator = orderHeader.getDelegator();
List<GenericValue> surveys = null;
@@ -1351,6 +1668,10 @@ public class OrderReadHelper {
// ========== Order Item Methods ==========
// ========================================
+ /**
+ * Gets order items.
+ * @return the order items
+ */
public List<GenericValue> getOrderItems() {
if (orderItems == null) {
try {
@@ -1362,6 +1683,10 @@ public class OrderReadHelper {
return orderItems;
}
+ /**
+ * Gets order item and ship group assoc.
+ * @return the order item and ship group assoc
+ */
public List<GenericValue> getOrderItemAndShipGroupAssoc() {
if (orderItemAndShipGrp == null) {
try {
@@ -1374,11 +1699,20 @@ public class OrderReadHelper {
return orderItemAndShipGrp;
}
+ /**
+ * Gets order item and ship group assoc.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the order item and ship group assoc
+ */
public List<GenericValue> getOrderItemAndShipGroupAssoc(String shipGroupSeqId) {
List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("shipGroupSeqId", EntityOperator.EQUALS, shipGroupSeqId));
return EntityUtil.filterByAnd(getOrderItemAndShipGroupAssoc(), exprs);
}
+ /**
+ * Gets valid order items.
+ * @return the valid order items
+ */
public List<GenericValue> getValidOrderItems() {
List<EntityExpr> exprs = UtilMisc.toList(
EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"),
@@ -1386,11 +1720,17 @@ public class OrderReadHelper {
return EntityUtil.filterByAnd(getOrderItems(), exprs);
}
+ /**
+ * Gets past eta order items.
+ * @param orderId the order id
+ * @return the past eta order items
+ */
public boolean getPastEtaOrderItems(String orderId) {
Delegator delegator = orderHeader.getDelegator();
GenericValue orderDeliverySchedule = null;
try {
- orderDeliverySchedule = EntityQuery.use(delegator).from("OrderDeliverySchedule").where("orderId", orderId, "orderItemSeqId", "_NA_").queryOne();
+ orderDeliverySchedule = EntityQuery.use(delegator).from("OrderDeliverySchedule").where("orderId", orderId, "orderItemSeqId", "_NA_")
+ .queryOne();
} catch (GenericEntityException e) {
if (Debug.infoOn()) {
Debug.logInfo(" OrderDeliverySchedule not found for order " + orderId, MODULE);
@@ -1404,6 +1744,10 @@ public class OrderReadHelper {
return estimatedShipDate != null && UtilDateTime.nowTimestamp().after(estimatedShipDate);
}
+ /**
+ * Gets rejected order items.
+ * @return the rejected order items
+ */
public boolean getRejectedOrderItems() {
List<GenericValue> items = getOrderItems();
for (GenericValue item : items) {
@@ -1425,6 +1769,10 @@ public class OrderReadHelper {
return false;
}
+ /**
+ * Gets partially received items.
+ * @return the partially received items
+ */
public boolean getPartiallyReceivedItems() {
List<GenericValue> items = getOrderItems();
for (GenericValue item : items) {
@@ -1438,7 +1786,7 @@ public class OrderReadHelper {
for (GenericValue rec : receipts) {
BigDecimal acceptedQuantity = rec.getBigDecimal("quantityAccepted");
BigDecimal orderedQuantity = (BigDecimal) item.get("quantity");
- if (acceptedQuantity.intValue() != orderedQuantity.intValue() && acceptedQuantity.intValue() > 0) {
+ if (acceptedQuantity.intValue() != orderedQuantity.intValue() && acceptedQuantity.intValue() > 0) {
return true;
}
}
@@ -1447,6 +1795,11 @@ public class OrderReadHelper {
return false;
}
+ /**
+ * Gets valid order items.
+ * @param shipGroupSeqId the ship group seq id
+ * @return the valid order items
+ */
public List<GenericValue> getValidOrderItems(String shipGroupSeqId) {
if (shipGroupSeqId == null) {
return getValidOrderItems();
@@ -1458,11 +1811,20 @@ public class OrderReadHelper {
return EntityUtil.filterByAnd(getOrderItemAndShipGroupAssoc(), exprs);
}
+ /**
+ * Gets order item.
+ * @param orderItemSeqId the order item seq id
+ * @return the order item
+ */
public GenericValue getOrderItem(String orderItemSeqId) {
List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderItemSeqId));
return EntityUtil.getFirst(EntityUtil.filterByAnd(getOrderItems(), exprs));
}
+ /**
+ * Gets valid digital items.
+ * @return the valid digital items
+ */
public List<GenericValue> getValidDigitalItems() {
List<GenericValue> digitalItems = new LinkedList<>();
// only approved or complete items apply
@@ -1536,10 +1898,20 @@ public class OrderReadHelper {
return digitalItems;
}
+ /**
+ * Gets order item adjustments.
+ * @param orderItem the order item
+ * @return the order item adjustments
+ */
public List<GenericValue> getOrderItemAdjustments(GenericValue orderItem) {
return getOrderItemAdjustmentList(orderItem, getAdjustments());
}
+ /**
+ * Gets current order item work effort.
+ * @param orderItem the order item
+ * @return the current order item work effort
+ */
public String getCurrentOrderItemWorkEffort(GenericValue orderItem) {
String orderItemSeqId = orderItem.getString("orderItemSeqId");
String orderId = orderItem.getString("orderId");
@@ -1562,6 +1934,11 @@ public class OrderReadHelper {
return null;
}
+ /**
+ * Gets current item status.
+ * @param orderItem the order item
+ * @return the current item status
+ */
public String getCurrentItemStatus(GenericValue orderItem) {
GenericValue statusItem = null;
try {
@@ -1575,6 +1952,11 @@ public class OrderReadHelper {
return statusItem.getString("description");
}
+ /**
+ * Gets order item price infos.
+ * @param orderItem the order item
+ * @return the order item price infos
+ */
public List<GenericValue> getOrderItemPriceInfos(GenericValue orderItem) {
if (orderItem == null) {
return null;
@@ -1594,19 +1976,30 @@ public class OrderReadHelper {
return EntityUtil.filterByAnd(this.orderItemPriceInfos, UtilMisc.toMap("orderItemSeqId", orderItemSeqId));
}
+ /**
+ * Gets order item ship group assocs.
+ * @param orderItem the order item
+ * @return the order item ship group assocs
+ */
public List<GenericValue> getOrderItemShipGroupAssocs(GenericValue orderItem) {
if (orderItem == null) {
return null;
}
try {
return orderHeader.getDelegator().findByAnd("OrderItemShipGroupAssoc",
- UtilMisc.toMap("orderId", orderItem.getString("orderId"), "orderItemSeqId", orderItem.getString("orderItemSeqId")), UtilMisc.toList("shipGroupSeqId"), false);
+ UtilMisc.toMap("orderId", orderItem.getString("orderId"), "orderItemSeqId", orderItem.getString("orderItemSeqId")),
+ UtilMisc.toList("shipGroupSeqId"), false);
} catch (GenericEntityException e) {
Debug.logWarning(e, MODULE);
}
return null;
}
+ /**
+ * Gets order item ship grp inv res list.
+ * @param orderItem the order item
+ * @return the order item ship grp inv res list
+ */
public List<GenericValue> getOrderItemShipGrpInvResList(GenericValue orderItem) {
if (orderItem == null) {
return null;
@@ -1623,10 +2016,21 @@ public class OrderReadHelper {
return EntityUtil.filterByAnd(orderItemShipGrpInvResList, UtilMisc.toMap("orderItemSeqId", orderItem.getString("orderItemSeqId")));
}
+ /**
+ * Gets order item issuances.
+ * @param orderItem the order item
+ * @return the order item issuances
+ */
public List<GenericValue> getOrderItemIssuances(GenericValue orderItem) {
return this.getOrderItemIssuances(orderItem, null);
}
+ /**
+ * Gets order item issuances.
+ * @param orderItem the order item
+ * @param shipmentId the shipment id
+ * @return the order item issuances
+ */
public List<GenericValue> getOrderItemIssuances(GenericValue orderItem, String shipmentId) {
if (orderItem == null) {
return null;
@@ -1650,7 +2054,9 @@ public class OrderReadHelper {
return EntityUtil.filterByAnd(orderItemIssuances, filter);
}
- /** Get a set of productIds in the order. */
+ /**
+ * Get a set of productIds in the order. @return the order product ids
+ */
public Collection<String> getOrderProductIds() {
Set<String> productIds = new HashSet<>();
for (GenericValue orderItem : getOrderItems()) {
@@ -1661,6 +2067,10 @@ public class OrderReadHelper {
return productIds;
}
+ /**
+ * Gets order return items.
+ * @return the order return items
+ */
public List<GenericValue> getOrderReturnItems() {
Delegator delegator = orderHeader.getDelegator();
if (this.orderReturnItems == null) {
@@ -1678,8 +2088,7 @@ public class OrderReadHelper {
* Get the quantity returned per order item.
* In other words, this method will count the ReturnItems
* related to each OrderItem.
- *
- * @return Map of returned quantities as BigDecimals keyed to the orderItemSeqId
+ * @return Map of returned quantities as BigDecimals keyed to the orderItemSeqId
*/
public Map<String, BigDecimal> getOrderItemReturnedQuantities() {
List<GenericValue> returnItems = getOrderReturnItems();
@@ -1709,6 +2118,7 @@ public class OrderReadHelper {
/**
* Get the total quantity of returned items for an order. This will count
* only the ReturnItems that are directly correlated to an OrderItem.
+ * @return the order returned quantity
*/
public BigDecimal getOrderReturnedQuantity() {
List<GenericValue> returnedItemsBase = getOrderReturnItems();
@@ -1742,6 +2152,9 @@ public class OrderReadHelper {
* Get the returned total by return type (credit, refund, etc.). Specify returnTypeId = null to get sum over all
* return types. Specify includeAll = true to sum up over all return statuses except cancelled. Specify includeAll
* = false to sum up over ACCEPTED, RECEIVED And COMPLETED returns.
+ * @param returnTypeId the return type id
+ * @param includeAll the include all
+ * @return the order returned total by type bd
*/
public BigDecimal getOrderReturnedTotalByTypeBd(String returnTypeId, boolean includeAll) {
List<GenericValue> returnedItemsBase = getOrderReturnItems();
@@ -1765,9 +2178,11 @@ public class OrderReadHelper {
List<String> returnHeaderList = new LinkedList<>();
for (GenericValue returnedItem : returnedItems) {
if ((returnedItem.get("returnPrice") != null) && (returnedItem.get("returnQuantity") != null)) {
- returnedAmount = returnedAmount.add(returnedItem.getBigDecimal("returnPrice").multiply(returnedItem.getBigDecimal("returnQuantity")).setScale(DECIMALS, ROUNDING));
+ returnedAmount = returnedAmount.add(returnedItem.getBigDecimal("returnPrice").multiply(returnedItem.getBigDecimal("returnQuantity"))
+ .setScale(DECIMALS, ROUNDING));
}
- Map<String, Object> itemAdjustmentCondition = UtilMisc.toMap("returnId", returnedItem.get("returnId"), "returnItemSeqId", returnedItem.get("returnItemSeqId"));
+ Map<String, Object> itemAdjustmentCondition = UtilMisc.toMap("returnId", returnedItem.get("returnId"), "returnItemSeqId",
+ returnedItem.get("returnItemSeqId"));
if (UtilValidate.isNotEmpty(returnTypeId)) {
itemAdjustmentCondition.put("returnTypeId", returnTypeId);
}
@@ -1778,23 +2193,31 @@ public class OrderReadHelper {
}
//get returnedAmount from returnHeader adjustments whose orderId must equals to current orderHeader.orderId
for (String returnId : returnHeaderList) {
- Map<String, Object> returnHeaderAdjFilter = UtilMisc.<String, Object>toMap("returnId", returnId, "returnItemSeqId", "_NA_", "returnTypeId", returnTypeId);
- returnedAmount =returnedAmount.add(getReturnAdjustmentTotal(orderHeader.getDelegator(), returnHeaderAdjFilter)).setScale(DECIMALS, ROUNDING);
+ Map<String, Object> returnHeaderAdjFilter = UtilMisc.<String, Object>toMap("returnId", returnId, "returnItemSeqId", "_NA_",
+ "returnTypeId", returnTypeId);
+ returnedAmount = returnedAmount.add(getReturnAdjustmentTotal(orderHeader.getDelegator(), returnHeaderAdjFilter))
+ .setScale(DECIMALS, ROUNDING);
}
return returnedAmount.setScale(DECIMALS, ROUNDING);
}
- /** Gets the total return credit for COMPLETED and RECEIVED returns. */
+ /**
+ * Gets the total return credit for COMPLETED and RECEIVED returns. @return the order returned credit total bd
+ */
public BigDecimal getOrderReturnedCreditTotalBd() {
return getOrderReturnedTotalByTypeBd("RTN_CREDIT", false);
}
- /** Gets the total return refunded for COMPLETED and RECEIVED returns. */
+ /**
+ * Gets the total return refunded for COMPLETED and RECEIVED returns. @return the order returned refund total bd
+ */
public BigDecimal getOrderReturnedRefundTotalBd() {
return getOrderReturnedTotalByTypeBd("RTN_REFUND", false);
}
- /** Gets the total return amount (all return types) for COMPLETED and RECEIVED returns. */
+ /**
+ * Gets the total return amount (all return types) for COMPLETED and RECEIVED returns. @return the order returned total
+ */
public BigDecimal getOrderReturnedTotal() {
return getOrderReturnedTotalByTypeBd(null, false);
}
@@ -1802,11 +2225,17 @@ public class OrderReadHelper {
/**
* Gets the total returned over all return types. Specify true to include all return statuses
* except cancelled. Specify false to include only COMPLETED and RECEIVED returns.
+ * @param includeAll the include all
+ * @return the order returned total
*/
public BigDecimal getOrderReturnedTotal(boolean includeAll) {
return getOrderReturnedTotalByTypeBd(null, includeAll);
}
+ /**
+ * Gets order non returned tax and shipping.
+ * @return the order non returned tax and shipping
+ */
public BigDecimal getOrderNonReturnedTaxAndShipping() {
// first make a Map of orderItemSeqId key, returnQuantity value
List<GenericValue> returnedItemsBase = getOrderReturnItems();
@@ -1878,8 +2307,11 @@ public class OrderReadHelper {
return totalTaxNotReturned.add(totalShippingNotReturned).add(orderTaxNotReturned).add(orderShippingNotReturned).setScale(DECIMALS, ROUNDING);
}
-
- /** Gets the total refunded to the order billing account by type. Specify null to get total over all types. */
+ /**
+ * Gets the total refunded to the order billing account by type. Specify null to get total over all types.
+ * @param returnTypeId the return type id
+ * @return the billing account returned total by type bd
+ */
public BigDecimal getBillingAccountReturnedTotalByTypeBd(String returnTypeId) {
BigDecimal returnedAmount = ZERO;
List<GenericValue> returnedItemsBase = getOrderReturnItems();
@@ -1912,26 +2344,40 @@ public class OrderReadHelper {
return returnedAmount;
}
- /** Get the total return credited to the order billing accounts */
+ /**
+ * Get the total return credited to the order billing accounts @return the billing account returned credit total bd
+ */
public BigDecimal getBillingAccountReturnedCreditTotalBd() {
return getBillingAccountReturnedTotalByTypeBd("RTN_CREDIT");
}
- /** Get the total return refunded to the order billing accounts */
+ /**
+ * Get the total return refunded to the order billing accounts @return the billing account returned refund total bd
+ */
public BigDecimal getBillingAccountReturnedRefundTotalBd() {
return getBillingAccountReturnedTotalByTypeBd("RTN_REFUND");
}
- /** Gets the total return credited amount with refunds and credits to the billing account figured in */
+ /**
+ * Gets the total return credited amount with refunds and credits to the billing account figured in @return the returned credit total with
+ * billing account bd
+ */
public BigDecimal getReturnedCreditTotalWithBillingAccountBd() {
return getOrderReturnedCreditTotalBd().add(getBillingAccountReturnedRefundTotalBd()).subtract(getBillingAccountReturnedCreditTotalBd());
}
- /** Gets the total return refund amount with refunds and credits to the billing account figured in */
+ /**
+ * Gets the total return refund amount with refunds and credits to the billing account figured in @return the returned refund total with billing
+ * account bd
+ */
public BigDecimal getReturnedRefundTotalWithBillingAccountBd() {
return getOrderReturnedRefundTotalBd().add(getBillingAccountReturnedCreditTotalBd()).subtract(getBillingAccountReturnedRefundTotalBd());
}
+ /**
+ * Gets order backorder quantity.
+ * @return the order backorder quantity
+ */
public BigDecimal getOrderBackorderQuantity() {
BigDecimal backorder = ZERO;
List<GenericValue> items = this.getValidOrderItems();
@@ -1951,6 +2397,11 @@ public class OrderReadHelper {
return backorder.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets item picked quantity bd.
+ * @param orderItem the order item
+ * @return the item picked quantity bd
+ */
public BigDecimal getItemPickedQuantityBd(GenericValue orderItem) {
BigDecimal quantityPicked = ZERO;
EntityConditionList<EntityExpr> pickedConditions = EntityCondition.makeCondition(UtilMisc.toList(
@@ -1978,6 +2429,11 @@ public class OrderReadHelper {
return quantityPicked.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets item shipped quantity.
+ * @param orderItem the order item
+ * @return the item shipped quantity
+ */
public BigDecimal getItemShippedQuantity(GenericValue orderItem) {
BigDecimal quantityShipped = ZERO;
List<GenericValue> issuance = getOrderItemIssuances(orderItem);
@@ -1997,6 +2453,12 @@ public class OrderReadHelper {
return quantityShipped.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets item ship group assoc shipped quantity.
+ * @param orderItem the order item
+ * @param shipGroupSeqId the ship group seq id
+ * @return the item ship group assoc shipped quantity
+ */
public BigDecimal getItemShipGroupAssocShippedQuantity(GenericValue orderItem, String shipGroupSeqId) {
BigDecimal quantityShipped = ZERO;
@@ -2006,7 +2468,8 @@ public class OrderReadHelper {
if (this.orderItemIssuances == null) {
Delegator delegator = orderItem.getDelegator();
try {
- orderItemIssuances = EntityQuery.use(delegator).from("ItemIssuance").where("orderId", orderItem.get("orderId"), "shipGroupSeqId", shipGroupSeqId).queryList();
+ orderItemIssuances = EntityQuery.use(delegator).from("ItemIssuance").where("orderId", orderItem.get("orderId"),
+ "shipGroupSeqId", shipGroupSeqId).queryList();
} catch (GenericEntityException e) {
Debug.logWarning(e, "Trouble getting ItemIssuance(s)", MODULE);
}
@@ -2031,6 +2494,11 @@ public class OrderReadHelper {
return quantityShipped.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets item reserved quantity.
+ * @param orderItem the order item
+ * @return the item reserved quantity
+ */
public BigDecimal getItemReservedQuantity(GenericValue orderItem) {
BigDecimal reserved = ZERO;
@@ -2046,6 +2514,11 @@ public class OrderReadHelper {
return reserved.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets item backordered quantity.
+ * @param orderItem the order item
+ * @return the item backordered quantity
+ */
public BigDecimal getItemBackorderedQuantity(GenericValue orderItem) {
BigDecimal backOrdered = ZERO;
@@ -2070,12 +2543,22 @@ public class OrderReadHelper {
return backOrdered;
}
+ /**
+ * Gets item pending shipment quantity.
+ * @param orderItem the order item
+ * @return the item pending shipment quantity
+ */
public BigDecimal getItemPendingShipmentQuantity(GenericValue orderItem) {
BigDecimal reservedQty = getItemReservedQuantity(orderItem);
BigDecimal backordered = getItemBackorderedQuantity(orderItem);
return reservedQty.subtract(backordered).setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets item canceled quantity.
+ * @param orderItem the order item
+ * @return the item canceled quantity
+ */
public BigDecimal getItemCanceledQuantity(GenericValue orderItem) {
BigDecimal cancelQty = orderItem.getBigDecimal("cancelQuantity");
if (cancelQty == null) {
@@ -2084,6 +2567,10 @@ public class OrderReadHelper {
return cancelQty;
}
+ /**
+ * Gets total order items quantity.
+ * @return the total order items quantity
+ */
public BigDecimal getTotalOrderItemsQuantity() {
List<GenericValue> orderItems = getValidOrderItems();
BigDecimal totalItems = ZERO;
@@ -2096,6 +2583,10 @@ public class OrderReadHelper {
return totalItems.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets total order items ordered quantity.
+ * @return the total order items ordered quantity
+ */
public BigDecimal getTotalOrderItemsOrderedQuantity() {
List<GenericValue> orderItems = getValidOrderItems();
BigDecimal totalItems = ZERO;
@@ -2108,42 +2599,94 @@ public class OrderReadHelper {
return totalItems;
}
+ /**
+ * Gets order items sub total.
+ * @return the order items sub total
+ */
public BigDecimal getOrderItemsSubTotal() {
return getOrderItemsSubTotal(getValidOrderItems(), getAdjustments());
}
+ /**
+ * Gets order item sub total.
+ * @param orderItem the order item
+ * @return the order item sub total
+ */
public BigDecimal getOrderItemSubTotal(GenericValue orderItem) {
return getOrderItemSubTotal(orderItem, getAdjustments());
}
+ /**
+ * Gets order items total.
+ * @return the order items total
+ */
public BigDecimal getOrderItemsTotal() {
return getOrderItemsTotal(getValidOrderItems(), getAdjustments());
}
+ /**
+ * Gets order item total.
+ * @param orderItem the order item
+ * @return the order item total
+ */
public BigDecimal getOrderItemTotal(GenericValue orderItem) {
return getOrderItemTotal(orderItem, getAdjustments());
}
+ /**
+ * Gets order item tax.
+ * @param orderItem the order item
+ * @return the order item tax
+ */
public BigDecimal getOrderItemTax(GenericValue orderItem) {
return getOrderItemAdjustmentsTotal(orderItem, false, true, false);
}
+ /**
+ * Gets order item shipping.
+ * @param orderItem the order item
+ * @return the order item shipping
+ */
public BigDecimal getOrderItemShipping(GenericValue orderItem) {
return getOrderItemAdjustmentsTotal(orderItem, false, false, true);
}
+ /**
+ * Gets order item adjustments total.
+ * @param orderItem the order item
+ * @param includeOther the include other
+ * @param includeTax the include tax
+ * @param includeShipping the include shipping
+ * @return the order item adjustments total
+ */
public BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem, boolean includeOther, boolean includeTax, boolean includeShipping) {
return getOrderItemAdjustmentsTotal(orderItem, getAdjustments(), includeOther, includeTax, includeShipping);
}
+ /**
+ * Gets order item adjustments total.
+ * @param orderItem the order item
+ * @return the order item adjustments total
+ */
public BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem) {
return getOrderItemAdjustmentsTotal(orderItem, true, false, false);
}
+ /**
+ * Gets order item adjustment total.
+ * @param orderItem the order item
+ * @param adjustment the adjustment
+ * @return the order item adjustment total
+ */
public BigDecimal getOrderItemAdjustmentTotal(GenericValue orderItem, GenericValue adjustment) {
return calcItemAdjustment(adjustment, orderItem);
}
+ /**
+ * Gets adjustment type.
+ * @param adjustment the adjustment
+ * @return the adjustment type
+ */
public String getAdjustmentType(GenericValue adjustment) {
GenericValue adjustmentType = null;
try {
@@ -2157,10 +2700,20 @@ public class OrderReadHelper {
return adjustmentType.getString("description");
}
+ /**
+ * Gets order item statuses.
+ * @param orderItem the order item
+ * @return the order item statuses
+ */
public List<GenericValue> getOrderItemStatuses(GenericValue orderItem) {
return getOrderItemStatuses(orderItem, getOrderStatuses());
}
+ /**
+ * Gets current item status string.
+ * @param orderItem the order item
+ * @return the current item status string
+ */
public String getCurrentItemStatusString(GenericValue orderItem) {
GenericValue statusItem = null;
try {
@@ -2174,16 +2727,24 @@ public class OrderReadHelper {
return orderHeader.getString("statusId");
}
- /** Fetches the set of order items with the given EntityCondition. */
+ /**
+ * Fetches the set of order items with the given EntityCondition. @param entityCondition the entity condition
+ * @return the order items by condition
+ */
public List<GenericValue> getOrderItemsByCondition(EntityCondition entityCondition) {
return EntityUtil.filterByCondition(getOrderItems(), entityCondition);
}
+ /**
+ * Gets product promo codes entered.
+ * @return the product promo codes entered
+ */
public Set<String> getProductPromoCodesEntered() {
Delegator delegator = orderHeader.getDelegator();
Set<String> productPromoCodesEntered = new HashSet<>();
try {
- for (GenericValue orderProductPromoCode: EntityQuery.use(delegator).from("OrderProductPromoCode").where("orderId", orderHeader.get("orderId")).cache().queryList()) {
+ for (GenericValue orderProductPromoCode: EntityQuery.use(delegator).from("OrderProductPromoCode")
+ .where("orderId", orderHeader.get("orderId")).cache().queryList()) {
productPromoCodesEntered.add(orderProductPromoCode.getString("productPromoCodeId"));
}
} catch (GenericEntityException e) {
@@ -2192,6 +2753,10 @@ public class OrderReadHelper {
return productPromoCodesEntered;
}
+ /**
+ * Gets product promo use.
+ * @return the product promo use
+ */
public List<GenericValue> getProductPromoUse() {
Delegator delegator = orderHeader.getDelegator();
try {
@@ -2204,6 +2769,7 @@ public class OrderReadHelper {
/**
* Checks to see if this user has read permission on this order
+ * @param security the security
* @param userLogin The UserLogin value object to check
* @return boolean True if we have read permission
*/
@@ -2223,6 +2789,12 @@ public class OrderReadHelper {
// =================== Static Methods ===================
// ======================================================
+ /**
+ * Gets order header.
+ * @param delegator the delegator
+ * @param orderId the order id
+ * @return the order header
+ */
public static GenericValue getOrderHeader(Delegator delegator, String orderId) {
GenericValue orderHeader = null;
if (orderId != null && delegator != null) {
@@ -2235,6 +2807,11 @@ public class OrderReadHelper {
return orderHeader;
}
+ /**
+ * Gets order item quantity.
+ * @param orderItem the order item
+ * @return the order item quantity
+ */
public static BigDecimal getOrderItemQuantity(GenericValue orderItem) {
BigDecimal cancelQty = orderItem.getBigDecimal("cancelQuantity");
@@ -2250,6 +2827,11 @@ public class OrderReadHelper {
return orderQty.subtract(cancelQty);
}
+ /**
+ * Gets order item ship group quantity.
+ * @param shipGroupAssoc the ship group assoc
+ * @return the order item ship group quantity
+ */
public static BigDecimal getOrderItemShipGroupQuantity(GenericValue shipGroupAssoc) {
BigDecimal cancelQty = shipGroupAssoc.getBigDecimal("cancelQuantity");
BigDecimal orderQty = shipGroupAssoc.getBigDecimal("quantity");
@@ -2264,6 +2846,12 @@ public class OrderReadHelper {
return orderQty.subtract(cancelQty);
}
+ /**
+ * Gets product store from order.
+ * @param delegator the delegator
+ * @param orderId the order id
+ * @return the product store from order
+ */
public static GenericValue getProductStoreFromOrder(Delegator delegator, String orderId) {
GenericValue orderHeader = getOrderHeader(delegator, orderId);
if (orderHeader == null) {
@@ -2272,6 +2860,11 @@ public class OrderReadHelper {
return getProductStoreFromOrder(orderHeader);
}
+ /**
+ * Gets product store from order.
+ * @param orderHeader the order header
+ * @return the product store from order
+ */
public static GenericValue getProductStoreFromOrder(GenericValue orderHeader) {
if (orderHeader == null) {
return null;
@@ -2280,7 +2873,8 @@ public class OrderReadHelper {
GenericValue productStore = null;
if (orderHeader.get("productStoreId") != null) {
try {
- productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", orderHeader.getString("productStoreId")).cache().queryOne();
+ productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId",
+ orderHeader.getString("productStoreId")).cache().queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, "Cannot locate ProductStore from OrderHeader", MODULE);
}
@@ -2290,19 +2884,33 @@ public class OrderReadHelper {
return productStore;
}
+ /**
+ * Gets order grand total.
+ * @param orderItems the order items
+ * @param adjustments the adjustments
+ * @return the order grand total
+ */
public static BigDecimal getOrderGrandTotal(List<GenericValue> orderItems, List<GenericValue> adjustments) {
Map<String, Object> orderTaxByTaxAuthGeoAndParty = getOrderTaxByTaxAuthGeoAndParty(adjustments);
BigDecimal taxGrandTotal = (BigDecimal) orderTaxByTaxAuthGeoAndParty.get("taxGrandTotal");
- adjustments = EntityUtil.filterByAnd(adjustments, UtilMisc.toList(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.NOT_EQUAL, "SALES_TAX")));
+ adjustments = EntityUtil.filterByAnd(adjustments, UtilMisc.toList(EntityCondition.makeCondition("orderAdjustmentTypeId",
+ EntityOperator.NOT_EQUAL, "SALES_TAX")));
BigDecimal total = getOrderItemsTotal(orderItems, adjustments);
BigDecimal adj = getOrderAdjustmentsTotal(orderItems, adjustments);
total = ((total.add(taxGrandTotal)).add(adj)).setScale(DECIMALS, ROUNDING);
return total;
}
+ /**
+ * Gets order header adjustments.
+ * @param adjustments the adjustments
+ * @param shipGroupSeqId the ship group seq id
+ * @return the order header adjustments
+ */
public static List<GenericValue> getOrderHeaderAdjustments(List<GenericValue> adjustments, String shipGroupSeqId) {
List<EntityExpr> contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null));
- List<EntityExpr> contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA));
+ List<EntityExpr> contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS,
+ DataModelConstants.SEQ_ID_NA));
List<EntityExpr> contraints3 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, ""));
List<EntityExpr> contraints4 = new LinkedList<>();
if (shipGroupSeqId != null) {
@@ -2323,6 +2931,11 @@ public class OrderReadHelper {
return adj;
}
+ /**
+ * Gets order header statuses.
+ * @param orderStatuses the order statuses
+ * @return the order header statuses
+ */
public static List<GenericValue> getOrderHeaderStatuses(List<GenericValue> orderStatuses) {
List<EntityExpr> contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null));
contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA));
@@ -2337,10 +2950,21 @@ public class OrderReadHelper {
return EntityUtil.orderBy(EntityUtil.filterByOr(newOrderStatuses, contraints2), UtilMisc.toList("-statusDatetime"));
}
+ /**
+ * Gets order adjustments total.
+ * @param orderItems the order items
+ * @param adjustments the adjustments
+ * @return the order adjustments total
+ */
public static BigDecimal getOrderAdjustmentsTotal(List<GenericValue> orderItems, List<GenericValue> adjustments) {
return calcOrderAdjustments(getOrderHeaderAdjustments(adjustments, null), getOrderItemsSubTotal(orderItems, adjustments), true, true, true);
}
+ /**
+ * Gets order survey responses.
+ * @param orderHeader the order header
+ * @return the order survey responses
+ */
public static List<GenericValue> getOrderSurveyResponses(GenericValue orderHeader) {
Delegator delegator = orderHeader.getDelegator();
String orderId = orderHeader.getString("orderId");
@@ -2357,6 +2981,11 @@ public class OrderReadHelper {
return responses;
}
+ /**
+ * Gets order item survey response.
+ * @param orderItem the order item
+ * @return the order item survey response
+ */
public static List<GenericValue> getOrderItemSurveyResponse(GenericValue orderItem) {
Delegator delegator = orderItem.getDelegator();
String orderItemSeqId = orderItem.getString("orderItemSeqId");
@@ -2376,7 +3005,17 @@ public class OrderReadHelper {
// ================= Order Adjustments =================
- public static BigDecimal calcOrderAdjustments(List<GenericValue> orderHeaderAdjustments, BigDecimal subTotal, boolean includeOther, boolean includeTax, boolean includeShipping) {
+ /**
+ * Calc order adjustments big decimal.
+ * @param orderHeaderAdjustments the order header adjustments
+ * @param subTotal the sub total
+ * @param includeOther the include other
+ * @param includeTax the include tax
+ * @param includeShipping the include shipping
+ * @return the big decimal
+ */
+ public static BigDecimal calcOrderAdjustments(List<GenericValue> orderHeaderAdjustments, BigDecimal subTotal, boolean includeOther,
+ boolean includeTax, boolean includeShipping) {
BigDecimal adjTotal = ZERO;
if (UtilValidate.isNotEmpty(orderHeaderAdjustments)) {
@@ -2388,6 +3027,12 @@ public class OrderReadHelper {
return adjTotal.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Calc order adjustment big decimal.
+ * @param orderAdjustment the order adjustment
+ * @param orderSubTotal the order sub total
+ * @return the big decimal
+ */
public static BigDecimal calcOrderAdjustment(GenericValue orderAdjustment, BigDecimal orderSubTotal) {
BigDecimal adjustment = ZERO;
@@ -2405,11 +3050,24 @@ public class OrderReadHelper {
return adjustment.setScale(DECIMALS, ROUNDING);
}
- // ================= Order Item Adjustments =================
+ /**
+ * Gets order items sub total.
+ * @param orderItems the order items
+ * @param adjustments the adjustments
+ * @return the order items sub total
+ */
+// ================= Order Item Adjustments =================
public static BigDecimal getOrderItemsSubTotal(List<GenericValue> orderItems, List<GenericValue> adjustments) {
return getOrderItemsSubTotal(orderItems, adjustments, null);
}
+ /**
+ * Gets order items sub total.
+ * @param orderItems the order items
+ * @param adjustments the adjustments
+ * @param workEfforts the work efforts
+ * @return the order items sub total
+ */
public static BigDecimal getOrderItemsSubTotal(List<GenericValue> orderItems, List<GenericValue> adjustments, List<GenericValue> workEfforts) {
BigDecimal result = ZERO;
Iterator<GenericValue> itemIter = UtilMisc.toIterator(orderItems);
@@ -2434,12 +3092,22 @@ public class OrderReadHelper {
return result.setScale(DECIMALS, ROUNDING);
}
- /** The passed adjustments can be all adjustments for the order, ie for all line items */
+ /**
+ * The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
+ * @param adjustments the adjustments
+ * @return the order item sub total
+ */
public static BigDecimal getOrderItemSubTotal(GenericValue orderItem, List<GenericValue> adjustments) {
return getOrderItemSubTotal(orderItem, adjustments, false, false);
}
- /** The passed adjustments can be all adjustments for the order, ie for all line items */
+ /**
+ * The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
+ * @param adjustments the adjustments
+ * @param forTax the for tax
+ * @param forShipping the for shipping
+ * @return the order item sub total
+ */
public static BigDecimal getOrderItemSubTotal(GenericValue orderItem, List<GenericValue> adjustments, boolean forTax, boolean forShipping) {
BigDecimal unitPrice = orderItem.getBigDecimal("unitPrice");
BigDecimal quantity = getOrderItemQuantity(orderItem);
@@ -2457,17 +3125,18 @@ public class OrderReadHelper {
// retrieve related work effort when required.
List<GenericValue> workOrderItemFulfillments = null;
try {
- workOrderItemFulfillments = orderItem.getDelegator().findByAnd("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", orderItem.getString("orderId"), "orderItemSeqId", orderItem.getString("orderItemSeqId")), null, true);
+ workOrderItemFulfillments = orderItem.getDelegator().findByAnd("WorkOrderItemFulfillment", UtilMisc.toMap("orderId",
+ orderItem.getString("orderId"), "orderItemSeqId", orderItem.getString("orderItemSeqId")), null, true);
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
}
if (workOrderItemFulfillments != null) {
Iterator<GenericValue> iter = workOrderItemFulfillments.iterator();
if (iter.hasNext()) {
- GenericValue WorkOrderItemFulfillment = iter.next();
+ GenericValue workOrderItemFulfillment = iter.next();
GenericValue workEffort = null;
try {
- workEffort = WorkOrderItemFulfillment.getRelatedOne("WorkEffort", true);
+ workEffort = workOrderItemFulfillment.getRelatedOne("WorkEffort", true);
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
}
@@ -2483,6 +3152,12 @@ public class OrderReadHelper {
return result.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets order items total.
+ * @param orderItems the order items
+ * @param adjustments the adjustments
+ * @return the order items total
+ */
public static BigDecimal getOrderItemsTotal(List<GenericValue> orderItems, List<GenericValue> adjustments) {
BigDecimal result = ZERO;
Iterator<GenericValue> itemIter = UtilMisc.toIterator(orderItems);
@@ -2493,15 +3168,27 @@ public class OrderReadHelper {
return result.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets order item total.
+ * @param orderItem the order item
+ * @param adjustments the adjustments
+ * @return the order item total
+ */
public static BigDecimal getOrderItemTotal(GenericValue orderItem, List<GenericValue> adjustments) {
// add tax and shipping to subtotal
return getOrderItemSubTotal(orderItem, adjustments).add(getOrderItemAdjustmentsTotal(orderItem, adjustments, false, true, true));
}
+ /**
+ * Calc order promo adjustments bd big decimal.
+ * @param allOrderAdjustments the all order adjustments
+ * @return the big decimal
+ */
public static BigDecimal calcOrderPromoAdjustmentsBd(List<GenericValue> allOrderAdjustments) {
BigDecimal promoAdjTotal = ZERO;
- List<GenericValue> promoAdjustments = EntityUtil.filterByAnd(allOrderAdjustments, UtilMisc.toMap("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT"));
+ List<GenericValue> promoAdjustments = EntityUtil.filterByAnd(allOrderAdjustments, UtilMisc.toMap("orderAdjustmentTypeId",
+ "PROMOTION_ADJUSTMENT"));
if (UtilValidate.isNotEmpty(promoAdjustments)) {
Iterator<GenericValue> promoAdjIter = promoAdjustments.iterator();
@@ -2516,14 +3203,25 @@ public class OrderReadHelper {
return promoAdjTotal.setScale(DECIMALS, ROUNDING);
}
+ /**
+ * Gets work effort rental length.
+ * @param workEffort the work effort
+ * @return the work effort rental length
+ */
public static BigDecimal getWorkEffortRentalLength(GenericValue workEffort) {
BigDecimal length = null;
if (workEffort.get("estimatedStartDate") != null && workEffort.get("estimatedCompletionDate") != null) {
- length = new BigDecimal(UtilDateTime.getInterval(workEffort.getTimestamp("estimatedStartDate"), workEffort.getTimestamp("estimatedCompletionDate"))/86400000);
+ length = new BigDecimal(UtilDateTime.getInterval(workEffort.getTimestamp("estimatedStartDate"),
+ workEffort.getTimestamp("estimatedCompletionDate")) / 86400000);
}
return length;
}
+ /**
+ * Gets work effort rental quantity.
+ * @param workEffort the work effort
+ * @return the work effort rental quantity
+ */
public static BigDecimal getWorkEffortRentalQuantity(GenericValue workEffort) {
BigDecimal persons = BigDecimal.ONE;
if (workEffort.get("reservPersons") != null) {
@@ -2539,7 +3237,8 @@ public class OrderReadHelper {
}
long length = 1;
if (workEffort.get("estimatedStartDate") != null && workEffort.get("estimatedCompletionDate") != null) {
- length = (workEffort.getTimestamp("estimatedCompletionDate").getTime() - workEffort.getTimestamp("estimatedStartDate").getTime()) / 86400000;
+ length = (workEffort.getTimestamp("estimatedCompletionDate").getTime() - workEffort.getTimestamp("estimatedStartDate").getTime())
+ / 86400000;
}
BigDecimal rentalAdjustment = ZERO;
@@ -2562,7 +3261,17 @@ public class OrderReadHelper {
return rentalAdjustment; // return total rental adjustment
}
- public static BigDecimal getAllOrderItemsAdjustmentsTotal(List<GenericValue> orderItems, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping) {
+ /**
+ * Gets all order items adjustments total.
+ * @param orderItems the order items
+ * @param adjustments the adjustments
+ * @param includeOther the include other
+ * @param includeTax the include tax
+ * @param includeShipping the include shipping
+ * @return the all order items adjustments total
+ */
+ public static BigDecimal getAllOrderItemsAdjustmentsTotal(List<GenericValue> orderItems, List<GenericValue> adjustments, boolean includeOther,
+ boolean includeTax, boolean includeShipping) {
BigDecimal result = ZERO;
Iterator<GenericValue> itemIter = UtilMisc.toIterator(orderItems);
@@ -2572,22 +3281,52 @@ public class OrderReadHelper {
return result.setScale(DECIMALS, ROUNDING);
}
- /** The passed adjustments can be all adjustments for the order, ie for all line items */
- public static BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping) {
+ /**
+ * The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
+ * @param adjustments the adjustments
+ * @param includeOther the include other
+ * @param includeTax the include tax
+ * @param includeShipping the include shipping
+ * @return the order item adjustments total
+ */
+ public static BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem, List<GenericValue> adjustments, boolean includeOther,
+ boolean includeTax, boolean includeShipping) {
return getOrderItemAdjustmentsTotal(orderItem, adjustments, includeOther, includeTax, includeShipping, false, false);
}
- /** The passed adjustments can be all adjustments for the order, ie for all line items */
- public static BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) {
+ /**
+ * The passed adjustments can be all adjustments for the order, ie for all line items @param orderItem the order item
+ * @param adjustments the adjustments
+ * @param includeOther the include other
+ * @param includeTax the include tax
+ * @param includeShipping the include shipping
+ * @param forTax the for tax
+ * @param forShipping the for shipping
+ * @return the order item adjustments total
+ */
+ public static BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem, List<GenericValue> adjustments, boolean includeOther,
+ boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) {
return calcItemAdjustments(getOrderItemQuantity(orderItem), orderItem.getBigDecimal("unitPrice"),
getOrderItemAdjustmentList(orderItem, adjustments),
includeOther, includeTax, includeShipping, forTax, forShipping);
}
+ /**
+ * Gets order item adjustment list.
+ * @param orderItem the order item
+ * @param adjustments the adjustments
+ * @return the order item adjustment list
+ */
public static List<GenericValue> getOrderItemAdjustmentList(GenericValue orderItem, List<GenericValue> adjustments) {
return EntityUtil.filterByAnd(adjustments, UtilMisc.toMap("orderItemSeqId", orderItem.get("orderItemSeqId")));
}
+ /**
+ * Gets order item statuses.
+ * @param orderItem the order item
+ * @param orderStatuses the order statuses
+ * @return the order item statuses
+ */
public static List<GenericValue> getOrderItemStatuses(GenericValue orderItem, List<GenericValue> orderStatuses) {
List<EntityExpr> contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderItem.get("orderItemSeqId")));
List<EntityExpr> contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null));
@@ -2602,7 +3341,20 @@ public class OrderReadHelper {
// Order Item Adjs Utility Methods
- public static BigDecimal calcItemAdjustments(BigDecimal quantity, BigDecimal unitPrice, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) {
+ /**
+ * Calc item adjustments big decimal.
+ * @param quantity the quantity
+ * @param unitPrice the unit price
+ * @param adjustments the adjustments
+ * @param includeOther the include other
+ * @param includeTax the include tax
+ * @param includeShipping the include shipping
+ * @param forTax the for tax
+ * @param forShipping the for shipping
+ * @return the big decimal
+ */
+ public static BigDecimal calcItemAdjustments(BigDecimal quantity, BigDecimal unitPrice, List<GenericValue> adjustments, boolean includeOther,
+ boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) {
BigDecimal adjTotal = ZERO;
if (UtilValidate.isNotEmpty(adjustments)) {
@@ -2614,49 +3366,102 @@ public class OrderReadHelper {
return adjTotal;
}
- public static BigDecimal calcItemAdjustmentsRecurringBd(BigDecimal quantity, BigDecimal unitPrice, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) {
+ /**
+ * Calc item adjustments recurring bd big decimal.
+ * @param quantity the quantity
+ * @param unitPrice the unit price
+ * @param adjustments the adjustments
+ * @param includeOther the include other
+ * @param includeTax the include tax
+ * @param includeShipping the include shipping
+ * @param forTax the for tax
+ * @param forShipping the for shipping
+ * @return the big decimal
+ */
+ public static BigDecimal calcItemAdjustmentsRecurringBd(BigDecimal quantity, BigDecimal unitPrice, List<GenericValue> adjustments,
+ boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) {
BigDecimal adjTotal = ZERO;
if (UtilValidate.isNotEmpty(adjustments)) {
List<GenericValue> filteredAdjs = filterOrderAdjustments(adjustments, includeOther, includeTax, includeShipping, forTax, forShipping);
for (GenericValue orderAdjustment : filteredAdjs) {
- adjTotal = adjTotal.add(OrderReadHelper.calcItemAdjustmentRecurringBd(orderAdjustment, quantity, unitPrice)).setScale(DECIMALS, ROUNDING);
+ adjTotal = adjTotal.add(OrderReadHelper.calcItemAdjustmentRecurringBd(orderAdjustment, quantity, unitPrice))
+ .setScale(DECIMALS, ROUNDING);
}
}
return adjTotal;
}
+ /**
+ * Calc item adjustment big decimal.
+ * @param itemAdjustment the item adjustment
+ * @param item the item
+ * @return the big decimal
+ */
public static BigDecimal calcItemAdjustment(GenericValue itemAdjustment, GenericValue item) {
return calcItemAdjustment(itemAdjustment, getOrderItemQuantity(item), item.getBigDecimal("unitPrice"));
}
+ /**
+ * Calc item adjustment big decimal.
+ * @param itemAdjustment the item adjustment
+ * @param quantity the quantity
+ * @param unitPrice the unit price
+ * @return the big decimal
+ */
public static BigDecimal calcItemAdjustment(GenericValue itemAdjustment, BigDecimal quantity, BigDecimal unitPrice) {
BigDecimal adjustment = ZERO;
if (itemAdjustment.get("amount") != null) {
- //shouldn't round amounts here, wait until item total is added up otherwise incremental errors are introduced, and there is code that calls this method that does that already: adjustment = adjustment.add(setScaleByType("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")), itemAdjustment.getBigDecimal("amount")));
+ // shouldn't round amounts here, wait until item total is added up otherwise incremental errors are introduced, and there is code that
+ // calls this method that does that already: adjustment =
+ // adjustment.add(setScaleByType("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")),
+ // itemAdjustment.getBigDecimal("amount")));
adjustment = adjustment.add(itemAdjustment.getBigDecimal("amount"));
} else if (itemAdjustment.get("sourcePercentage") != null) {
- // see comment above about ROUNDING: adjustment = adjustment.add(setScaleByType("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")), itemAdjustment.getBigDecimal("sourcePercentage").multiply(quantity).multiply(unitPrice).multiply(PERCENTAGE)));
+ // see comment above about ROUNDING: adjustment =
+ // adjustment.add(setScaleByType("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")),
+ // itemAdjustment.getBigDecimal("sourcePercentage").multiply(quantity).multiply(unitPrice).multiply(PERCENTAGE)));
adjustment = adjustment.add(itemAdjustment.getBigDecimal("sourcePercentage").multiply(quantity).multiply(unitPrice).multiply(PERCENTAGE));
}
if (Debug.verboseOn()) {
- Debug.logVerbose("calcItemAdjustment: " + itemAdjustment + ", quantity=" + quantity + ", unitPrice=" + unitPrice + ", adjustment=" + adjustment, MODULE);
+ Debug.logVerbose("calcItemAdjustment: " + itemAdjustment + ", quantity=" + quantity + ", unitPrice=" + unitPrice + ", adjustment="
+ + adjustment, MODULE);
}
return adjustment;
}
+ /**
+ * Calc item adjustment recurring bd big decimal.
+ * @param itemAdjustment the item adjustment
+ * @param quantity the quantity
+ * @param unitPrice the unit price
+ * @return the big decimal
+ */
public static BigDecimal calcItemAdjustmentRecurringBd(GenericValue itemAdjustment, BigDecimal quantity, BigDecimal unitPrice) {
BigDecimal adjustmentRecurring = ZERO;
if (itemAdjustment.get("recurringAmount") != null) {
- adjustmentRecurring = adjustmentRecurring.add(setScaleByType("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")), itemAdjustment.getBigDecimal("recurringAmount")));
+ adjustmentRecurring = adjustmentRecurring.add(setScaleByType("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")),
+ itemAdjustment.getBigDecimal("recurringAmount")));
}
if (Debug.verboseOn()) {
- Debug.logVerbose("calcItemAdjustmentRecurring: " + itemAdjustment + ", quantity=" + quantity + ", unitPrice=" + unitPrice + ", adjustmentRecurring=" + adjustmentRecurring, MODULE);
+ Debug.logVerbose("calcItemAdjustmentRecurring: " + itemAdjustment + ", quantity=" + quantity + ", unitPrice=" + unitPrice
+ + ", adjustmentRecurring=" + adjustmentRecurring, MODULE);
}
return adjustmentRecurring.setScale(DECIMALS, ROUNDING);
}
- public static List<GenericValue> filterOrderAdjustments(List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) {
+ /**
+ * Filter order adjustments list.
+ * @param adjustments the adjustments
+ * @param includeOther the include other
+ * @param includeTax the include tax
+ * @param includeShipping the include shipping
+ * @param forTax the for tax
+ * @param forShipping the for shipping
+ * @return the list
+ */
+ public static List<GenericValue> filterOrderAdjustments(List<GenericValue> adjustments, boolean includeOther, boolean includeTax,
+ boolean includeShipping, boolean forTax, boolean forShipping) {
List<GenericValue> newOrderAdjustmentsList = new LinkedList<>();
if (UtilValidate.isNotEmpty(adjustments)) {
@@ -2679,12 +3484,14 @@ public class OrderReadHelper {
}
}
- // default to yes, include for shipping; so only exclude if includeInShipping is N, or false; if Y or null or anything else it will be included
+ // default to yes, include for shipping; so only exclude if includeInShipping is N, or false;
+ // if Y or null or anything else it will be included
if (forTax && "N".equals(orderAdjustment.getString("includeInTax"))) {
includeAdjustment = false;
}
- // default to yes, include for shipping; so only exclude if includeInShipping is N, or false; if Y or null or anything else it will be included
+ // default to yes, include for shipping; so only exclude if includeInShipping is N, or false;
+ // if Y or null or anything else it will be included
if (forShipping && "N".equals(orderAdjustment.getString("includeInShipping"))) {
includeAdjustment = false;
}
@@ -2697,6 +3504,12 @@ public class OrderReadHelper {
return newOrderAdjustmentsList;
}
+ /**
+ * Gets quantity on order.
+ * @param delegator the delegator
+ * @param productId the product id
+ * @return the quantity on order
+ */
public static BigDecimal getQuantityOnOrder(Delegator delegator, String productId) {
BigDecimal quantity = BigDecimal.ZERO;
@@ -2729,7 +3542,8 @@ public class OrderReadHelper {
/**
* Checks to see if this user has read permission on the specified order
- * @param userLogin The UserLogin value object to check
+ * @param security the security
+ * @param userLogin The UserLogin value object to check
* @param orderHeader The OrderHeader for the specified order
* @return boolean True if we have read permission
*/
@@ -2757,6 +3571,11 @@ public class OrderReadHelper {
return false;
}
+ /**
+ * Gets helper.
+ * @param orderHeader the order header
+ * @return the helper
+ */
public static OrderReadHelper getHelper(GenericValue orderHeader) {
return new OrderReadHelper(orderHeader);
}
@@ -2798,7 +3617,8 @@ public class OrderReadHelper {
adjustments = EntityQuery.use(delegator).from("ReturnAdjustment").where(condition).queryList();
if (adjustments != null) {
for (GenericValue returnAdjustment : adjustments) {
- total = total.add(setScaleByType("RET_SALES_TAX_ADJ".equals(returnAdjustment.get("returnAdjustmentTypeId")), returnAdjustment.getBigDecimal("amount")));
+ total = total.add(setScaleByType("RET_SALES_TAX_ADJ".equals(returnAdjustment.get("returnAdjustmentTypeId")),
+ returnAdjustment.getBigDecimal("amount")));
}
}
} catch (GenericEntityException e) {
@@ -2807,12 +3627,21 @@ public class OrderReadHelper {
return total;
}
- // little helper method to set the DECIMALS according to tax type
+ /**
+ * Sets scale by type.
+ * @param isTax the is tax
+ * @param value the value
+ * @return the scale by type
+ */
+// little helper method to set the DECIMALS according to tax type
public static BigDecimal setScaleByType(boolean isTax, BigDecimal value) {
return isTax ? value.setScale(TAX_SCALE, TAX_ROUNDING) : value.setScale(DECIMALS, ROUNDING);
}
- /** Get the quantity of order items that have been invoiced */
+ /**
+ * Get the quantity of order items that have been invoiced @param orderItem the order item
+ * @return the order item invoiced quantity
+ */
public static BigDecimal getOrderItemInvoicedQuantity(GenericValue orderItem) {
BigDecimal invoiced = BigDecimal.ZERO;
try {
@@ -2830,10 +3659,19 @@ public class OrderReadHelper {
return invoiced;
}
+ /**
+ * Gets order payment statuses.
+ * @return the order payment statuses
+ */
public List<GenericValue> getOrderPaymentStatuses() {
return getOrderPaymentStatuses(getOrderStatuses());
}
+ /**
+ * Gets order payment statuses.
+ * @param orderStatuses the order statuses
+ * @return the order payment statuses
+ */
public static List<GenericValue> getOrderPaymentStatuses(List<GenericValue> orderStatuses) {
List<EntityExpr> contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null));
contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA));
@@ -2851,9 +3689,9 @@ public class OrderReadHelper {
* all OrderItemAttributes related to the orderHeader are load on local cache
* to optimize database call, after we just filter the cache with attributeName and
* orderItemSeqId wanted.
- * @param orderItemSeqId
- * @param attributeName
- * @return
+ * @param orderItemSeqId the order item seq id
+ * @param attributeName the attribute name
+ * @return order item attribute
*/
public String getOrderItemAttribute(String orderItemSeqId, String attributeName) {
GenericValue orderItemAttribute = null;
@@ -2875,11 +3713,18 @@ public class OrderReadHelper {
return orderItemAttribute != null ? orderItemAttribute.getString("attrValue"): null;
}
+ /**
+ * Gets order item attribute.
+ * @param orderItem the order item
+ * @param attributeName the attribute name
+ * @return the order item attribute
+ */
public static String getOrderItemAttribute(GenericValue orderItem, String attributeName) {
String attributeValue = null;
if (orderItem != null) {
try {
- GenericValue orderItemAttribute = EntityUtil.getFirst(orderItem.getRelated("OrderItemAttribute", UtilMisc.toMap("attrName", attributeName), null, false));
+ GenericValue orderItemAttribute = EntityUtil.getFirst(orderItem.getRelated("OrderItemAttribute",
+ UtilMisc.toMap("attrName", attributeName), null, false));
if (orderItemAttribute != null) {
attributeValue = orderItemAttribute.getString("attrValue");
}
@@ -2894,8 +3739,8 @@ public class OrderReadHelper {
* When you call this function after a OrderReadHelper instantiation
* all OrderAttributes related to the orderHeader are load on local cache
* to optimize database call, after we just filter the cache with attributeName wanted.
- * @param attributeName
- * @return
+ * @param attributeName the attribute name
+ * @return order attribute
*/
public String getOrderAttribute(String attributeName) {
GenericValue orderAttribute = null;
@@ -2922,6 +3767,11 @@ public class OrderReadHelper {
return orderAttribute != null ? orderAttribute.getString("attrValue"): null;
}
+ /**
+ * Gets order tax by tax auth geo and party.
+ * @param orderAdjustments the order adjustments
+ * @return the order tax by tax auth geo and party
+ */
public static Map<String, Object> getOrderTaxByTaxAuthGeoAndParty(List<GenericValue> orderAdjustments) {
BigDecimal taxGrandTotal = BigDecimal.ZERO;
List<Map<String, Object>> taxByTaxAuthGeoAndPartyList = new LinkedList<>();
@@ -2930,7 +3780,8 @@ public class OrderReadHelper {
orderAdjustments = EntityUtil.filterByAnd(orderAdjustments, UtilMisc.toMap("orderAdjustmentTypeId", "SALES_TAX"));
orderAdjustments = EntityUtil.orderBy(orderAdjustments, UtilMisc.toList("taxAuthGeoId", "taxAuthPartyId"));
- // get the list of all distinct taxAuthGeoId and taxAuthPartyId. It is for getting the number of taxAuthGeo and taxAuthPartyId in adjustments.
+ // get the list of all distinct taxAuthGeoId and taxAuthPartyId. It is for getting the number of taxAuthGeo and
+ // taxAuthPartyId in adjustments.
List<String> distinctTaxAuthGeoIdList = EntityUtil.getFieldListFromEntityList(orderAdjustments, "taxAuthGeoId", true);
List<String> distinctTaxAuthPartyIdList = EntityUtil.getFieldListFromEntityList(orderAdjustments, "taxAuthPartyId", true);
@@ -2940,7 +3791,8 @@ public class OrderReadHelper {
for (String taxAuthGeoId : distinctTaxAuthGeoIdList) {
for (String taxAuthPartyId : distinctTaxAuthPartyIdList) {
//get all records for orderAdjustments filtered by taxAuthGeoId and taxAurhPartyId
- List<GenericValue> orderAdjByTaxAuthGeoAndPartyIds = EntityUtil.filterByAnd(orderAdjustments, UtilMisc.toMap("taxAuthGeoId", taxAuthGeoId, "taxAuthPartyId", taxAuthPartyId));
+ List<GenericValue> orderAdjByTaxAuthGeoAndPartyIds = EntityUtil.filterByAnd(orderAdjustments, UtilMisc.toMap("taxAuthGeoId",
+ taxAuthGeoId, "taxAuthPartyId", taxAuthPartyId));
if (UtilValidate.isNotEmpty(orderAdjByTaxAuthGeoAndPartyIds)) {
BigDecimal totalAmount = BigDecimal.ZERO;
//Now for each orderAdjustment record get and add amount.
@@ -2953,7 +3805,8 @@ public class OrderReadHelper {
processedAdjustments.add(orderAdjustment);
}
totalAmount = totalAmount.setScale(TAX_FINAL_SCALE, TAX_ROUNDING);
- taxByTaxAuthGeoAndPartyList.add(UtilMisc.<String, Object>toMap("taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId", taxAuthGeoId, "totalAmount", totalAmount));
+ taxByTaxAuthGeoAndPartyList.add(UtilMisc.<String, Object>toMap("taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId",
+ taxAuthGeoId, "totalAmount", totalAmount));
taxGrandTotal = taxGrandTotal.add(totalAmount);
}
}
@@ -2973,10 +3826,22 @@ public class OrderReadHelper {
return result;
}
- public static Map<String, Object> getOrderItemTaxByTaxAuthGeoAndPartyForDisplay(GenericValue orderItem, List<GenericValue> orderAdjustmentsOriginal) {
+ /**
+ * Gets order item tax by tax auth geo and party for display.
+ * @param orderItem the order item
+ * @param orderAdjustmentsOriginal the order adjustments original
+ * @return the order item tax by tax auth geo and party for display
+ */
+ public static Map<String, Object> getOrderItemTaxByTaxAuthGeoAndPartyForDisplay(GenericValue orderItem,
+ List<GenericValue> orderAdjustmentsOriginal) {
return getOrderTaxByTaxAuthGeoAndPartyForDisplay(getOrderItemAdjustmentList(orderItem, orderAdjustmentsOriginal));
}
+ /**
+ * Gets order tax by tax auth geo and party for display.
+ * @param orderAdjustmentsOriginal the order adjustments original
+ * @return the order tax by tax auth geo and party for display
+ */
public static Map<String, Object> getOrderTaxByTaxAuthGeoAndPartyForDisplay(List<GenericValue> orderAdjustmentsOriginal) {
BigDecimal taxGrandTotal = BigDecimal.ZERO;
List<Map<String, Object>> taxByTaxAuthGeoAndPartyList = new LinkedList<>();
@@ -2987,7 +3852,8 @@ public class OrderReadHelper {
orderAdjustmentsToUse.addAll(EntityUtil.filterByAnd(orderAdjustmentsOriginal, UtilMisc.toMap("orderAdjustmentTypeId", "VAT_TAX")));
orderAdjustmentsToUse = EntityUtil.orderBy(orderAdjustmentsToUse, UtilMisc.toList("taxAuthGeoId", "taxAuthPartyId"));
- // get the list of all distinct taxAuthGeoId and taxAuthPartyId. It is for getting the number of taxAuthGeo and taxAuthPartyId in adjustments.
+ // get the list of all distinct taxAuthGeoId and taxAuthPartyId. It is for getting the number of taxAuthGeo and taxAuthPartyId in
+ // adjustments.
List<String> distinctTaxAuthGeoIdList = EntityUtil.getFieldListFromEntityList(orderAdjustmentsToUse, "taxAuthGeoId", true);
List<String> distinctTaxAuthPartyIdList = EntityUtil.getFieldListFromEntityList(orderAdjustmentsToUse, "taxAuthPartyId", true);
@@ -2997,7 +3863,8 @@ public class OrderReadHelper {
for (String taxAuthGeoId : distinctTaxAuthGeoIdList) {
for (String taxAuthPartyId : distinctTaxAuthPartyIdList) {
//get all records for orderAdjustments filtered by taxAuthGeoId and taxAurhPartyId
- List<GenericValue> orderAdjByTaxAuthGeoAndPartyIds = EntityUtil.filterByAnd(orderAdjustmentsToUse, UtilMisc.toMap("taxAuthGeoId", taxAuthGeoId, "taxAuthPartyId", taxAuthPartyId));
+ List<GenericValue> orderAdjByTaxAuthGeoAndPartyIds = EntityUtil.filterByAnd(orderAdjustmentsToUse,
+ UtilMisc.toMap("taxAuthGeoId", taxAuthGeoId, "taxAuthPartyId", taxAuthPartyId));
if (UtilValidate.isNotEmpty(orderAdjByTaxAuthGeoAndPartyIds)) {
BigDecimal totalAmount = BigDecimal.ZERO;
//Now for each orderAdjustment record get and add amount.
@@ -3008,14 +3875,16 @@ public class OrderReadHelper {
}
if ("VAT_TAX".equals(orderAdjustment.getString("orderAdjustmentTypeId"))
&& orderAdjustment.get("amountAlreadyIncluded") != null) {
- // this is the only case where the VAT_TAX amountAlreadyIncluded should be added in, and should just be for display and not to calculate the order grandTotal
+ // this is the only case where the VAT_TAX amountAlreadyIncluded should be added in, and should just be for display
+ // and not to calculate the order grandTotal
totalAmount = totalAmount.add(orderAdjustment.getBigDecimal("amountAlreadyIncluded"));
}
totalAmount = totalAmount.setScale(TAX_SCALE, TAX_ROUNDING);
processedAdjustments.add(orderAdjustment);
}
totalAmount = totalAmount.setScale(TAX_FINAL_SCALE, TAX_ROUNDING);
- taxByTaxAuthGeoAndPartyList.add(UtilMisc.<String, Object>toMap("taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId", taxAuthGeoId, "totalAmount", totalAmount));
+ taxByTaxAuthGeoAndPartyList.add(UtilMisc.<String, Object>toMap("taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId",
+ taxAuthGeoId, "totalAmount", totalAmount));
taxGrandTotal = taxGrandTotal.add(totalAmount);
}
}
@@ -3041,7 +3910,7 @@ public class OrderReadHelper {
* When looking at using a billing account for a new order, you should use this method.
* @param billingAccount the billing account record
* @return return the "available" balance of a billing account
- * @throws GenericEntityException
+ * @throws GenericEntityException the generic entity exception
*/
public static BigDecimal getBillingAccountBalance(GenericValue billingAccount) throws GenericEntityException {
@@ -3058,7 +3927,8 @@ public class OrderReadHelper {
.where(EntityCondition.makeCondition("billingAccountId", EntityOperator.EQUALS, billingAccountId),
EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, "EXT_BILLACT"),
EntityCondition.makeCondition("statusId", EntityOperator.NOT_IN, UtilMisc.toList("ORDER_CANCELLED", "ORDER_REJECTED")),
- EntityCondition.makeCondition("preferenceStatusId", EntityOperator.NOT_IN, UtilMisc.toList("PAYMENT_SETTLED", "PAYMENT_RECEIVED", "PAYMENT_DECLINED", "PAYMENT_CANCELLED"))) // PAYMENT_NOT_AUTH
+ EntityCondition.makeCondition("preferenceStatusId", EntityOperator.NOT_IN, UtilMisc.toList("PAYMENT_SETTLED",
+ "PAYMENT_RECEIVED", "PAYMENT_DECLINED", "PAYMENT_CANCELLED"))) // PAYMENT_NOT_AUTH
.queryList();
for (GenericValue orderPaymentPreferenceSum : orderPaymentPreferenceSums) {
@@ -3066,7 +3936,8 @@ public class OrderReadHelper {
balance = maxAmount != null ? balance.subtract(maxAmount) : balance;
}
- List<GenericValue> paymentAppls = EntityQuery.use(delegator).from("PaymentApplication").where("billingAccountId", billingAccountId).queryList();
+ List<GenericValue> paymentAppls = EntityQuery.use(delegator).from("PaymentApplication").where("billingAccountId", billingAccountId)
+ .queryList();
// TODO: cancelled payments?
for (GenericValue paymentAppl : paymentAppls) {
if (paymentAppl.getString("invoiceId") == null) {
@@ -3081,17 +3952,24 @@ public class OrderReadHelper {
/**
* Returns the accountLimit of the BillingAccount or BigDecimal ZERO if it is null
- * @param billingAccount
- * @throws GenericEntityException
+ * @param billingAccount the billing account
+ * @return the account limit
+ * @throws GenericEntityException the generic entity exception
*/
public static BigDecimal getAccountLimit(GenericValue billingAccount) throws GenericEntityException {
if (billingAccount.getBigDecimal("accountLimit") != null) {
return billingAccount.getBigDecimal("accountLimit");
}
- Debug.logWarning("Billing Account [" + billingAccount.getString("billingAccountId") + "] does not have an account limit defined, assuming zero.", MODULE);
+ Debug.logWarning("Billing Account [" + billingAccount.getString("billingAccountId")
+ + "] does not have an account limit defined, assuming zero.", MODULE);
return ZERO;
}
+ /**
+ * Gets shippable sizes.
+ * @param shipGrouSeqId the ship grou seq id
+ * @return the shippable sizes
+ */
public List<BigDecimal> getShippableSizes(String shipGrouSeqId) {
List<BigDecimal> shippableSizes = new ArrayList<>();
@@ -3105,6 +3983,12 @@ public class OrderReadHelper {
}
return shippableSizes;
}
+
+ /**
+ * Gets item received quantity.
+ * @param orderItem the order item
+ * @return the item received quantity
+ */
public BigDecimal getItemReceivedQuantity(GenericValue orderItem) {
BigDecimal totalReceived = BigDecimal.ZERO;
try {
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 dc7b183..d5caec4 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
@@ -245,7 +245,8 @@ public class OrderReturnServices {
GenericValue productStoreEmail = null;
try {
- productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", productStoreId, "emailType", emailType).queryOne();
+ productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", productStoreId,
+ "emailType", emailType).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
}
@@ -259,7 +260,8 @@ public class OrderReturnServices {
String xslfoAttachScreenLocation = productStoreEmail.getString("xslfoAttachScreenLocation");
sendMap.put("xslfoAttachScreenLocation", xslfoAttachScreenLocation);
- Map<String, Object> bodyParameters = UtilMisc.<String, Object>toMap("returnHeader", returnHeader, "returnItems", returnItems, "returnAdjustments", returnAdjustments, "locale", locale, "userLogin", userLogin);
+ Map<String, Object> bodyParameters = UtilMisc.<String, Object>toMap("returnHeader", returnHeader, "returnItems", returnItems,
+ "returnAdjustments", returnAdjustments, "locale", locale, "userLogin", userLogin);
sendMap.put("bodyParameters", bodyParameters);
sendMap.put("subject", productStoreEmail.getString("subject"));
@@ -292,8 +294,8 @@ public class OrderReturnServices {
return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_PRODUCT,
"ProductProductStoreEmailSettingsNotValid",
- UtilMisc.toMap("productStoreId", productStoreId,
- "emailType", emailType), locale));
+ UtilMisc.toMap("productStoreId", productStoreId,
+ "emailType", emailType), locale));
}
// return request notification
@@ -373,6 +375,7 @@ public class OrderReturnServices {
}
return ServiceUtil.returnSuccess();
}
+
// get the returnable quantiy for an order item
public static Map<String, Object> getReturnableQuantity(DispatchContext dctx, Map<String, ? extends Object> context) {
GenericValue orderItem = (GenericValue) context.get("orderItem");
@@ -475,10 +478,12 @@ 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();
+ orderItemQuantitiesIssued = EntityQuery.use(delegator).select("orderId", "orderItemSeqId", "quantityIssued")
+ .from("OrderItemQuantityReportGroupByItem").where(whereConditions).orderBy("orderItemSeqId").queryList();
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
@@ -566,7 +571,7 @@ public class OrderReturnServices {
for (GenericValue itemAdjustment : itemAdjustments) {
returnInfo = new HashMap<>();
returnInfo.put("returnableQuantity", BigDecimal.ONE);
- // TODO: the returnablePrice should be set to the amount minus the already returned amount
+ // TODO: the returnablePrice should be set to the amount minus the already returned amount
returnInfo.put("returnablePrice", itemAdjustment.get("amount"));
returnInfo.put("itemTypeKey", itemTypeKey);
returnable.put(itemAdjustment, returnInfo);
@@ -654,11 +659,11 @@ public class OrderReturnServices {
if (currentStatus != null && "RETURN_ACCEPTED".equals(currentStatus)) {
try {
serviceResult = dispatcher.runSync("updateReturnHeader", UtilMisc.<String, Object>toMap("returnId", returnId,
- "statusId", "RETURN_RECEIVED",
- "userLogin", userLogin));
+ "statusId", "RETURN_RECEIVED",
+ "userLogin", userLogin));
if (ServiceUtil.isError(serviceResult)) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
- "OrderErrorUnableToCreateReturnStatusHistory", locale));
+ "OrderErrorUnableToCreateReturnStatusHistory", locale));
}
} catch (GenericServiceException e) {
Debug.logError(e, MODULE);
@@ -668,11 +673,11 @@ public class OrderReturnServices {
} else if (currentStatus != null && "RETURN_RECEIVED".equals(currentStatus)) {
try {
serviceResult = dispatcher.runSync("updateReturnHeader", UtilMisc.<String, Object>toMap("returnId", returnId,
- "statusId", "RETURN_COMPLETED",
- "userLogin", userLogin));
+ "statusId", "RETURN_COMPLETED",
+ "userLogin", userLogin));
if (ServiceUtil.isError(serviceResult)) {
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
- "OrderErrorUnableToCreateReturnStatusHistory", locale));
+ "OrderErrorUnableToCreateReturnStatusHistory", locale));
}
} catch (GenericServiceException e) {
Debug.logError(e, MODULE);
@@ -753,15 +758,19 @@ public class OrderReturnServices {
}
// if both billingAccountId and finAccountId are supplied, look for productStore.storeCreditAccountEnumId preference
- if (finAccountId != null && billingAccountId != null && productStore != null && productStore.getString("storeCreditAccountEnumId") != null) {
- Debug.logWarning("You have entered both financial account and billing account for store credit. Based on the configuration on product store, only one of them will be selected.", MODULE);
+ if (finAccountId != null && billingAccountId != null && productStore != null
+ && productStore.getString("storeCreditAccountEnumId") != null) {
+ Debug.logWarning("You have entered both financial account and billing account for store credit. Based on the configuration on"
+ + "product store, only one of them will be selected.", MODULE);
if ("BILLING_ACCOUNT".equals(productStore.getString("storeCreditAccountEnumId"))) {
finAccountId = null;
- Debug.logWarning("Default setting on product store is billing account. Store credit will goes to billing account [" + billingAccountId + "]", MODULE);
+ Debug.logWarning("Default setting on product store is billing account. Store credit will goes to billing account ["
+ + billingAccountId + "]", MODULE);
} else {
billingAccountId = null;
- Debug.logWarning("Default setting on product store is financial account. Store credit will goes to financial account [" + finAccountId + "]", MODULE);
- }
+ Debug.logWarning("Default setting on product store is financial account. Store credit will goes to financial account ["
+ + finAccountId + "]", MODULE);
+ }
}
if (finAccountId == null && billingAccountId == null) {
@@ -782,7 +791,8 @@ public class OrderReturnServices {
String thisBillingAccountId = billingAccountItr.next().getString("billingAccountId");
BigDecimal billingAccountBalance = ZERO;
try {
- GenericValue billingAccount = EntityQuery.use(delegator).from("BillingAccount").where("billingAccountId", thisBillingAccountId).queryOne();
+ GenericValue billingAccount = EntityQuery.use(delegator).from("BillingAccount").where("billingAccountId",
+ thisBillingAccountId).queryOne();
billingAccountBalance = OrderReadHelper.getBillingAccountBalance(billingAccount);
} catch (GenericEntityException e) {
return ServiceUtil.returnError(e.getMessage());
@@ -795,7 +805,8 @@ public class OrderReturnServices {
// if no billing account with negative balance is found, look for productStore.storeCreditAccountEnumId settings
if (billingAccountId == null) {
- if (productStore != null && productStore.getString("storeCreditAccountEnumId") != null && "BILLING_ACCOUNT".equals(productStore.getString("storeCreditAccountEnumId"))) {
+ if (productStore != null && productStore.getString("storeCreditAccountEnumId") != null
+ && "BILLING_ACCOUNT".equals(productStore.getString("storeCreditAccountEnumId"))) {
if (UtilValidate.isNotEmpty(billingAccounts)) {
billingAccountId = EntityUtil.getFirst(billingAccounts).getString("billingAccountId");
} else {
@@ -819,7 +830,8 @@ public class OrderReturnServices {
GenericValue finAccount = null;
try {
finAccount = EntityQuery.use(delegator).from("FinAccountAndRole")
- .where("partyId", fromPartyId, "finAccountTypeId", "STORE_CREDIT_ACCT", "roleTypeId", "OWNER", "statusId", "FNACT_ACTIVE", "currencyUomId", returnHeader.getString("currencyUomId"))
+ .where("partyId", fromPartyId, "finAccountTypeId", "STORE_CREDIT_ACCT", "roleTypeId", "OWNER", "statusId",
+ "FNACT_ACTIVE", "currencyUomId", returnHeader.getString("currencyUomId"))
.filterByDate()
.orderBy("-fromDate")
.queryFirst();
@@ -860,7 +872,8 @@ public class OrderReturnServices {
Map<String, Object> finAccountRoleResult = null;
try {
- finAccountRoleResult = dispatcher.runSync("createFinAccountRole", UtilMisc.toMap("finAccountId", finAccountId, "partyId", fromPartyId, "roleTypeId", "OWNER", "userLogin", userLogin));
+ finAccountRoleResult = dispatcher.runSync("createFinAccountRole", UtilMisc.toMap("finAccountId",
+ finAccountId, "partyId", fromPartyId, "roleTypeId", "OWNER", "userLogin", userLogin));
} catch (GenericServiceException e) {
Debug.logError(e, "Problem running the createFinAccountRole service", MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
@@ -899,7 +912,9 @@ public class OrderReturnServices {
if (finAccountId != null) {
Map<String, Object> finAccountTransResult = null;
try {
- finAccountTransResult = dispatcher.runSync("createFinAccountTrans", UtilMisc.toMap("finAccountId", finAccountId, "finAccountTransTypeId", "DEPOSIT", "partyId", toPartyId, "amount", creditTotal, "reasonEnumId", "FATR_REFUND", "userLogin", userLogin));
+ finAccountTransResult = dispatcher.runSync("createFinAccountTrans", UtilMisc.toMap("finAccountId", finAccountId,
+ "finAccountTransTypeId", "DEPOSIT", "partyId", toPartyId, "amount", creditTotal, "reasonEnumId", "FATR_REFUND",
+ "userLogin", userLogin));
} catch (GenericServiceException e) {
Debug.logError(e, "Problem creating FinAccountTrans record", MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
@@ -964,7 +979,9 @@ public class OrderReturnServices {
// loop through the items again to update them and store a status change history
for (GenericValue item : returnItems) {
- Map<String, Object> returnItemMap = UtilMisc.<String, Object>toMap("returnItemResponseId", itemResponseId, "returnId", item.get("returnId"), "returnItemSeqId", item.get("returnItemSeqId"), "statusId", "RETURN_COMPLETED", "userLogin", userLogin);
+ Map<String, Object> returnItemMap = UtilMisc.<String, Object>toMap("returnItemResponseId", itemResponseId, "returnId",
+ item.get("returnId"), "returnItemSeqId", item.get("returnItemSeqId"), "statusId", "RETURN_COMPLETED", "userLogin",
+ userLogin);
// store the item changes (attached responseId)
try {
serviceResults = dispatcher.runSync("updateReturnItem", returnItemMap);
@@ -1017,18 +1034,19 @@ public class OrderReturnServices {
* Helper method to generate a BillingAccount (store credit) from a return
* header. This method takes care of all business logic relating to
* the initialization of a Billing Account from the Return data.
- *
+ * <p>
* The BillingAccount.thruDate will be set to (now +
* ProductStore.storeCreditValidDays + end of day). The product stores
* are obtained via the return orders, and the minimum storeCreditValidDays
* will be used. The default is to set thruDate to null, which implies no
* expiration.
- *
+ * <p>
* Note that we set BillingAccount.accountLimit to 0.0 for store credits.
* This is because the available balance of BillingAccounts is
* calculated as accountLimit + sum of Payments - sum of Invoices.
*/
- private static Map<String, Object> createBillingAccountFromReturn(GenericValue returnHeader, List<GenericValue> returnItems, DispatchContext dctx, Map<String, ? extends Object> context) {
+ private static Map<String, Object> createBillingAccountFromReturn(GenericValue returnHeader, List<GenericValue> returnItems,
+ DispatchContext dctx, Map<String, ? extends Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericValue userLogin = (GenericValue) context.get("userLogin");
Locale locale = (Locale) context.get("locale");
@@ -1061,7 +1079,8 @@ public class OrderReturnServices {
}
// create the billing account
- Map<String, Object> input = UtilMisc.<String, Object>toMap("accountLimit", BigDecimal.ZERO, "description", "Credit Account for Return #" + returnHeader.get("returnId"), "userLogin", userLogin);
+ Map<String, Object> input = UtilMisc.<String, Object>toMap("accountLimit", BigDecimal.ZERO, "description", "Credit Account for Return #"
+ + returnHeader.get("returnId"), "userLogin", userLogin);
input.put("accountCurrencyUomId", returnHeader.get("currencyUomId"));
input.put("thruDate", thruDate);
Map<String, Object> results = dispatcher.runSync("createBillingAccount", input);
@@ -1071,7 +1090,8 @@ public class OrderReturnServices {
String billingAccountId = (String) results.get("billingAccountId");
// set the role on the account
- input = UtilMisc.toMap("billingAccountId", billingAccountId, "partyId", returnHeader.get("fromPartyId"), "roleTypeId", "BILL_TO_CUSTOMER", "userLogin", userLogin);
+ input = UtilMisc.toMap("billingAccountId", billingAccountId, "partyId", returnHeader.get("fromPartyId"), "roleTypeId",
+ "BILL_TO_CUSTOMER", "userLogin", userLogin);
Map<String, Object> roleResults = dispatcher.runSync("createBillingAccountRole", input);
if (ServiceUtil.isError(roleResults)) {
Debug.logError("Error with createBillingAccountRole: " + roleResults.get(ModelService.ERROR_MESSAGE), MODULE);
@@ -1135,7 +1155,8 @@ public class OrderReturnServices {
String returnId = returnItem.getString("returnId");
String returnTypeId = returnItem.getString("returnTypeId");
try {
- serviceResult = dispatcher.runSync("processRefundReturn", UtilMisc.toMap("returnId", returnId, "returnTypeId", returnTypeId, "userLogin", userLogin));
+ serviceResult = dispatcher.runSync("processRefundReturn", UtilMisc.toMap("returnId", returnId, "returnTypeId",
+ returnTypeId, "userLogin", userLogin));
} catch (GenericServiceException e) {
Debug.logError(e, "Problem running the processRefundReturn service", MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
@@ -1207,14 +1228,15 @@ public class OrderReturnServices {
// sort these desending by maxAmount
orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("-maxAmount"), false);
- List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_SETTLED"), EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_RECEIVED"));
+ List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_SETTLED"),
+ EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_RECEIVED"));
orderPayPrefs = EntityUtil.filterByOr(orderPayPrefs, exprs);
// Check for replacement order
if (UtilValidate.isEmpty(orderPayPrefs)) {
GenericValue orderItemAssoc = EntityQuery.use(delegator).from("OrderItemAssoc")
- .where("toOrderId", orderId, "orderItemAssocTypeId", "REPLACEMENT")
- .queryFirst();
+ .where("toOrderId", orderId, "orderItemAssocTypeId", "REPLACEMENT")
+ .queryFirst();
if (orderItemAssoc != null) {
String originalOrderId = orderItemAssoc.getString("orderId");
orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", originalOrderId).queryOne();
@@ -1237,7 +1259,8 @@ public class OrderReturnServices {
GenericValue orgAcctgPref = null;
Map<String, Object> acctgPreferencesResult = null;
try {
- acctgPreferencesResult = dispatcher.runSync("getPartyAccountingPreferences", UtilMisc.toMap("organizationPartyId", productStore.get("payToPartyId"), "userLogin", userLogin));
+ acctgPreferencesResult = dispatcher.runSync("getPartyAccountingPreferences", UtilMisc.toMap("organizationPartyId",
+ productStore.get("payToPartyId"), "userLogin", userLogin));
if (ServiceUtil.isError(acctgPreferencesResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(acctgPreferencesResult));
}
@@ -1252,7 +1275,8 @@ public class OrderReturnServices {
try {
orgAcctgPref.getRelatedOne("PaymentMethod", false);
} catch (GenericEntityException e) {
- Debug.logError("Error retrieving related refundPaymentMethod from PartyAcctgPreference for partyId " + productStore.get("payToPartyId"), MODULE);
+ Debug.logError("Error retrieving related refundPaymentMethod from PartyAcctgPreference for partyId "
+ + productStore.get("payToPartyId"), MODULE);
}
}
}
@@ -1279,12 +1303,14 @@ public class OrderReturnServices {
Map<String, List<Map<String, Object>>> prefSplitMap = new HashMap<>();
for (GenericValue orderPayPref : orderPayPrefs) {
String paymentMethodTypeId = orderPayPref.getString("paymentMethodTypeId");
- String orderPayPrefKey = orderPayPref.getString("paymentMethodId") != null ? orderPayPref.getString("paymentMethodId") : orderPayPref.getString("paymentMethodTypeId");
+ String orderPayPrefKey = orderPayPref.getString("paymentMethodId") != null ? orderPayPref.getString("paymentMethodId")
+ : orderPayPref.getString("paymentMethodTypeId");
// See how much we can refund to the payment method
BigDecimal orderPayPrefReceivedTotal = ZERO;
if (receivedPaymentTotalsByPaymentMethod.containsKey(orderPayPrefKey)) {
- orderPayPrefReceivedTotal = orderPayPrefReceivedTotal.add(receivedPaymentTotalsByPaymentMethod.get(orderPayPrefKey)).setScale(DECIMALS, ROUNDING);
+ orderPayPrefReceivedTotal = orderPayPrefReceivedTotal.add(receivedPaymentTotalsByPaymentMethod.get(orderPayPrefKey))
+ .setScale(DECIMALS, ROUNDING);
}
if (receivedPaymentTotalsByBillingAccount != null) {
@@ -1292,7 +1318,8 @@ public class OrderReturnServices {
}
BigDecimal orderPayPrefRefundedTotal = ZERO;
if (refundedTotalsByPaymentMethod.containsKey(orderPayPrefKey)) {
- orderPayPrefRefundedTotal = orderPayPrefRefundedTotal.add(refundedTotalsByPaymentMethod.get(orderPayPrefKey)).setScale(DECIMALS, ROUNDING);
+ orderPayPrefRefundedTotal = orderPayPrefRefundedTotal.add(refundedTotalsByPaymentMethod.get(orderPayPrefKey))
+ .setScale(DECIMALS, ROUNDING);
}
BigDecimal orderPayPrefAvailableTotal = orderPayPrefReceivedTotal.subtract(orderPayPrefRefundedTotal);
@@ -1317,7 +1344,8 @@ public class OrderReturnServices {
// Figure out if EXT_PAYPAL should be considered as an electronic type
if (productStore != null) {
- ExpressCheckoutEvents.CheckoutType payPalType = ExpressCheckoutEvents.determineCheckoutType(delegator, productStore.getString("productStoreId"));
+ ExpressCheckoutEvents.CheckoutType payPalType = ExpressCheckoutEvents.determineCheckoutType(delegator,
+ productStore.getString("productStoreId"));
if (!payPalType.equals(ExpressCheckoutEvents.CheckoutType.NONE)) {
electronicTypes.add("EXT_PAYPAL");
}
@@ -1359,7 +1387,7 @@ public class OrderReturnServices {
Map<String, Object> orderPaymentPrefDetails = pmtppit.next();
GenericValue orderPaymentPreference = (GenericValue) orderPaymentPrefDetails.get("orderPaymentPreference");
BigDecimal orderPaymentPreferenceAvailable = (BigDecimal) orderPaymentPrefDetails.get("availableTotal");
- GenericValue refundOrderPaymentPreference=null;
+ GenericValue refundOrderPaymentPreference = null;
// Refund up to the maxAmount for the paymentPref, or whatever is left to refund if that's less than the maxAmount
BigDecimal amountToRefund = orderPaymentPreferenceAvailable.min(amountLeftToRefund);
@@ -1383,11 +1411,15 @@ public class OrderReturnServices {
}
orderPaymentPreferenceNewId = (String) result.get("orderPaymentPreferenceId");
try {
- refundOrderPaymentPreference = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceNewId).queryOne();
+ refundOrderPaymentPreference = EntityQuery.use(delegator).from("OrderPaymentPreference")
+ .where("orderPaymentPreferenceId", orderPaymentPreferenceNewId).queryOne();
} catch (GenericEntityException e) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithTheRefundSeeLogs", locale));
+ return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithTheRefundSeeLogs",
+ locale));
}
- serviceResult = dispatcher.runSync("refundPayment", UtilMisc.<String, Object>toMap("orderPaymentPreference", refundOrderPaymentPreference, "refundAmount", amountToRefund.setScale(DECIMALS, ROUNDING), "userLogin", userLogin));
+ serviceResult = dispatcher.runSync("refundPayment", UtilMisc.<String, Object>toMap("orderPaymentPreference",
+ refundOrderPaymentPreference, "refundAmount", amountToRefund.setScale(DECIMALS, ROUNDING), "userLogin",
+ userLogin));
if (ServiceUtil.isError(serviceResult) || ServiceUtil.isFailure(serviceResult)) {
Debug.logError("Error in refund payment: " + ServiceUtil.getErrorMessage(serviceResult), MODULE);
continue;
@@ -1402,7 +1434,7 @@ public class OrderReturnServices {
try {
// for Billing Account refunds
serviceResult = dispatcher.runSync("refundBillingAccountPayment",
- UtilMisc.<String, Object> toMap("orderPaymentPreference", orderPaymentPreference, "refundAmount",
+ UtilMisc.<String, Object>toMap("orderPaymentPreference", orderPaymentPreference, "refundAmount",
amountToRefund.setScale(DECIMALS, ROUNDING), "userLogin", userLogin));
if (ServiceUtil.isError(serviceResult) || ServiceUtil.isFailure(serviceResult)) {
Debug.logError("Error in refund payment: " + ServiceUtil.getErrorMessage(serviceResult), MODULE);
@@ -1417,7 +1449,8 @@ public class OrderReturnServices {
} else {
// handle manual refunds
try {
- Map<String, Object> input = UtilMisc.<String, Object>toMap("userLogin", userLogin, "amount", amountLeftToRefund, "statusId", "PMNT_NOT_PAID");
+ Map<String, Object> input = UtilMisc.<String, Object>toMap("userLogin", userLogin, "amount", amountLeftToRefund,
+ "statusId", "PMNT_NOT_PAID");
input.put("partyIdTo", returnHeader.get("fromPartyId"));
input.put("partyIdFrom", returnHeader.get("toPartyId"));
input.put("paymentTypeId", "CUSTOMER_REFUND");
@@ -1468,7 +1501,9 @@ public class OrderReturnServices {
// Set the response on each item
for (GenericValue item : items) {
- Map<String, Object> returnItemMap = UtilMisc.<String, Object>toMap("returnItemResponseId", responseId, "returnId", item.get("returnId"), "returnItemSeqId", item.get("returnItemSeqId"), "statusId", returnItemStatusId, "userLogin", userLogin);
+ Map<String, Object> returnItemMap = UtilMisc.<String, Object>toMap("returnItemResponseId", responseId, "returnId",
+ item.get("returnId"),
+ "returnItemSeqId", item.get("returnItemSeqId"), "statusId", returnItemStatusId, "userLogin", userLogin);
try {
serviceResults = dispatcher.runSync("updateReturnItem", returnItemMap);
if (ServiceUtil.isError(serviceResults)) {
@@ -1580,14 +1615,16 @@ public class OrderReturnServices {
"OrderOrderPaymentFailed", UtilMisc.toMap("errorString", ""), locale));
}
- // if the original order was paid with a billing account, then go find the billing account from the order and associate this refund with that billing account
+ // if the original order was paid with a billing account, then go find the billing account from the order and associate this
+ // refund with that billing account
// thus returning value to the billing account
if ("EXT_BILLACT".equals(paymentPref.getString("paymentMethodTypeId"))) {
GenericValue billingAccount = orh.getBillingAccount();
if (UtilValidate.isNotEmpty(billingAccount.getString("billingAccountId"))) {
try {
- Map<String, Object> paymentApplResult = dispatcher.runSync("createPaymentApplication", UtilMisc.<String, Object>toMap("paymentId", paymentId, "billingAccountId", billingAccount.getString("billingAccountId"),
- "amountApplied", refundAmount, "userLogin", userLogin));
+ Map<String, Object> paymentApplResult = dispatcher.runSync("createPaymentApplication",
+ UtilMisc.<String, Object>toMap("paymentId", paymentId, "billingAccountId", billingAccount.getString("billingAccountId"),
+ "amountApplied", refundAmount, "userLogin", userLogin));
if (ServiceUtil.isError(paymentApplResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(paymentApplResult));
}
@@ -1617,7 +1654,8 @@ public class OrderReturnServices {
try {
GenericValue response = EntityQuery.use(delegator).from("ReturnItemResponse").where("returnItemResponseId", responseId).queryOne();
if (response == null) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderReturnItemResponseNotFound", UtilMisc.toMap("errorMsg", errorMsg, "responseId", responseId), locale));
+ return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderReturnItemResponseNotFound",
+ UtilMisc.toMap("errorMsg", errorMsg, "responseId", responseId), locale));
}
BigDecimal responseAmount = response.getBigDecimal("responseAmount").setScale(DECIMALS, ROUNDING);
String paymentId = response.getString("paymentId");
@@ -1644,7 +1682,8 @@ public class OrderReturnServices {
List<GenericValue> billings = invoice.getRelated("ReturnItemBilling", null, null, false);
BigDecimal runningTotal = ZERO;
for (GenericValue billing : billings) {
- runningTotal = runningTotal.add(billing.getBigDecimal("amount").multiply(billing.getBigDecimal("quantity")).setScale(DECIMALS, ROUNDING));
+ runningTotal = runningTotal.add(billing.getBigDecimal("amount").multiply(billing.getBigDecimal("quantity"))
+ .setScale(DECIMALS, ROUNDING));
}
invoiceTotals.put(invoice.getString("invoiceId"), runningTotal);
@@ -1673,7 +1712,9 @@ public class OrderReturnServices {
if (ServiceUtil.isError(serviceResults)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
}
- if (Debug.verboseOn()) { Debug.logInfo("Created PaymentApplication for response with amountApplied " + amountApplied.toString(), MODULE); }
+ if (Debug.verboseOn()) {
+ Debug.logInfo("Created PaymentApplication for response with amountApplied " + amountApplied.toString(), MODULE);
+ }
}
}
} catch (GenericServiceException | GenericEntityException e) {
@@ -1773,7 +1814,8 @@ public class OrderReturnServices {
BigDecimal additionalItemTotal = BigDecimal.ZERO;
List<GenericValue> orderItems = new LinkedList<>();
List<GenericValue> orderItemShipGroupInfo = new LinkedList<>();
- List<String> orderItemShipGroupIds = new LinkedList<>(); // this is used to store the ship group ids of the groups already added to the orderItemShipGroupInfo list
+ List<String> orderItemShipGroupIds = new LinkedList<>(); // this is used to store the ship group ids of the groups already added
+ // to the orderItemShipGroupInfo list
List<GenericValue> orderItemAssocs = new LinkedList<>();
if (returnItemList != null) {
int itemCount = 1;
@@ -1797,7 +1839,9 @@ public class OrderReturnServices {
if ("CUSTOMER_RETURN".equals(returnHeaderTypeId)) {
try {
if (product != null) {
- GenericValue refurbItemAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(product.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_REFURB"), UtilMisc.toList("sequenceNum"), false)));
+ GenericValue refurbItemAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(
+ product.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_REFURB"),
+ UtilMisc.toList("sequenceNum"), false)));
if (refurbItemAssoc != null) {
refurbItem = refurbItemAssoc.getRelatedOne("AssocProduct", false);
}
@@ -1808,7 +1852,8 @@ public class OrderReturnServices {
if (refurbItem != null) {
boolean inventoryAvailable = false;
try {
- Map<String, Object> invReqResult = dispatcher.runSync("isStoreInventoryAvailable", UtilMisc.toMap("productStoreId", orderHeader.get("productStoreId"),
+ Map<String, Object> invReqResult = dispatcher.runSync("isStoreInventoryAvailable",
+ UtilMisc.toMap("productStoreId", orderHeader.get("productStoreId"),
"productId", refurbItem.getString("productId"),
"product", refurbItem, "quantity", quantity));
if (ServiceUtil.isError(invReqResult)) {
@@ -1826,13 +1871,15 @@ public class OrderReturnServices {
}
}
- GenericValue newItem = delegator.makeValue("OrderItem", UtilMisc.toMap("orderItemSeqId", UtilFormatOut.formatPaddedNumber(itemCount++, 5)));
+ GenericValue newItem = delegator.makeValue("OrderItem", UtilMisc.toMap("orderItemSeqId",
+ UtilFormatOut.formatPaddedNumber(itemCount++, 5)));
if (UtilValidate.isEmpty(refurbItem)) {
newItem.set("productId", orderItem.get("productId"));
newItem.set("itemDescription", orderItem.get("itemDescription"));
} else {
newItem.set("productId", refurbItem.get("productId"));
- newItem.set("itemDescription", ProductContentWrapper.getProductContentAsText(refurbItem, "PRODUCT_NAME", locale, dispatcher, "html"));
+ newItem.set("itemDescription", ProductContentWrapper.getProductContentAsText(refurbItem, "PRODUCT_NAME", locale,
+ dispatcher, "html"));
}
newItem.set("orderItemTypeId", orderItem.get("orderItemTypeId"));
newItem.set("productFeatureId", orderItem.get("productFeatureId"));
@@ -1862,7 +1909,9 @@ public class OrderReturnServices {
orderItemShipGroupInfo.add(newOrderItemShipGroup);
orderItemShipGroupIds.add(orderItemShipGroupAssoc.getString("shipGroupSeqId"));
}
- GenericValue newOrderItemShipGroupAssoc = delegator.makeValue("OrderItemShipGroupAssoc", UtilMisc.toMap("orderItemSeqId", newItem.getString("orderItemSeqId"), "shipGroupSeqId", orderItemShipGroupAssoc.getString("shipGroupSeqId"), "quantity", quantity));
+ GenericValue newOrderItemShipGroupAssoc = delegator.makeValue("OrderItemShipGroupAssoc",
+ UtilMisc.toMap("orderItemSeqId", newItem.getString("orderItemSeqId"), "shipGroupSeqId",
+ orderItemShipGroupAssoc.getString("shipGroupSeqId"), "quantity", quantity));
orderItemShipGroupInfo.add(newOrderItemShipGroupAssoc);
}
} catch (GenericEntityException e) {
@@ -1871,9 +1920,11 @@ public class OrderReturnServices {
return ServiceUtil.returnError(errMsg);
}
// Create an association between the replacement order item and the order item of the original order
- GenericValue newOrderItemAssoc = delegator.makeValue("OrderItemAssoc", UtilMisc.toMap("orderId", orderHeader.getString("orderId"),
+ GenericValue newOrderItemAssoc = delegator.makeValue("OrderItemAssoc", UtilMisc.toMap("orderId",
+ orderHeader.getString("orderId"),
"orderItemSeqId", orderItem.getString("orderItemSeqId"), "shipGroupSeqId", "_NA_",
- "toOrderItemSeqId", newItem.getString("orderItemSeqId"), "toShipGroupSeqId", "_NA_", "orderItemAssocTypeId", "REPLACEMENT"));
+ "toOrderItemSeqId", newItem.getString("orderItemSeqId"), "toShipGroupSeqId", "_NA_", "orderItemAssocTypeId",
+ "REPLACEMENT"));
orderItemAssocs.add(newOrderItemAssoc);
// For repair replacement orders, add to the order also the repair items
@@ -1881,7 +1932,9 @@ public class OrderReturnServices {
List<GenericValue> repairItems = null;
try {
if (product != null) {
- repairItems = EntityUtil.filterByDate(product.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_REPAIR_SRV"), UtilMisc.toList("sequenceNum"), false));
+ repairItems = EntityUtil.filterByDate(product.getRelated("MainProductAssoc",
+ UtilMisc.toMap("productAssocTypeId", "PRODUCT_REPAIR_SRV"), UtilMisc.toList("sequenceNum"),
+ false));
}
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
@@ -1902,7 +1955,8 @@ public class OrderReturnServices {
repairUnitQuantity = BigDecimal.ONE;
}
BigDecimal repairQuantity = quantity.multiply(repairUnitQuantity);
- newItem = delegator.makeValue("OrderItem", UtilMisc.toMap("orderItemSeqId", UtilFormatOut.formatPaddedNumber(itemCount++, 5)));
+ newItem = delegator.makeValue("OrderItem", UtilMisc.toMap("orderItemSeqId",
+ UtilFormatOut.formatPaddedNumber(itemCount++, 5)));
// price
Map<String, Object> priceContext = new HashMap<>();
@@ -1930,7 +1984,8 @@ public class OrderReturnServices {
}
Boolean validPriceFound = (Boolean) priceResult.get("validPriceFound");
if (Boolean.FALSE.equals(validPriceFound)) {
- Debug.logError("Could not find a valid price for the product with ID [" + repairItemProduct.get("productId") + "].", MODULE);
+ Debug.logError("Could not find a valid price for the product with ID ["
+ + repairItemProduct.get("productId") + "].", MODULE);
continue;
}
@@ -1949,18 +2004,23 @@ public class OrderReturnServices {
newItem.set("productId", repairItemProduct.get("productId"));
// TODO: orderItemTypeId, prodCatalogId, productCategoryId
newItem.set("quantity", repairQuantity);
- newItem.set("itemDescription", ProductContentWrapper.getProductContentAsText(repairItemProduct, "PRODUCT_NAME", locale, dispatcher, "html"));
+ newItem.set("itemDescription", ProductContentWrapper.getProductContentAsText(repairItemProduct,
+ "PRODUCT_NAME", locale, dispatcher, "html"));
newItem.set("statusId", "ITEM_CREATED");
orderItems.add(newItem);
additionalItemTotal = additionalItemTotal.add(repairQuantity.multiply(repairUnitPrice));
if (orderItemShipGroupAssoc != null) {
- GenericValue newOrderItemShipGroupAssoc = delegator.makeValue("OrderItemShipGroupAssoc", UtilMisc.toMap("orderItemSeqId", newItem.getString("orderItemSeqId"), "shipGroupSeqId", orderItemShipGroupAssoc.getString("shipGroupSeqId"), "quantity", repairQuantity));
+ GenericValue newOrderItemShipGroupAssoc = delegator.makeValue("OrderItemShipGroupAssoc",
+ UtilMisc.toMap("orderItemSeqId", newItem.getString("orderItemSeqId"), "shipGroupSeqId",
+ orderItemShipGroupAssoc.getString("shipGroupSeqId"), "quantity", repairQuantity));
orderItemShipGroupInfo.add(newOrderItemShipGroupAssoc);
}
// Create an association between the repair order item and the order item of the original order
- newOrderItemAssoc = delegator.makeValue("OrderItemAssoc", UtilMisc.toMap("orderId", orderHeader.getString("orderId"),
+ newOrderItemAssoc = delegator.makeValue("OrderItemAssoc", UtilMisc.toMap("orderId",
+ orderHeader.getString("orderId"),
"orderItemSeqId", orderItem.getString("orderItemSeqId"), "shipGroupSeqId", "_NA_",
- "toOrderItemSeqId", newItem.getString("orderItemSeqId"), "toShipGroupSeqId", "_NA_", "orderItemAssocTypeId", "REPLACEMENT"));
+ "toOrderItemSeqId", newItem.getString("orderItemSeqId"), "toShipGroupSeqId", "_NA_",
+ "orderItemAssocTypeId", "REPLACEMENT"));
orderItemAssocs.add(newOrderItemAssoc);
}
}
@@ -1991,7 +2051,8 @@ public class OrderReturnServices {
orderMap.put("orderAdjustments", UtilMisc.toList(adj));
// Payment preference
- if ((additionalItemTotal.compareTo(BigDecimal.ZERO) > 0) || ("RTN_CSREPLACE".equals(returnTypeId) && orderPriceTotal.compareTo(ZERO) > 0)) {
+ if ((additionalItemTotal.compareTo(BigDecimal.ZERO) > 0)
+ || ("RTN_CSREPLACE".equals(returnTypeId) && orderPriceTotal.compareTo(ZERO) > 0)) {
GenericValue paymentMethod = null;
try {
paymentMethod = returnHeader.getRelatedOne("PaymentMethod", false);
@@ -2071,7 +2132,8 @@ public class OrderReturnServices {
if ("RETURN_ACCEPTED".equals(returnHeader.get("statusId")) && "RTN_WAIT_REPLACE_RES".equals(returnTypeId)) {
Map<String, Object> serviceResult = null;
try {
- serviceResult = dispatcher.runSync("changeOrderStatus", UtilMisc.toMap("orderId", createdOrderId, "statusId", "ORDER_HOLD", "userLogin", userLogin));
+ serviceResult = dispatcher.runSync("changeOrderStatus", UtilMisc.toMap("orderId", createdOrderId, "statusId",
+ "ORDER_HOLD", "userLogin", userLogin));
if (ServiceUtil.isError(serviceResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
}
@@ -2087,7 +2149,8 @@ public class OrderReturnServices {
OrderChangeHelper.approveOrder(dispatcher, userLogin, createdOrderId);
} else {
try {
- OrderChangeHelper.orderStatusChanges(dispatcher, userLogin, createdOrderId, "ORDER_APPROVED", null, "ITEM_APPROVED", null);
+ OrderChangeHelper.orderStatusChanges(dispatcher, userLogin, createdOrderId, "ORDER_APPROVED", null,
+ "ITEM_APPROVED", null);
} catch (GenericServiceException e) {
Debug.logError(e, "Service invocation error, status changes were not updated for order #" + createdOrderId, MODULE);
return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
@@ -2182,7 +2245,8 @@ public class OrderReturnServices {
// lookup subscriptions
List<GenericValue> subscriptions;
try {
- subscriptions = EntityQuery.use(delegator).from("Subscription").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryList();
+ subscriptions = EntityQuery.use(delegator).from("Subscription").where("orderId", orderId, "orderItemSeqId", orderItemSeqId)
+ .queryList();
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
return ServiceUtil.returnError(e.getMessage());
@@ -2211,14 +2275,15 @@ public class OrderReturnServices {
/**
* Takes a List of returnItems and returns a Map of orderId -> items and a Map of orderId -> orderTotal
- * @param returnItems a List of return items
+ * @param returnItems a List of return items
* @param returnItemsByOrderId the return items by order id
- * @param totalByOrder the total by order id
- * @param delegator the delegator
- * @param returnId the return id
- * @param returnTypeId the return type id
+ * @param totalByOrder the total by order id
+ * @param delegator the delegator
+ * @param returnId the return id
+ * @param returnTypeId the return type id
*/
- public static void groupReturnItemsByOrder(List<GenericValue> returnItems, Map<String, List<GenericValue>> returnItemsByOrderId, Map<String, BigDecimal> totalByOrder, Delegator delegator, String returnId, String returnTypeId) {
+ public static void groupReturnItemsByOrder(List<GenericValue> returnItems, Map<String, List<GenericValue>> returnItemsByOrderId,
+ Map<String, BigDecimal> totalByOrder, Delegator delegator, String returnId, String returnTypeId) {
for (GenericValue returnItem : returnItems) {
String orderId = returnItem.getString("orderId");
if (orderId != null) {
@@ -2252,7 +2317,8 @@ public class OrderReturnServices {
}
BigDecimal thisTotal = amount.multiply(quantity);
BigDecimal existingTotal = totalForOrder;
- Map<String, Object> condition = UtilMisc.toMap("returnId", returnItem.get("returnId"), "returnItemSeqId", returnItem.get("returnItemSeqId"));
+ Map<String, Object> condition = UtilMisc.toMap("returnId", returnItem.get("returnId"), "returnItemSeqId",
+ returnItem.get("returnItemSeqId"));
BigDecimal newTotal = existingTotal.add(thisTotal).add(getReturnAdjustmentTotal(delegator, condition));
totalByOrder.put(orderId, newTotal);
}
@@ -2265,8 +2331,8 @@ public class OrderReturnServices {
for (Entry<String, BigDecimal> orderId : totalByOrder.entrySet()) {
// find returnAdjustment for returnHeader
Map<String, Object> condition = UtilMisc.<String, Object>toMap("returnId", returnId,
- "returnItemSeqId", org.apache.ofbiz.common.DataModelConstants.SEQ_ID_NA,
- "returnTypeId", returnTypeId);
+ "returnItemSeqId", org.apache.ofbiz.common.DataModelConstants.SEQ_ID_NA,
+ "returnTypeId", returnTypeId);
BigDecimal existingTotal = (totalByOrder.get(orderId.getKey()).add(getReturnAdjustmentTotal(delegator, condition)));
totalByOrder.put(orderId.getKey(), existingTotal);
}
@@ -2336,7 +2402,8 @@ public class OrderReturnServices {
for (Entry<String, BigDecimal> orderId : returnAmountByOrder.entrySet()) {
BigDecimal returnAmount = returnAmountByOrder.get(orderId.getKey());
if (returnAmount == null) {
- return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderNoReturnAmountFound", UtilMisc.toMap("orderId", orderId), locale));
+ return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderNoReturnAmountFound",
+ UtilMisc.toMap("orderId", orderId), locale));
}
if (returnAmount.abs().compareTo(new BigDecimal("0.000001")) < 0) {
Debug.logError("Order [" + orderId + "] refund amount[ " + returnAmount + "] less than zero", MODULE);
@@ -2383,14 +2450,17 @@ public class OrderReturnServices {
}
// get returnHeaderTypeId from ReturnHeader and then use it to figure out return item type mapping
returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne();
- String returnHeaderTypeId = ((returnHeader != null) && (returnHeader.getString("returnHeaderTypeId") != null)) ? returnHeader.getString("returnHeaderTypeId") : "CUSTOMER_RETURN";
- returnItemTypeMap = EntityQuery.use(delegator).from("ReturnItemTypeMap").where("returnHeaderTypeId", returnHeaderTypeId, "returnItemMapKey", orderAdjustment.get("orderAdjustmentTypeId")).queryOne();
+ String returnHeaderTypeId = ((returnHeader != null) && (returnHeader.getString("returnHeaderTypeId") != null))
+ ? returnHeader.getString("returnHeaderTypeId") : "CUSTOMER_RETURN";
+ returnItemTypeMap = EntityQuery.use(delegator).from("ReturnItemTypeMap").where("returnHeaderTypeId", returnHeaderTypeId,
+ "returnItemMapKey", orderAdjustment.get("orderAdjustmentTypeId")).queryOne();
returnAdjustmentType = returnItemTypeMap.getRelatedOne("ReturnAdjustmentType", false);
if (returnAdjustmentType != null && UtilValidate.isEmpty(description)) {
description = returnAdjustmentType.getString("description");
}
if ((returnItemSeqId != null) && !("_NA_".equals(returnItemSeqId))) {
- returnItem = EntityQuery.use(delegator).from("ReturnItem").where("returnId", returnId, "returnItemSeqId", returnItemSeqId).queryOne();
+ returnItem = EntityQuery.use(delegator).from("ReturnItem").where("returnId", returnId, "returnItemSeqId", returnItemSeqId)
+ .queryOne();
Debug.logInfo("returnId:" + returnId + ", returnItemSeqId:" + returnItemSeqId, MODULE);
orderItem = returnItem.getRelatedOne("OrderItem", false);
} else {
@@ -2400,7 +2470,8 @@ public class OrderReturnServices {
if (UtilValidate.isNotEmpty(orderAdjustment.getString("orderItemSeqId"))
&& !"_NA_".equals(orderAdjustment.getString("orderItemSeqId"))) {
returnItem = EntityQuery.use(delegator).from("ReturnItem")
- .where("returnId", returnId, "orderId", orderAdjustment.getString("orderId"), "orderItemSeqId", orderAdjustment.getString("orderItemSeqId"))
+ .where("returnId", returnId, "orderId", orderAdjustment.getString("orderId"), "orderItemSeqId",
+ orderAdjustment.getString("orderItemSeqId"))
.queryFirst();
if (returnItem != null) {
orderItem = returnItem.getRelatedOne("OrderItem", false);
@@ -2426,10 +2497,13 @@ public class OrderReturnServices {
// calculate the returnAdjustment amount
if (returnItem != null) { // returnAdjustment for returnItem
if (needRecalculate(returnAdjustmentTypeId)) {
- Debug.logInfo("returnPrice:" + returnItem.getBigDecimal("returnPrice") + ", returnQuantity:" + returnItem.getBigDecimal("returnQuantity") + ", sourcePercentage:" + orderAdjustment.getBigDecimal("sourcePercentage"), MODULE);
+ Debug.logInfo("returnPrice:" + returnItem.getBigDecimal("returnPrice") + ", returnQuantity:"
+ + returnItem.getBigDecimal("returnQuantity") + ", sourcePercentage:" + orderAdjustment.getBigDecimal("sourcePercentage"),
+ MODULE);
BigDecimal returnTotal = returnItem.getBigDecimal("returnPrice").multiply(returnItem.getBigDecimal("returnQuantity"));
BigDecimal orderTotal = orderItem.getBigDecimal("quantity").multiply(orderItem.getBigDecimal("unitPrice"));
- amount = getAdjustmentAmount("RET_SALES_TAX_ADJ".equals(returnAdjustmentTypeId), returnTotal, orderTotal, orderAdjustment.getBigDecimal("amount"));
+ amount = getAdjustmentAmount("RET_SALES_TAX_ADJ".equals(returnAdjustmentTypeId), returnTotal, orderTotal,
+ orderAdjustment.getBigDecimal("amount"));
} else {
amount = (BigDecimal) context.get("amount");
}
@@ -2474,21 +2548,26 @@ public class OrderReturnServices {
try {
- returnAdjustment = EntityQuery.use(delegator).from("ReturnAdjustment").where("returnAdjustmentId", context.get("returnAdjustmentId")).queryOne();
+ returnAdjustment = EntityQuery.use(delegator).from("ReturnAdjustment").where("returnAdjustmentId", context.get("returnAdjustmentId"))
+ .queryOne();
if (returnAdjustment != null) {
- returnItem = EntityQuery.use(delegator).from("ReturnItem").where("returnId", returnAdjustment.get("returnId"), "returnItemSeqId", returnAdjustment.get("returnItemSeqId")).queryOne();
+ returnItem = EntityQuery.use(delegator).from("ReturnItem").where("returnId", returnAdjustment.get("returnId"), "returnItemSeqId",
+ returnAdjustment.get("returnItemSeqId")).queryOne();
returnAdjustmentTypeId = returnAdjustment.getString("returnAdjustmentTypeId");
}
// calculate the returnAdjustment amount
if (returnItem != null) { // returnAdjustment for returnItem
- BigDecimal originalReturnPrice = (context.get("originalReturnPrice") != null) ? ((BigDecimal) context.get("originalReturnPrice")) : returnItem.getBigDecimal("returnPrice");
- BigDecimal originalReturnQuantity = (context.get("originalReturnQuantity") != null) ? ((BigDecimal) context.get("originalReturnQuantity")) : returnItem.getBigDecimal("returnQuantity");
+ BigDecimal originalReturnPrice = (context.get("originalReturnPrice") != null) ? ((BigDecimal) context.get("originalReturnPrice"))
+ : returnItem.getBigDecimal("returnPrice");
+ BigDecimal originalReturnQuantity = (context.get("originalReturnQuantity") != null)
+ ? ((BigDecimal) context.get("originalReturnQuantity")) : returnItem.getBigDecimal("returnQuantity");
if (needRecalculate(returnAdjustmentTypeId)) {
BigDecimal returnTotal = returnItem.getBigDecimal("returnPrice").multiply(returnItem.getBigDecimal("returnQuantity"));
BigDecimal originalReturnTotal = originalReturnPrice.multiply(originalReturnQuantity);
- amount = getAdjustmentAmount("RET_SALES_TAX_ADJ".equals(returnAdjustmentTypeId), returnTotal, originalReturnTotal, returnAdjustment.getBigDecimal("amount"));
+ amount = getAdjustmentAmount("RET_SALES_TAX_ADJ".equals(returnAdjustmentTypeId), returnTotal, originalReturnTotal,
+ returnAdjustment.getBigDecimal("amount"));
} else {
amount = (BigDecimal) context.get("amount");
}
@@ -2501,7 +2580,8 @@ public class OrderReturnServices {
returnAdjustment.setNonPKFields(context);
returnAdjustment.set("amount", amount);
delegator.store(returnAdjustment);
- Debug.logInfo("Update ReturnAdjustment with Id:" + context.get("returnAdjustmentId") + " to amount " + amount +" successfully.", MODULE);
+ Debug.logInfo("Update ReturnAdjustment with Id:" + context.get("returnAdjustmentId") + " to amount " + amount + " successfully.",
+ MODULE);
result = ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE,
"OrderUpdateReturnAdjustment",
UtilMisc.toMap("returnAdjustmentId", context.get("returnAdjustmentId"), "amount", amount), locale));
@@ -2520,7 +2600,7 @@ public class OrderReturnServices {
public static Map<String, Object> createReturnItemOrAdjustment(DispatchContext dctx, Map<String, ? extends Object> context) {
Debug.logInfo("createReturnItemOrAdjustment's context:" + context, MODULE);
String orderItemSeqId = (String) context.get("orderItemSeqId");
- Debug.logInfo("orderItemSeqId:" + orderItemSeqId +"#", MODULE);
+ Debug.logInfo("orderItemSeqId:" + orderItemSeqId + "#", MODULE);
LocalDispatcher dispatcher = dctx.getDispatcher();
//if the request is to create returnItem, orderItemSeqId should not be empty
String serviceName = UtilValidate.isNotEmpty(orderItemSeqId) ? "createReturnItem" : "createReturnAdjustment";
@@ -2547,7 +2627,7 @@ public class OrderReturnServices {
public static Map<String, Object> updateReturnItemOrAdjustment(DispatchContext dctx, Map<String, ? extends Object> context) {
Debug.logInfo("updateReturnItemOrAdjustment's context:" + context, MODULE);
String returnAdjustmentId = (String) context.get("returnAdjustmentId");
- Debug.logInfo("returnAdjustmentId:" + returnAdjustmentId +"#", MODULE);
+ Debug.logInfo("returnAdjustmentId:" + returnAdjustmentId + "#", MODULE);
LocalDispatcher dispatcher = dctx.getDispatcher();
//if the request is to create returnItem, orderItemSeqId should not be empty
String serviceName = UtilValidate.isEmpty(returnAdjustmentId) ? "updateReturnItem" : "updateReturnAdjustment";
@@ -2589,7 +2669,7 @@ public class OrderReturnServices {
if (adjustments != null) {
for (GenericValue returnAdjustment : adjustments) {
if ((returnAdjustment != null) && (returnAdjustment.get("amount") != null)) {
- total = total.add(returnAdjustment.getBigDecimal("amount"));
+ total = total.add(returnAdjustment.getBigDecimal("amount"));
}
}
}
@@ -2600,27 +2680,27 @@ public class OrderReturnServices {
}
/**
- * Get rid of unnecessary parameters based on the given service name
- * @param dctx Service DispatchContext
+ * Get rid of unnecessary parameters based on the given service name
+ * @param dctx Service DispatchContext
* @param serviceName the service name
- * @param context context before clean up
+ * @param context context before clean up
* @return filtered context
* @throws GenericServiceException
- *
* @deprecated - Use DispatchContext.makeValidContext(String, String, Map) instead
*/
@Deprecated
- public static Map<String, Object> filterServiceContext(DispatchContext dctx, String serviceName, Map<String, ? extends Object> context) throws GenericServiceException {
+ public static Map<String, Object> filterServiceContext(DispatchContext dctx, String serviceName, Map<String, ? extends Object> context)
+ throws GenericServiceException {
return dctx.makeValidContext(serviceName, ModelService.IN_PARAM, context);
}
/**
- * Calculate new returnAdjustment amount and set scale and rounding mode based on returnAdjustmentType: RET_SALES_TAX_ADJ use sales.tax._ and others use order._
- * @param isSalesTax if returnAdjustmentType is SaleTax
+ * Calculate new returnAdjustment amount and set scale and rounding mode based on returnAdjustmentType: RET_SALES_TAX_ADJ use sales.tax.
+ * @param isSalesTax if returnAdjustmentType is SaleTax
* @param returnTotal
* @param originalTotal
* @param amount
- * @return new returnAdjustment amount
+ * @return new returnAdjustment amount
*/
public static BigDecimal getAdjustmentAmount(boolean isSalesTax, BigDecimal returnTotal, BigDecimal originalTotal, BigDecimal amount) {
String settingPrefix = isSalesTax ? "salestax" : "order";
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 35a4d6d..60235d2 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
@@ -4772,7 +4772,6 @@ public class OrderServices {
/**
* Service to create a payment using an order payment preference.
- *
* @return Map
*/
public static Map<String, Object> createPaymentFromPreference(DispatchContext dctx, Map<String, ? extends Object> context) {
@@ -5298,7 +5297,6 @@ public class OrderServices {
/**
* Generates a product requirement for the total cancelled quantity over all order items for each product
- *
* @param dctx the dispatch context
* @param context the context
* @return the result of the service execution
@@ -5607,7 +5605,6 @@ public class OrderServices {
* any adjustments for that item (via OrderAdjustmentBilling), and the item's share of any order-level adjustments (that calculated
* by applying the percentage of the items total that the item represents to the order-level adjustments total (also via
* OrderAdjustmentBilling). Also returns the quantity invoiced for the item over all invoices, to aid in prorating.
- *
* @param dctx DispatchContext
* @param context Map
* @return Map
@@ -5928,7 +5925,6 @@ public class OrderServices {
/**
* Create an OrderItemShipGroup record
- *
* @param dctx
* @param context
* @return
@@ -6024,7 +6020,6 @@ public class OrderServices {
/**
* Remove an OrderItemShipGroup record
- *
* @param ctx
* @param context a map containing in paramaters
* @return result: a map containing out parameters
@@ -6057,7 +6052,6 @@ public class OrderServices {
/**
* Create orderItem and shipGroup association
- *
* @param dctx
* @param context
* @return
@@ -6150,7 +6144,6 @@ public class OrderServices {
/**
* Update orderItem and shipgroup association
- *
* @param dctx
* @param context
* @return
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 2766283..571001c 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
@@ -276,10 +276,8 @@ public class RequirementServices {
* ProductFacility.minimumStock. Because the minimumStock is an upper bound, the quantity to be required
* is either that required to bring the ATP back up to the minimumStock level or the amount ordered,
* whichever is less.
- *
* If there is a way to support reorderQuantity without losing the order item -> requirement association data,
* then this service should be updated.
- *
* The result is that this service generates many small requirements when stock levels are low for a product,
* which is perfectly fine since the system is capable of creating POs in bulk from aggregate requirements.
* The only concern would be a UI to manage numerous requirements with ease, preferrably by aggregating
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 47fba12..c49d58c 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
@@ -60,6 +60,7 @@ public class CheckOutEvents {
private static final String MODULE = CheckOutEvents.class.getName();
private static final String RES_ERROR = "OrderErrorUiLabels";
+ private static final String DEFAULT_INIT_CHECKOUT_PAGE = "shippingaddress";
public static String cartNotEmpty(HttpServletRequest request, HttpServletResponse response) {
ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
@@ -119,7 +120,8 @@ public class CheckOutEvents {
}
String supplierPartyId = (String) request.getAttribute(shipGroupIndex + "_supplierPartyId");
String supplierAgreementId = (String) request.getAttribute(shipGroupIndex + "_supplierAgreementId");
- Map<String, ? extends Object> callResult = checkOutHelper.finalizeOrderEntryShip(shipGroupIndex, shippingContactMechId, supplierPartyId, supplierAgreementId);
+ Map<String, ? extends Object> callResult = checkOutHelper.finalizeOrderEntryShip(shipGroupIndex, shippingContactMechId,
+ supplierPartyId, supplierAgreementId);
ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
}
@@ -127,7 +129,8 @@ public class CheckOutEvents {
if (UtilValidate.isNotEmpty(taxAuthPartyGeoIds)) {
try {
Map<String, ? extends Object> createCustomerTaxAuthInfoResult = dispatcher.runSync("createCustomerTaxAuthInfo",
- UtilMisc.<String, Object>toMap("partyId", cart.getPartyId(), "taxAuthPartyGeoIds", taxAuthPartyGeoIds, "partyTaxId", partyTaxId, "isExempt", isExempt, "userLogin", userLogin));
+ UtilMisc.<String, Object>toMap("partyId", cart.getPartyId(), "taxAuthPartyGeoIds", taxAuthPartyGeoIds, "partyTaxId",
+ partyTaxId, "isExempt", isExempt, "userLogin", userLogin));
ServiceUtil.getMessages(request, createCustomerTaxAuthInfoResult, null);
if (ServiceUtil.isError(createCustomerTaxAuthInfoResult)) {
String errorMessage = ServiceUtil.getErrorMessage(createCustomerTaxAuthInfoResult);
@@ -163,7 +166,8 @@ public class CheckOutEvents {
Map<String, ? extends Object> callResult = ServiceUtil.returnSuccess();
for (int shipGroupIndex = 0; shipGroupIndex < cart.getShipGroupSize(); shipGroupIndex++) {
- callResult = checkOutHelper.finalizeOrderEntryOptions(shipGroupIndex, shippingMethod, shippingInstructions, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate, orderAdditionalEmails);
+ callResult = checkOutHelper.finalizeOrderEntryOptions(shipGroupIndex, shippingMethod, shippingInstructions, maySplit, giftMessage,
+ isGift, internalCode, shipBeforeDate, shipAfterDate, orderAdditionalEmails);
ServiceUtil.getMessages(request, callResult, null);
}
if (!(callResult.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR))) {
@@ -179,7 +183,8 @@ public class CheckOutEvents {
BigDecimal billingAccountAmt = null;
billingAccountAmt = determineBillingAccountAmount(billingAccountId, request.getParameter("billingAccountAmount"), dispatcher);
if ((billingAccountId != null) && !"_NA_".equals(billingAccountId) && (billingAccountAmt == null)) {
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), cart.getLocale()));
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderInvalidAmountSetForBillingAccount",
+ UtilMisc.toMap("billingAccountId", billingAccountId), cart.getLocale()));
return "error";
}
selectedPaymentMethods.put("EXT_BILLACT", UtilMisc.<String, Object>toMap("amount", billingAccountAmt, "securityCode", null));
@@ -222,8 +227,6 @@ public class CheckOutEvents {
return curPage;
}
- private static final String DEFAULT_INIT_CHECKOUT_PAGE = "shippingaddress";
-
/**
* Method to determine the initial checkout page based on requirements. This will also set
* any cart variables necessary to satisfy the requirements, such as setting the
@@ -300,7 +303,7 @@ public class CheckOutEvents {
String checkOutPaymentId = (String) request.getAttribute("checkOutPaymentId");
if ((paymentMethods == null || paymentMethods.length <= 0) && UtilValidate.isNotEmpty(checkOutPaymentId)) {
- paymentMethods = new String[] {checkOutPaymentId};
+ paymentMethods = new String[]{checkOutPaymentId};
}
if (UtilValidate.isNotEmpty(request.getParameter("issuerId"))) {
@@ -328,7 +331,8 @@ public class CheckOutEvents {
amount = new BigDecimal(amountStr);
} catch (NumberFormatException e) {
Debug.logError(e, MODULE);
- errMsg = UtilProperties.getMessage(RES_ERROR, "checkevents.invalid_amount_set_for_payment_method", (cart != null ? cart.getLocale() : Locale.getDefault()));
+ errMsg = UtilProperties.getMessage(RES_ERROR, "checkevents.invalid_amount_set_for_payment_method",
+ (cart != null ? cart.getLocale() : Locale.getDefault()));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return null;
}
@@ -358,7 +362,8 @@ public class CheckOutEvents {
BigDecimal billingAccountAmt = null;
billingAccountAmt = determineBillingAccountAmount(billingAccountId, request.getParameter("billingAccountAmount"), dispatcher);
if (billingAccountAmt == null) {
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault())));
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderInvalidAmountSetForBillingAccount",
+ UtilMisc.toMap("billingAccountId", billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault())));
return "error";
}
selectedPaymentMethods.put("EXT_BILLACT", UtilMisc.<String, Object>toMap("amount", billingAccountAmt, "securityCode", null));
@@ -435,6 +440,7 @@ public class CheckOutEvents {
return "success";
}
+
// Check for payment method and shipping method exist for checkout process of anonymous user
public static String checkoutValidation(HttpServletRequest request, HttpServletResponse response) {
ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("shoppingCart");
@@ -456,6 +462,7 @@ public class CheckOutEvents {
}
return "success";
}
+
// Create order event - uses createOrder service for processing
public static String createOrder(HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
@@ -666,7 +673,8 @@ public class CheckOutEvents {
ServiceUtil.getMessages(request, callResult, null);
// wipe the session
- if (("anonymous".equals(currentUser.getString("userLoginId"))) || (currentUser.getString("userLoginId")).equals(userLogin.getString("userLoginId"))) {
+ if (("anonymous".equals(currentUser.getString("userLoginId"))) || (currentUser.getString("userLoginId"))
+ .equals(userLogin.getString("userLoginId"))) {
session.invalidate();
}
//Determine whether it was a success or not
@@ -689,7 +697,8 @@ public class CheckOutEvents {
String paymentMethodTypeId = request.getParameter("paymentMethodTypeId");
if ("EXT_PAYPAL".equals(paymentMethodTypeId) || cart.getPaymentMethodTypeIds().contains("EXT_PAYPAL")) {
try {
- GenericValue payPalProdStorePaySetting = EntityQuery.use(delegator).from("ProductStorePaymentSetting").where("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "EXT_PAYPAL").queryFirst();
+ GenericValue payPalProdStorePaySetting = EntityQuery.use(delegator).from("ProductStorePaymentSetting").where("productStoreId",
+ productStore.getString("productStoreId"), "paymentMethodTypeId", "EXT_PAYPAL").queryFirst();
if (payPalProdStorePaySetting != null) {
GenericValue gatewayConfig = payPalProdStorePaySetting.getRelatedOne("PaymentGatewayConfig", false);
if (gatewayConfig != null && "PAY_GATWY_PAYFLOWPRO".equals(gatewayConfig.getString("paymentGatewayConfigTypeId"))) {
@@ -815,7 +824,7 @@ public class CheckOutEvents {
}
if ("term".equals(mode)) {
- cart.setOrderTermSet(true);
+ cart.setOrderTermSet(true);
}
CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart);
@@ -881,9 +890,11 @@ public class CheckOutEvents {
cart.clearOrderNotes();
cart.clearInternalOrderNotes();
if (shipEstimate == null) { // allow ship estimate to be set manually if a purchase order
- callResult = checkOutHelper.finalizeOrderEntryOptions(shipGroupIndex, shippingMethod, shippingInstructions, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate, internalOrderNotes, shippingNotes);
+ callResult = checkOutHelper.finalizeOrderEntryOptions(shipGroupIndex, shippingMethod, shippingInstructions, maySplit,
+ giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate, internalOrderNotes, shippingNotes);
} else {
- callResult = checkOutHelper.finalizeOrderEntryOptions(shipGroupIndex, shippingMethod, shippingInstructions, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate, internalOrderNotes, shippingNotes, shipEstimate);
+ callResult = checkOutHelper.finalizeOrderEntryOptions(shipGroupIndex, shippingMethod, shippingInstructions, maySplit,
+ giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate, internalOrderNotes, shippingNotes, shipEstimate);
}
ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
}
@@ -935,7 +946,8 @@ public class CheckOutEvents {
BigDecimal billingAccountAmt = null;
billingAccountAmt = determineBillingAccountAmount(billingAccountId, request.getParameter("billingAccountAmount"), dispatcher);
if (billingAccountAmt == null) {
- request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault())));
+ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderInvalidAmountSetForBillingAccount",
+ UtilMisc.toMap("billingAccountId", billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault())));
return "error";
}
selectedPaymentMethods.put("EXT_BILLACT", UtilMisc.<String, Object>toMap("amount", billingAccountAmt, "securityCode", null));
@@ -1046,13 +1058,15 @@ public class CheckOutEvents {
String customerPartyId = cart.getPartyId();
String[] processOrder = {"customer", "shipping", "shipGroups", "options", "term", "payment",
- "addparty", "paysplit"};
+ "addparty", "paysplit"};
if ("PURCHASE_ORDER".equals(cart.getOrderType())) {
// Force checks for the following
- requireCustomer = true; requireShipping = true; requireOptions = true;
- processOrder = new String[] {"customer", "term", "shipping", "shipGroups", "options", "payment",
- "addparty", "paysplit"};
+ requireCustomer = true;
+ requireShipping = true;
+ requireOptions = true;
+ processOrder = new String[]{"customer", "term", "shipping", "shipGroups", "options", "payment",
+ "addparty", "paysplit"};
}
for (String currProcess : processOrder) {
@@ -1099,7 +1113,7 @@ public class CheckOutEvents {
// Finally, if all checks go through, finalize the order.
- // this is used to go back to a previous page in checkout after processing all of the changes, just to make sure we get everything...
+ // this is used to go back to a previous page in checkout after processing all of the changes, just to make sure we get everything...
String checkoutGoTo = request.getParameter("checkoutGoTo");
if (UtilValidate.isNotEmpty(checkoutGoTo)) {
return checkoutGoTo;
@@ -1122,13 +1136,12 @@ public class CheckOutEvents {
/**
* Determine what billing account amount to use based on the form input.
* This method returns the amount that will be charged to the billing account.
- *
+ * <p>
* An amount can be associated with the billingAccountId with a
* parameter billingAccountAmount. If no amount is specified, then
* the entire available balance of the given billing account will be used.
* If there is an error, a null will be returned.
- *
- * @return Amount to charge billing account or null if there was an error
+ * @return Amount to charge billing account or null if there was an error
*/
private static BigDecimal determineBillingAccountAmount(String billingAccountId, String billingAccountAmount, LocalDispatcher dispatcher) {
BigDecimal billingAccountAmt = null;
@@ -1164,7 +1177,9 @@ public class CheckOutEvents {
return null;
}
- /** Create a replacement order from an existing order against a lost shipment etc. **/
+ /**
+ * Create a replacement order from an existing order against a lost shipment etc.
+ **/
public static String createReplacementOrder(HttpServletRequest request, HttpServletResponse response) {
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
Delegator delegator = (Delegator) request.getAttribute("delegator");
@@ -1176,8 +1191,8 @@ public class CheckOutEvents {
String originalOrderId = request.getParameter("orderId");
// create the replacement order adjustment
- List<GenericValue>orderAdjustments = UtilGenerics.cast(context.get("orderAdjustments"));
- List<GenericValue>orderItems = UtilGenerics.cast(context.get("orderItems"));
+ List<GenericValue> orderAdjustments = UtilGenerics.cast(context.get("orderAdjustments"));
+ List<GenericValue> orderItems = UtilGenerics.cast(context.get("orderItems"));
OrderReadHelper orderReadHelper = new OrderReadHelper(orderAdjustments, orderItems);
BigDecimal grandTotal = orderReadHelper.getOrderGrandTotal();
if (grandTotal.compareTo(new BigDecimal(0)) != 0) {
@@ -1195,9 +1210,9 @@ public class CheckOutEvents {
int index = cart.getItemIndex(sci);
try {
GenericValue orderItem = EntityQuery.use(delegator).from("OrderItem")
- .where("orderId", originalOrderId, "isPromo", sci.getIsPromo() ? "Y" : "N",
- "productId", sci.getProductId(), "orderItemTypeId", sci.getItemType())
- .queryFirst();
+ .where("orderId", originalOrderId, "isPromo", sci.getIsPromo() ? "Y" : "N",
+ "productId", sci.getProductId(), "orderItemTypeId", sci.getItemType())
+ .queryFirst();
if (orderItem != null) {
sci.setAssociatedOrderId(orderItem.getString("orderId"));
sci.setAssociatedOrderItemSeqId(orderItem.getString("orderItemSeqId"));
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 d44a72c..740664a 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
@@ -125,6 +125,19 @@ public class CheckOutHelper {
return errorMessages;
}
+ /**
+ * Sets check out shipping options.
+ * @param shippingMethod the shipping method
+ * @param shippingInstructions the shipping instructions
+ * @param orderAdditionalEmails the order additional emails
+ * @param maySplit the may split
+ * @param giftMessage the gift message
+ * @param isGift the is gift
+ * @param internalCode the internal code
+ * @param shipBeforeDate the ship before date
+ * @param shipAfterDate the ship after date
+ * @return the check out shipping options
+ */
public Map<String, Object> setCheckOutShippingOptions(String shippingMethod, String shippingInstructions,
String orderAdditionalEmails, String maySplit, String giftMessage, String isGift, String internalCode, String shipBeforeDate, String shipAfterDate) {
List<String> errorMessages = new ArrayList<>();
@@ -221,6 +234,13 @@ public class CheckOutHelper {
return errorMessages;
}
+ /**
+ * Sets check out payment.
+ * @param selectedPaymentMethods the selected payment methods
+ * @param singleUsePayments the single use payments
+ * @param billingAccountId the billing account id
+ * @return the check out payment
+ */
public Map<String, Object> setCheckOutPayment(Map<String, Map<String, Object>> selectedPaymentMethods, List<String> singleUsePayments, String billingAccountId) {
List<String> errorMessages = new ArrayList<>();
Map<String, Object> result;
@@ -244,7 +264,15 @@ public class CheckOutHelper {
return result;
}
- public List<String> setCheckOutPaymentInternal(Map<String, Map<String, Object>> selectedPaymentMethods, List<String> singleUsePayments, String billingAccountId) {
+ /**
+ * Sets check out payment internal.
+ * @param selectedPaymentMethods the selected payment methods
+ * @param singleUsePayments the single use payments
+ * @param billingAccountId the billing account id
+ * @return the check out payment internal
+ */
+ public List<String> setCheckOutPaymentInternal(Map<String, Map<String, Object>> selectedPaymentMethods, List<String> singleUsePayments,
+ String billingAccountId) {
List<String> errorMessages = new ArrayList<>();
String errMsg = null;
@@ -261,15 +289,17 @@ public class CheckOutHelper {
Map<String, Object> billingAccountMap = selectedPaymentMethods.get("EXT_BILLACT");
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));
+ cart.setBillingAccount(billingAccountId, (billingAccountAmt != null ? billingAccountAmt : BigDecimal.ZERO));
// copy the billing account terms as order terms
try {
- List<GenericValue> billingAccountTerms = EntityQuery.use(delegator).from("BillingAccountTerm").where("billingAccountId", billingAccountId).queryList();
+ List<GenericValue> billingAccountTerms = EntityQuery.use(delegator).from("BillingAccountTerm").where("billingAccountId",
+ billingAccountId).queryList();
if (UtilValidate.isNotEmpty(billingAccountTerms)) {
for (GenericValue billingAccountTerm : billingAccountTerms) {
// the term is not copied if in the cart a term of the same type is already set
if (!cart.hasOrderTerm(billingAccountTerm.getString("termTypeId"))) {
- cart.addOrderTerm(billingAccountTerm.getString("termTypeId"), billingAccountTerm.getBigDecimal("termValue"), billingAccountTerm.getLong("termDays"));
+ cart.addOrderTerm(billingAccountTerm.getString("termTypeId"), billingAccountTerm.getBigDecimal("termValue"),
+ billingAccountTerm.getLong("termDays"));
}
}
}
@@ -292,7 +322,8 @@ public class CheckOutHelper {
cart.getLocale());
errorMessages.add(errMsg);
} else {
- // otherwise use the available account credit (The user might enter 10.00 for an order worth 20.00 from an account with 30.00. This makes sure that the 30.00 is used)
+ // otherwise use the available account credit (The user might enter 10.00 for an order worth 20.00 from an account with 30.00.
+ // This makes sure that the 30.00 is used)
amountToUse = accountCredit;
}
@@ -365,6 +396,12 @@ public class CheckOutHelper {
return errorMessages;
}
+ /**
+ * Sets check out dates.
+ * @param shipBefore the ship before
+ * @param shipAfter the ship after
+ * @return the check out dates
+ */
public Map<String, Object> setCheckOutDates(Timestamp shipBefore, Timestamp shipAfter) {
List<String> errorMessages = new ArrayList<>();
Map<String, Object> result = null;
@@ -440,6 +477,12 @@ public class CheckOutHelper {
return result;
}
+ /**
+ * Check gift card map.
+ * @param params the params
+ * @param selectedPaymentMethods the selected payment methods
+ * @return the map
+ */
public Map<String, Object> checkGiftCard(Map<String, Object> params, Map<String, Map<String, Object>> selectedPaymentMethods) {
List<String> errorMessages = new ArrayList<>();
Map<String, Object> errorMaps = new HashMap<>();
@@ -564,11 +607,26 @@ public class CheckOutHelper {
return result;
}
+ /**
+ * Create order map.
+ * @param userLogin the user login
+ * @return the map
+ */
public Map<String, Object> createOrder(GenericValue userLogin) {
return createOrder(userLogin, null, null, null, false, null, cart.getWebSiteId());
}
- // Create order event - uses createOrder service for processing
+ /**
+ * Create order event - uses createOrder service for processing
+ * @param userLogin the user login
+ * @param distributorId the distributor id
+ * @param affiliateId the affiliate id
+ * @param trackingCodeOrders the tracking code orders
+ * @param areOrderItemsExploded the are order items exploded
+ * @param visitId the visit id
+ * @param webSiteId the web site id
+ * @return the map
+ */
public Map<String, Object> createOrder(GenericValue userLogin, String distributorId, String affiliateId,
List<GenericValue> trackingCodeOrders, boolean areOrderItemsExploded, String visitId, String webSiteId) {
if (this.cart == null) {
@@ -655,7 +713,8 @@ public class CheckOutHelper {
GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
GenericValue productStore = ProductStoreWorker.getProductStore(productStoreId, delegator);
GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne();
- if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "AGGREGATED")) {
+ if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId",
+ "AGGREGATED")) {
org.apache.ofbiz.product.config.ProductConfigWrapper config = this.cart.findCartItem(counter).getConfigWrapper();
Map<String, Object> inputMap = new HashMap<>();
inputMap.put("config", config);
@@ -674,30 +733,30 @@ public class CheckOutHelper {
String service = e.getMessage();
Map<String, String> messageMap = UtilMisc.toMap("service", service);
String errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.problems_reading_database", cart.getLocale());
- errMsg += UtilProperties.getMessage(RES_ERROR, "checkhelper.could_not_create_order_invoking_service", messageMap, cart.getLocale());
+ errMsg += UtilProperties.getMessage(RES_ERROR, "checkhelper.could_not_create_order_invoking_service", messageMap,
+ cart.getLocale());
Debug.logError(e, errMsg, MODULE);
return ServiceUtil.returnError(errMsg);
} catch (GenericServiceException e) {
String service = e.getMessage();
Map<String, String> messageMap = UtilMisc.toMap("service", service);
- String errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.could_not_create_order_invoking_service", messageMap, cart.getLocale());
+ String errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.could_not_create_order_invoking_service", messageMap,
+ cart.getLocale());
Debug.logError(e, errMsg, MODULE);
return ServiceUtil.returnError(errMsg);
}
}
counter++;
}
- // ----------
-
- // ----------
// The status of the requirement associated to the shopping cart lines is set to "ordered".
- //
for (ShoppingCartItem shoppingCartItem : this.cart.items()) {
String requirementId = shoppingCartItem.getRequirementId();
if (requirementId != null) {
try {
- /* OrderRequirementCommitment records will map which POs which are created from which requirements. With the help of this mapping requirements will be updated to Ordered when POs will be approved. */
- Map<String, Object> inputMap = UtilMisc.toMap("userLogin", userLogin, "orderId", orderId, "orderItemSeqId", shoppingCartItem.getOrderItemSeqId(), "requirementId", requirementId, "quantity", shoppingCartItem.getQuantity());
+ /* OrderRequirementCommitment records will map which POs which are created from which requirements.
+ With the help of this mapping requirements will be updated to Ordered when POs will be approved. */
+ Map<String, Object> inputMap = UtilMisc.toMap("userLogin", userLogin, "orderId", orderId, "orderItemSeqId",
+ shoppingCartItem.getOrderItemSeqId(), "requirementId", requirementId, "quantity", shoppingCartItem.getQuantity());
Map<String, Object> serviceResult = dispatcher.runSync("createOrderRequirementCommitment", inputMap);
if (ServiceUtil.isError(serviceResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
@@ -705,7 +764,8 @@ public class CheckOutHelper {
} catch (GenericServiceException e) {
String service = e.getMessage();
Map<String, String> messageMap = UtilMisc.toMap("service", service);
- String errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.could_not_create_order_invoking_service", messageMap, cart.getLocale());
+ String errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.could_not_create_order_invoking_service", messageMap,
+ cart.getLocale());
Debug.logError(e, errMsg, MODULE);
return ServiceUtil.returnError(errMsg);
}
@@ -734,11 +794,13 @@ public class CheckOutHelper {
while (emailIter != null && emailIter.hasNext()) {
GenericValue email = emailIter.next();
GenericValue orderContactMech = this.delegator.makeValue("OrderContactMech",
- UtilMisc.toMap("orderId", orderId, "contactMechId", email.getString("contactMechId"), "contactMechPurposeTypeId", "ORDER_EMAIL"));
+ UtilMisc.toMap("orderId", orderId, "contactMechId", email.getString("contactMechId"), "contactMechPurposeTypeId",
+ "ORDER_EMAIL"));
toBeStored.add(orderContactMech);
if (UtilValidate.isEmpty(ContactHelper.getContactMechByPurpose(party, "ORDER_EMAIL", false))) {
GenericValue partyContactMechPurpose = this.delegator.makeValue("PartyContactMechPurpose",
- UtilMisc.toMap("partyId", party.getString("partyId"), "contactMechId", email.getString("contactMechId"), "contactMechPurposeTypeId", "ORDER_EMAIL", "fromDate", UtilDateTime.nowTimestamp()));
+ UtilMisc.toMap("partyId", party.getString("partyId"), "contactMechId", email.getString("contactMechId"),
+ "contactMechPurposeTypeId", "ORDER_EMAIL", "fromDate", UtilDateTime.nowTimestamp()));
toBeStored.add(partyContactMechPurpose);
}
}
@@ -776,18 +838,38 @@ public class CheckOutHelper {
return result;
}
+ /**
+ * Calc and add tax.
+ * @throws GeneralException the general exception
+ */
public void calcAndAddTax() throws GeneralException {
calcAndAddTax(null, false);
}
+ /**
+ * Calc and add tax.
+ * @param skipEmptyAddresses the skip empty addresses
+ * @throws GeneralException the general exception
+ */
public void calcAndAddTax(boolean skipEmptyAddresses) throws GeneralException {
calcAndAddTax(null, skipEmptyAddresses);
}
+ /**
+ * Calc and add tax.
+ * @param shipAddress the ship address
+ * @throws GeneralException the general exception
+ */
public void calcAndAddTax(GenericValue shipAddress) throws GeneralException {
calcAndAddTax(shipAddress, false);
}
+ /**
+ * Calc and add tax.
+ * @param shipAddress the ship address
+ * @param skipEmptyAddresses the skip empty addresses
+ * @throws GeneralException the general exception
+ */
public void calcAndAddTax(GenericValue shipAddress, boolean skipEmptyAddresses) throws GeneralException {
if (UtilValidate.isEmpty(cart.getShippingContactMechId()) && cart.getBillingAddress() == null && shipAddress == null) {
return;
@@ -797,7 +879,8 @@ public class CheckOutHelper {
for (int i = 0; i < shipGroups; i++) {
ShoppingCart.CartShipInfo csi = cart.getShipInfo(i);
Map<Integer, ShoppingCartItem> shoppingCartItemIndexMap = new HashMap<>();
- Map<String, Object> serviceContext = this.makeTaxContext(i, shipAddress, shoppingCartItemIndexMap, cart.getFacilityId(), skipEmptyAddresses);
+ Map<String, Object> serviceContext = this.makeTaxContext(i, shipAddress, shoppingCartItemIndexMap, cart.getFacilityId(),
+ skipEmptyAddresses);
if (skipEmptyAddresses && serviceContext == null) {
csi.clearAllTaxInfo();
continue;
@@ -831,7 +914,8 @@ public class CheckOutHelper {
}
}
- private Map<String, Object> makeTaxContext(int shipGroup, GenericValue shipAddress, Map<Integer, ShoppingCartItem> shoppingCartItemIndexMap, String originFacilityId, boolean skipEmptyAddresses) {
+ private Map<String, Object> makeTaxContext(int shipGroup, GenericValue shipAddress, Map<Integer, ShoppingCartItem> shoppingCartItemIndexMap,
+ String originFacilityId, boolean skipEmptyAddresses) {
ShoppingCart.CartShipInfo csi = cart.getShipInfo(shipGroup);
int totalItems = csi.getShipItemInfo().size();
@@ -873,7 +957,8 @@ public class CheckOutHelper {
GenericValue billAddr = cpi.getBillingAddress(delegator);
if (billAddr != null) {
shipAddress = billAddr;
- Debug.logInfo("In makeTaxContext no shipping address, but found address with ID [" + shipAddress.get("contactMechId") + "] from payment method.", MODULE);
+ Debug.logInfo("In makeTaxContext no shipping address, but found address with ID [" + shipAddress.get("contactMechId")
+ + "] from payment method.", MODULE);
break;
}
}
@@ -882,10 +967,12 @@ public class CheckOutHelper {
if (shipAddress == null) {
// face-to-face order; use the facility address
if (originFacilityId != null) {
- GenericValue facilityContactMech = ContactMechWorker.getFacilityContactMechByPurpose(delegator, originFacilityId, UtilMisc.toList("SHIP_ORIG_LOCATION", "PRIMARY_LOCATION"));
+ GenericValue facilityContactMech = ContactMechWorker.getFacilityContactMechByPurpose(delegator, originFacilityId,
+ UtilMisc.toList("SHIP_ORIG_LOCATION", "PRIMARY_LOCATION"));
if (facilityContactMech != null) {
try {
- shipAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", facilityContactMech.getString("contactMechId")).queryOne();
+ shipAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId",
+ facilityContactMech.getString("contactMechId")).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, MODULE);
}
@@ -893,9 +980,11 @@ public class CheckOutHelper {
}
}
- // if shippingAddress is still null then don't calculate tax; it may be an situation where no tax is applicable, or the data is bad and we don't have a way to find an address to check tax for
+ // if shippingAddress is still null then don't calculate tax; it may be an situation where no tax is applicable, or the data is bad and we
+ // don't have a way to find an address to check tax for
if (shipAddress == null) {
- Debug.logWarning("Not calculating tax for new order because there is no shipping address, no billing address, and no address on the origin facility [" + originFacilityId + "]", MODULE);
+ Debug.logWarning("Not calculating tax for new order because there is no shipping address, no billing address, and no address on the"
+ + "origin facility [" + originFacilityId + "]", MODULE);
}
Map<String, Object> serviceContext = UtilMisc.<String, Object>toMap("productStoreId", cart.getProductStoreId());
@@ -936,19 +1025,49 @@ public class CheckOutHelper {
return UtilMisc.toList(orderAdj, itemAdj);
}
+ /**
+ * Process payment map.
+ * @param productStore the product store
+ * @param userLogin the user login
+ * @return the map
+ * @throws GeneralException the general exception
+ */
public Map<String, Object> processPayment(GenericValue productStore, GenericValue userLogin) throws GeneralException {
- return CheckOutHelper.processPayment(this.cart.getOrderId(), this.cart.getGrandTotal(), this.cart.getCurrency(), productStore, userLogin, false, false, dispatcher, delegator);
+ return CheckOutHelper.processPayment(this.cart.getOrderId(), this.cart.getGrandTotal(), this.cart.getCurrency(), productStore, userLogin,
+ false, false, dispatcher, delegator);
}
+ /**
+ * Process payment map.
+ * @param productStore the product store
+ * @param userLogin the user login
+ * @param faceToFace the face to face
+ * @return the map
+ * @throws GeneralException the general exception
+ */
public Map<String, Object> processPayment(GenericValue productStore, GenericValue userLogin, boolean faceToFace) throws GeneralException {
- return CheckOutHelper.processPayment(this.cart.getOrderId(), this.cart.getGrandTotal(), this.cart.getCurrency(), productStore, userLogin, faceToFace, false, dispatcher, delegator);
+ return CheckOutHelper.processPayment(this.cart.getOrderId(), this.cart.getGrandTotal(), this.cart.getCurrency(), productStore, userLogin,
+ faceToFace, false, dispatcher, delegator);
}
- public Map<String, Object> processPayment(GenericValue productStore, GenericValue userLogin, boolean faceToFace, boolean manualHold) throws GeneralException {
- return CheckOutHelper.processPayment(this.cart.getOrderId(), this.cart.getGrandTotal(), this.cart.getCurrency(), productStore, userLogin, faceToFace, manualHold, dispatcher, delegator);
+ /**
+ * Process payment map.
+ * @param productStore the product store
+ * @param userLogin the user login
+ * @param faceToFace the face to face
+ * @param manualHold the manual hold
+ * @return the map
+ * @throws GeneralException the general exception
+ */
+ public Map<String, Object> processPayment(GenericValue productStore, GenericValue userLogin, boolean faceToFace, boolean manualHold)
+ throws GeneralException {
+ return CheckOutHelper.processPayment(this.cart.getOrderId(), this.cart.getGrandTotal(), this.cart.getCurrency(), productStore, userLogin,
+ faceToFace, manualHold, dispatcher, delegator);
}
- public static Map<String, Object> processPayment(String orderId, BigDecimal orderTotal, String currencyUomId, GenericValue productStore, GenericValue userLogin, boolean faceToFace, boolean manualHold, LocalDispatcher dispatcher, Delegator delegator) throws GeneralException {
+ public static Map<String, Object> processPayment(String orderId, BigDecimal orderTotal, String currencyUomId, GenericValue productStore,
+ GenericValue userLogin, boolean faceToFace, boolean manualHold, LocalDispatcher dispatcher, Delegator delegator)
+ throws GeneralException {
// Get some payment related strings
String declineMessage = productStore.getString("authDeclinedMessage");
String errMessage = productStore.getString("authErrorMessage");
@@ -1163,7 +1282,8 @@ public class CheckOutHelper {
&& cashCodPcBaPaymentPreferences.size() == allPaymentPreferences.size()) {
//if there are Check type, approve the order only if it is face to face
- List<GenericValue> checkPreferences = EntityUtil.filterByAnd(cashCodPcBaPaymentPreferences, UtilMisc.toMap("paymentMethodTypeId", "PERSONAL_CHECK"));
+ List<GenericValue> checkPreferences = EntityUtil.filterByAnd(cashCodPcBaPaymentPreferences,
+ UtilMisc.toMap("paymentMethodTypeId", "PERSONAL_CHECK"));
if (UtilValidate.isNotEmpty(checkPreferences)) {
if (faceToFace) {
boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
@@ -1199,7 +1319,8 @@ public class CheckOutHelper {
return ServiceUtil.returnSuccess();
}
- public static void adjustFaceToFacePayment(String orderId, BigDecimal cartTotal, List<GenericValue> allPaymentPrefs, GenericValue userLogin, Delegator delegator) throws GeneralException {
+ public static void adjustFaceToFacePayment(String orderId, BigDecimal cartTotal, List<GenericValue> allPaymentPrefs, GenericValue userLogin,
+ Delegator delegator) throws GeneralException {
BigDecimal prefTotal = BigDecimal.ZERO;
if (allPaymentPrefs != null) {
for (GenericValue pref : allPaymentPrefs) {
@@ -1226,6 +1347,10 @@ public class CheckOutHelper {
}
}
+ /**
+ * Check order black list map.
+ * @return the map
+ */
public Map<String, Object> checkOrderBlackList() {
if (cart == null) {
return ServiceUtil.returnSuccess("success");
@@ -1237,7 +1362,8 @@ public class CheckOutHelper {
String shippingAddress = UtilFormatOut.checkNull(shippingAddressObj.getString("address1")).toUpperCase(Locale.getDefault());
shippingAddress = UtilFormatOut.makeSqlSafe(shippingAddress);
List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition(
- EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("blacklistString"), EntityOperator.EQUALS, EntityFunction.UPPER(shippingAddress)),
+ EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("blacklistString"), EntityOperator.EQUALS,
+ EntityFunction.UPPER(shippingAddress)),
EntityOperator.AND,
EntityCondition.makeCondition("orderBlacklistTypeId", EntityOperator.EQUALS, "BLACKLIST_ADDRESS")));
String errMsg = null;
@@ -1267,7 +1393,8 @@ public class CheckOutHelper {
String address = UtilFormatOut.checkNull(billingAddress.getString("address1").toUpperCase(Locale.getDefault()));
address = UtilFormatOut.makeSqlSafe(address);
exprs.add(EntityCondition.makeCondition(
- EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("blacklistString"), EntityOperator.EQUALS, EntityFunction.UPPER(address)),
+ EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("blacklistString"), EntityOperator.EQUALS,
+ EntityFunction.UPPER(address)),
EntityOperator.AND,
EntityCondition.makeCondition("orderBlacklistTypeId", EntityOperator.EQUALS, "BLACKLIST_ADDRESS")));
}
@@ -1291,11 +1418,22 @@ public class CheckOutHelper {
return ServiceUtil.returnSuccess("success");
}
+ /**
+ * Check order blacklist map.
+ * @param userLogin the user login
+ * @return the map
+ */
@Deprecated
public Map<String, Object> checkOrderBlacklist(GenericValue userLogin) {
return checkOrderBlackList();
}
+ /**
+ * Failed blacklist check map.
+ * @param userLogin the user login
+ * @param productStore the product store
+ * @return the map
+ */
public Map<String, Object> failedBlacklistCheck(GenericValue userLogin, GenericValue productStore) {
Map<String, Object> result;
String errMsg = null;
@@ -1327,6 +1465,11 @@ public class CheckOutHelper {
return result;
}
+ /**
+ * Check external payment map.
+ * @param orderId the order id
+ * @return the map
+ */
public Map<String, Object> checkExternalPayment(String orderId) {
Map<String, Object> result;
String errMsg = null;
@@ -1337,7 +1480,8 @@ public class CheckOutHelper {
orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, "Problems getting order header", MODULE);
- errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.problems_getting_order_header", (cart != null ? cart.getLocale() : Locale.getDefault()));
+ errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.problems_getting_order_header", (cart != null ? cart.getLocale()
+ : Locale.getDefault()));
result = ServiceUtil.returnError(errMsg);
return result;
}
@@ -1347,7 +1491,8 @@ public class CheckOutHelper {
paymentPrefs = orderHeader.getRelated("OrderPaymentPreference", null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Problems getting order payments", MODULE);
- errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.problems_getting_payment_preference", (cart != null ? cart.getLocale() : Locale.getDefault()));
+ errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.problems_getting_payment_preference", (cart != null ? cart.getLocale()
+ : Locale.getDefault()));
result = ServiceUtil.returnError(errMsg);
return result;
}
@@ -1381,7 +1526,6 @@ public class CheckOutHelper {
/**
* Sets the shipping contact mechanism for a given ship group on the cart
- *
* @param shipGroupIndex The index of the ship group in the cart
* @param shippingContactMechId The identifier of the contact
* @param supplierPartyId The identifier of the supplier to use for the drop shipment
@@ -1389,9 +1533,10 @@ public class CheckOutHelper {
* @return A Map conforming to the OFBiz Service conventions containing
* any error messages
*/
- public Map<String, Object> finalizeOrderEntryShip(int shipGroupIndex, String shippingContactMechId, String supplierPartyId, String supplierAgreementId) {
+ public Map<String, Object> finalizeOrderEntryShip(int shipGroupIndex, String shippingContactMechId, String supplierPartyId,
+ String supplierAgreementId) {
Map<String, Object> result;
- String errMsg=null;
+ String errMsg = null;
//Verify the field is valid
if (UtilValidate.isNotEmpty(shippingContactMechId)) {
this.cart.setShippingContactMechId(shipGroupIndex, shippingContactMechId);
@@ -1403,7 +1548,8 @@ public class CheckOutHelper {
}
result = ServiceUtil.returnSuccess();
} else {
- errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.enter_shipping_address", (cart != null ? cart.getLocale() : Locale.getDefault()));
+ errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.enter_shipping_address", (cart != null ? cart.getLocale()
+ : Locale.getDefault()));
result = ServiceUtil.returnError(errMsg);
}
@@ -1412,7 +1558,6 @@ public class CheckOutHelper {
/**
* Sets the options associated with the order for a given ship group
- *
* @param shipGroupIndex The index of the ship group in the cart
* @param shippingMethod The shipping method indicating the carrier and
* shipment type to use
@@ -1427,19 +1572,55 @@ public class CheckOutHelper {
public Map<String, Object> finalizeOrderEntryOptions(int shipGroupIndex, String shippingMethod, String shippingInstructions, String maySplit,
String giftMessage, String isGift, String internalCode, String shipBeforeDate, String shipAfterDate, String orderAdditionalEmails) {
this.cart.setOrderAdditionalEmails(orderAdditionalEmails);
- return finalizeOrderEntryOptions(shipGroupIndex, shippingMethod, shippingInstructions, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate, null, null);
+ return finalizeOrderEntryOptions(shipGroupIndex, shippingMethod, shippingInstructions, maySplit, giftMessage, isGift, internalCode,
+ shipBeforeDate, shipAfterDate, null, null);
}
+
+ /**
+ * Finalize order entry options map.
+ * @param shipGroupIndex the ship group index
+ * @param shippingMethod the shipping method
+ * @param shippingInstructions the shipping instructions
+ * @param maySplit the may split
+ * @param giftMessage the gift message
+ * @param isGift the is gift
+ * @param internalCode the internal code
+ * @param shipBeforeDate the ship before date
+ * @param shipAfterDate the ship after date
+ * @param internalOrderNotes the internal order notes
+ * @param shippingNotes the shipping notes
+ * @param shipEstimate the ship estimate
+ * @return the map
+ */
public Map<String, Object> finalizeOrderEntryOptions(int shipGroupIndex, String shippingMethod, String shippingInstructions, String maySplit,
- String giftMessage, String isGift, String internalCode, String shipBeforeDate, String shipAfterDate, String internalOrderNotes, String shippingNotes, BigDecimal shipEstimate) {
+ String giftMessage, String isGift, String internalCode, String shipBeforeDate, String shipAfterDate, String internalOrderNotes,
+ String shippingNotes, BigDecimal shipEstimate) {
this.cart.setItemShipGroupEstimate(shipEstimate, shipGroupIndex);
- return finalizeOrderEntryOptions(shipGroupIndex, shippingMethod, shippingInstructions, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate, internalOrderNotes, shippingNotes);
+ return finalizeOrderEntryOptions(shipGroupIndex, shippingMethod, shippingInstructions, maySplit, giftMessage, isGift, internalCode,
+ shipBeforeDate, shipAfterDate, internalOrderNotes, shippingNotes);
}
+
+ /**
+ * Finalize order entry options map.
+ * @param shipGroupIndex the ship group index
+ * @param shippingMethod the shipping method
+ * @param shippingInstructions the shipping instructions
+ * @param maySplit the may split
+ * @param giftMessage the gift message
+ * @param isGift the is gift
+ * @param internalCode the internal code
+ * @param shipBeforeDate the ship before date
+ * @param shipAfterDate the ship after date
+ * @param internalOrderNotes the internal order notes
+ * @param shippingNotes the shipping notes
+ * @return the map
+ */
public Map<String, Object> finalizeOrderEntryOptions(int shipGroupIndex, String shippingMethod, String shippingInstructions, String maySplit,
String giftMessage, String isGift, String internalCode, String shipBeforeDate, String shipAfterDate, String internalOrderNotes, String shippingNotes) {
Map<String, Object> result = ServiceUtil.returnSuccess();
- String errMsg=null;
+ String errMsg = null;
//Verify the shipping method is valid
if (UtilValidate.isNotEmpty(shippingMethod)) {
int delimiterPos = shippingMethod.indexOf('@');
@@ -1509,7 +1690,6 @@ public class CheckOutHelper {
/**
* Sets the payment ID to use during the checkout process
- *
* @param checkOutPaymentId The payment ID to be associated with the cart
* @return A Map conforming to the OFBiz Service conventions containing
* any error messages.
@@ -1547,10 +1727,20 @@ public class CheckOutHelper {
return BigDecimal.ZERO;
}
+ /**
+ * Available account balance big decimal.
+ * @param billingAccountId the billing account id
+ * @return the big decimal
+ */
public BigDecimal availableAccountBalance(String billingAccountId) {
return availableAccountBalance(billingAccountId, dispatcher);
}
+ /**
+ * Make billing account map map.
+ * @param paymentPrefs the payment prefs
+ * @return the map
+ */
public Map<String, BigDecimal> makeBillingAccountMap(List<GenericValue> paymentPrefs) {
Map<String, BigDecimal> accountMap = new HashMap<>();
if (paymentPrefs != null) {
@@ -1563,13 +1753,18 @@ public class CheckOutHelper {
return accountMap;
}
+ /**
+ * Validate payment methods map.
+ * @return the map
+ */
public Map<String, Object> validatePaymentMethods() {
String errMsg = null;
String billingAccountId = cart.getBillingAccountId();
BigDecimal billingAccountAmt = cart.getBillingAccountAmount();
BigDecimal availableAmount = this.availableAccountBalance(billingAccountId);
if (billingAccountAmt.compareTo(availableAmount) > 0) {
- Debug.logError("Billing account " + billingAccountId + " has [" + availableAmount + "] available but needs [" + billingAccountAmt + "] for this order", MODULE);
+ Debug.logError("Billing account " + billingAccountId + " has [" + availableAmount + "] available but needs [" + billingAccountAmt
+ + "] for this order", MODULE);
Map<String, String> messageMap = UtilMisc.toMap("billingAccountId", billingAccountId);
errMsg = UtilProperties.getMessage(RES_ERROR, "checkevents.not_enough_available_on_account", messageMap, cart.getLocale());
return ServiceUtil.returnError(errMsg);
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 d6a1666..2c4ea2f 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
@@ -1170,6 +1170,10 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
this.handleNewUser(dispatcher);
}
+ /**
+ * Sets user login.
+ * @param userLogin the user login
+ */
protected void setUserLogin(GenericValue userLogin) {
if (this.userLogin == null) {
this.userLogin = userLogin;
@@ -1178,10 +1182,20 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
}
+ /**
+ * Gets auto user login.
+ * @return the auto user login
+ */
public GenericValue getAutoUserLogin() {
return this.autoUserLogin;
}
+ /**
+ * Sets auto user login.
+ * @param autoUserLogin the auto user login
+ * @param dispatcher the dispatcher
+ * @throws CartItemModifyException the cart item modify exception
+ */
public void setAutoUserLogin(GenericValue autoUserLogin, LocalDispatcher dispatcher) throws CartItemModifyException {
this.autoUserLogin = autoUserLogin;
if (getUserLogin() == null) {
@@ -1189,6 +1203,10 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
}
+ /**
+ * Sets auto user login.
+ * @param autoUserLogin the auto user login
+ */
protected void setAutoUserLogin(GenericValue autoUserLogin) {
if (this.autoUserLogin == null) {
this.autoUserLogin = autoUserLogin;
@@ -1197,6 +1215,11 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
}
+ /**
+ * Handle new user.
+ * @param dispatcher the dispatcher
+ * @throws CartItemModifyException the cart item modify exception
+ */
public void handleNewUser(LocalDispatcher dispatcher) throws CartItemModifyException {
String partyId = this.getPartyId();
if (UtilValidate.isNotEmpty(partyId)) {
@@ -1221,26 +1244,50 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
}
+ /**
+ * Gets external id.
+ * @return the external id
+ */
public String getExternalId() {
return this.externalId;
}
+ /**
+ * Sets external id.
+ * @param externalId the external id
+ */
public void setExternalId(String externalId) {
this.externalId = externalId;
}
+ /**
+ * Gets internal code.
+ * @return the internal code
+ */
public String getInternalCode() {
return this.internalCode;
}
+ /**
+ * Sets internal code.
+ * @param internalCode the internal code
+ */
public void setInternalCode(String internalCode) {
this.internalCode = internalCode;
}
+ /**
+ * Gets web site id.
+ * @return the web site id
+ */
public String getWebSiteId() {
return this.webSiteId;
}
+ /**
+ * Sets web site id.
+ * @param webSiteId the web site id
+ */
public void setWebSiteId(String webSiteId) {
this.webSiteId = webSiteId;
}
@@ -1275,7 +1322,6 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
/**
* Get ship before date for ship group 0
- *
* @return ship before date for the first ship group
*/
public Timestamp getShipBeforeDate() {
@@ -1284,7 +1330,6 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
/**
* Set ship after date for a particular ship group
- *
* @param idx the ship group number
* @param shipAfterDate the ship after date to be set for the given ship group
*/
@@ -1295,7 +1340,6 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
/**
* Get ship after date for a particular ship group
- *
* @param idx the ship group number
* @return return the ship after date for the given ship group
*/
@@ -1314,7 +1358,6 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
/**
* 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) {
@@ -1938,11 +1981,12 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
if (UtilValidate.isNotEmpty(paymentInfo)) {
for (String paymentMethodId : getPaymentMethodIds()) {
try {
- GenericValue paymentMethod = this.getDelegator().findOne("PaymentMethod", UtilMisc.toMap("paymentMethodId", paymentMethodId), true);
+ GenericValue paymentMethod = this.getDelegator().findOne("PaymentMethod", UtilMisc.toMap("paymentMethodId",
+ paymentMethodId), true);
if (paymentMethod != null) {
methods.add(paymentMethod);
} else {
- Debug.logError("Error getting cart payment methods, the paymentMethodId [" + paymentMethodId +"] is not valid", MODULE);
+ Debug.logError("Error getting cart payment methods, the paymentMethodId [" + paymentMethodId + "] is not valid", MODULE);
}
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to get payment method from the database", MODULE);
@@ -1968,7 +2012,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
return types;
}
-
+ /** getCreditCards */
public List<GenericValue> getCreditCards() {
List<GenericValue> paymentMethods = this.getPaymentMethods();
List<GenericValue> creditCards = new LinkedList<>();
@@ -1985,7 +2029,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
return creditCards;
}
-
+ /** getGiftCards */
public List<GenericValue> getGiftCards() {
List<GenericValue> paymentMethods = this.getPaymentMethods();
List<GenericValue> giftCards = new LinkedList<>();
@@ -2003,7 +2047,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
return giftCards;
}
- /* determines if the id supplied is a payment method or not by searching in the entity engine */
+ /** determines if the id supplied is a payment method or not by searching in the entity engine */
public boolean isPaymentMethodType(String id) {
GenericValue paymentMethodType = null;
try {
@@ -2013,7 +2057,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
return paymentMethodType != null;
}
-
+ /** getBillingAddress */
public GenericValue getBillingAddress() {
GenericValue billingAddress = null;
for (CartPaymentInfo inf : paymentInfo) {
@@ -2109,6 +2153,10 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
// Ship Group Methods
// ----------------------------------------
+ /**
+ * Add ship info int.
+ * @return the int
+ */
public int addShipInfo() {
CartShipInfo csi = new CartShipInfo();
csi.orderTypeId = getOrderType();
@@ -2116,10 +2164,19 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
return (shipInfo.size() - 1);
}
+ /**
+ * Gets ship groups.
+ * @return the ship groups
+ */
public List<CartShipInfo> getShipGroups() {
return this.shipInfo;
}
+ /**
+ * Gets ship groups.
+ * @param item the item
+ * @return the ship groups
+ */
public Map<Integer, BigDecimal> getShipGroups(ShoppingCartItem item) {
Map<Integer, BigDecimal> shipGroups = new LinkedHashMap<>();
if (item != null) {
@@ -2136,10 +2193,20 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
return shipGroups;
}
+ /**
+ * Gets ship groups.
+ * @param itemIndex the item index
+ * @return the ship groups
+ */
public Map<Integer, BigDecimal> getShipGroups(int itemIndex) {
return this.getShipGroups(this.findCartItem(itemIndex));
}
+ /**
+ * Gets ship info.
+ * @param idx the idx
+ * @return the ship info
+ */
public CartShipInfo getShipInfo(int idx) {
if (idx == -1) {
return null;
@@ -2154,6 +2221,10 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
return shipInfo.get(idx);
}
+ /**
+ * Gets ship group size.
+ * @return the ship group size
+ */
public int getShipGroupSize() {
return this.shipInfo.size();
}
@@ -2169,6 +2240,10 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
return qtyMap;
}
+ /**
+ * Clear item ship info.
+ * @param item the item
+ */
public void clearItemShipInfo(ShoppingCartItem item) {
for (int i = 0; i < shipInfo.size(); i++) {
CartShipInfo csi = this.getShipInfo(i);
@@ -2181,6 +2256,11 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
// this.cleanUpShipGroups();
}
+ /**
+ * Sets item ship group estimate.
+ * @param amount the amount
+ * @param idx the idx
+ */
public void setItemShipGroupEstimate(BigDecimal amount, int idx) {
CartShipInfo csi = this.getShipInfo(idx);
csi.shipEstimate = amount;
@@ -2257,15 +2337,15 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
return BigDecimal.ZERO;
}
-
+ /** getItemShipGroupQty */
public BigDecimal getItemShipGroupQty(int itemIndex, int idx) {
return this.getItemShipGroupQty(this.findCartItem(itemIndex), idx);
}
-
+ /** positionItemToGroup */
public void positionItemToGroup(int itemIndex, BigDecimal quantity, int fromIndex, int toIndex, boolean clearEmptyGroups) {
this.positionItemToGroup(this.findCartItem(itemIndex), quantity, fromIndex, toIndex, clearEmptyGroups);
}
-
+ /** positionItemToGroup */
public void positionItemToGroup(ShoppingCartItem item, BigDecimal quantity, int fromIndex, int toIndex, boolean clearEmptyGroups) {
if (fromIndex == toIndex || quantity.compareTo(BigDecimal.ZERO) <= 0) {
// do nothing
@@ -2305,7 +2385,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
}
- // removes 0 quantity items
+ /** checkShipItemInfo */
protected boolean checkShipItemInfo(CartShipInfo csi, CartShipInfo.CartShipItemInfo csii) {
if (csii.quantity.compareTo(BigDecimal.ZERO) == 0 || csii.item.getQuantity().compareTo(BigDecimal.ZERO) == 0) {
csi.shipItemInfo.remove(csii.item);
@@ -2313,7 +2393,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
return true;
}
-
+ /** cleanUpShipGroups */
public void cleanUpShipGroups() {
Iterator<CartShipInfo> csi = this.shipInfo.iterator();
while (csi.hasNext()) {
@@ -2324,8 +2404,8 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
}
}
-
- public int getShipInfoIndex (String shipGroupSeqId) {
+ /** getShipInfoIndex */
+ public int getShipInfoIndex(String shipGroupSeqId) {
int idx = -1;
for (int i = 0; i < shipInfo.size(); i++) {
CartShipInfo csi = shipInfo.get(i);
@@ -2404,7 +2484,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
CartShipInfo csi = this.getShipInfo(idx);
return csi.getContactMechId();
}
-
+ /** getShippingContactMechId */
public String getShippingContactMechId() {
return this.getShippingContactMechId(0);
}
@@ -2432,7 +2512,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
CartShipInfo csi = this.getShipInfo(idx);
return csi.shipmentMethodTypeId;
}
-
+ /** getShipmentMethodTypeId */
public String getShipmentMethodTypeId() {
return this.getShipmentMethodTypeId(0);
}
@@ -2500,11 +2580,11 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
CartShipInfo csi = this.getShipInfo(idx);
return csi.shippingInstructions;
}
-
+ /** getShippingInstructions */
public String getShippingInstructions() {
return this.getShippingInstructions(0);
}
-
+ /** setMaySplit */
public void setMaySplit(int idx, Boolean maySplit) {
CartShipInfo csi = this.getShipInfo(idx);
if (UtilValidate.isNotEmpty(maySplit)) {
@@ -2551,12 +2631,12 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
this.setGiftMessage(x, giftMessage);
}
}
-
+ /** getGiftMessage */
public String getGiftMessage(int idx) {
CartShipInfo csi = this.getShipInfo(idx);
return csi.giftMessage;
}
-
+ /** getGiftMessage */
public String getGiftMessage() {
return this.getGiftMessage(0);
}
@@ -2606,24 +2686,47 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
}
+ /**
+ * Gets carrier party id.
+ * @param idx the idx
+ * @return the carrier party id
+ */
public String getCarrierPartyId(int idx) {
CartShipInfo csi = this.getShipInfo(idx);
return csi.carrierPartyId;
}
+ /**
+ * Gets carrier party id.
+ * @return the carrier party id
+ */
public String getCarrierPartyId() {
return this.getCarrierPartyId(0);
}
+ /**
+ * Gets product store ship meth id.
+ * @param idx the idx
+ * @return the product store ship meth id
+ */
public String getProductStoreShipMethId(int idx) {
CartShipInfo csi = this.getShipInfo(idx);
return csi.productStoreShipMethId;
}
+ /**
+ * Gets product store ship meth id.
+ * @return the product store ship meth id
+ */
public String getProductStoreShipMethId() {
return this.getProductStoreShipMethId(0);
}
+ /**
+ * Sets product store ship meth id.
+ * @param idx the idx
+ * @param productStoreShipMethId the product store ship meth id
+ */
public void setProductStoreShipMethId(int idx, String productStoreShipMethId) {
CartShipInfo csi = this.getShipInfo(idx);
csi.productStoreShipMethId = productStoreShipMethId;
@@ -2705,30 +2808,53 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
// internal/public notes
// ----------------------------------------
+ /**
+ * Gets internal order notes.
+ * @return the internal order notes
+ */
public List<String> getInternalOrderNotes() {
return this.internalOrderNotes;
}
+ /**
+ * Gets order notes.
+ * @return the order notes
+ */
public List<String> getOrderNotes() {
return this.orderNotes;
}
+ /**
+ * Add internal order note.
+ * @param note the note
+ */
public void addInternalOrderNote(String note) {
this.internalOrderNotes.add(note);
}
+ /**
+ * Clear internal order notes.
+ */
public void clearInternalOrderNotes() {
this.internalOrderNotes.clear();
}
+
+ /**
+ * Clear order notes.
+ */
public void clearOrderNotes() {
this.orderNotes.clear();
}
+ /**
+ * Add order note.
+ * @param note the note
+ */
public void addOrderNote(String note) {
this.orderNotes.add(note);
}
- // Preset with default values some of the checkout options to get a quicker checkout process.
+ /** Preset with default values some of the checkout options to get a quicker checkout process. */
public void setDefaultCheckoutOptions(LocalDispatcher dispatcher) {
// skip the add party screen
this.setAttribute("addpty", "Y");
@@ -2781,7 +2907,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
}
- // Returns the tax amount for a ship group. */
+ /** Returns the tax amount for a ship group. */
public BigDecimal getTotalSalesTax(int shipGroup) {
CartShipInfo csi = this.getShipInfo(shipGroup);
return csi.getTotalTax(this);
@@ -2832,6 +2958,10 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
return this.getSubTotal().add(this.getTotalShipping()).add(this.getTotalSalesTax()).add(this.getOrderOtherAdjustmentTotal()).add(this.getOrderGlobalAdjustments());
}
+ /**
+ * Gets display sub total.
+ * @return the display sub total
+ */
public BigDecimal getDisplaySubTotal() {
BigDecimal itemsTotal = BigDecimal.ZERO;
for (ShoppingCartItem cartItem : this.cartLines) {
@@ -2839,6 +2969,11 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
return itemsTotal;
}
+
+ /**
+ * Gets order global adjustments.
+ * @return the order global adjustments
+ */
public BigDecimal getOrderGlobalAdjustments() {
List<GenericValue> cartAdjustments = this.getAdjustments();
List<GenericValue> tempAdjustmentsList = new LinkedList<>();
@@ -2853,11 +2988,20 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
return OrderReadHelper.calcOrderAdjustments(tempAdjustmentsList, this.getSubTotal(), false, true, true);
}
+
+ /**
+ * Gets display tax included.
+ * @return the display tax included
+ */
public BigDecimal getDisplayTaxIncluded() {
BigDecimal taxIncluded = getDisplaySubTotal().subtract(getSubTotal());
return taxIncluded.setScale(TAX_FINAL_SCALE, TAX_ROUNDING);
}
+ /**
+ * Gets display recurring sub total.
+ * @return the display recurring sub total
+ */
public BigDecimal getDisplayRecurringSubTotal() {
BigDecimal itemsTotal = BigDecimal.ZERO;
for (ShoppingCartItem cartItem : this.cartLines) {
@@ -2871,6 +3015,10 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
return this.getDisplaySubTotal().add(this.getTotalShipping()).add(this.getTotalSalesTax()).add(this.getOrderOtherAdjustmentTotal()).add(this.getOrderGlobalAdjustments());
}
+ /**
+ * Gets order other adjustment total.
+ * @return the order other adjustment total
+ */
public BigDecimal getOrderOtherAdjustmentTotal() {
return OrderReadHelper.calcOrderAdjustments(this.getAdjustments(), this.getSubTotal(), true, false, false);
}
@@ -2888,6 +3036,12 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
return itemsTotal.add(this.getOrderOtherAdjustmentTotal());
}
+
+ /**
+ * Gets sub total for promotions.
+ * @param productIds the product ids
+ * @return the sub total for promotions
+ */
public BigDecimal getSubTotalForPromotions(Set<String> productIds) {
BigDecimal itemsTotal = BigDecimal.ZERO;
for (ShoppingCartItem cartItem : this.cartLines) {
@@ -3711,7 +3865,6 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
/**
* Does an "explode", or "unitize" operation on a list of cart items.
* Resulting state for each item with quantity X is X items of quantity 1.
- *
* @param shoppingCartItems
* @param dispatcher
*/
@@ -4005,7 +4158,8 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
List<String> responses = UtilGenerics.cast(item.getAttribute("surveyResponses"));
if (responses != null) {
try {
- List<GenericValue> surveyResponses = EntityQuery.use(getDelegator()).from("SurveyResponse").where(EntityCondition.makeCondition("surveyResponseId", EntityOperator.IN, responses)).queryList();
+ List<GenericValue> surveyResponses = EntityQuery.use(getDelegator()).from("SurveyResponse")
+ .where(EntityCondition.makeCondition("surveyResponseId", EntityOperator.IN, responses)).queryList();
if (surveyResponses != null) {
for (GenericValue surveyResponse : surveyResponses) {
surveyResponse.set("orderItemSeqId", item.getOrderItemSeqId());
@@ -4074,7 +4228,8 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
if (shipGroupSeqId != null) {
groups.addAll(csi.makeItemShipGroupAndAssoc(dispatcher, this.getDelegator(), this, shipGroupSeqId));
} else {
- groups.addAll(csi.makeItemShipGroupAndAssoc(dispatcher, this.getDelegator(), this, UtilFormatOut.formatPaddedNumber(seqId, 5)));
+ groups.addAll(csi.makeItemShipGroupAndAssoc(dispatcher, this.getDelegator(), this,
+ UtilFormatOut.formatPaddedNumber(seqId, 5)));
}
seqId++;
}
@@ -4310,7 +4465,8 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
return;
}
- // Intermediate structure supplierPartyId -> { ShoppingCartItem = { originalShipGroupIndex = dropShipQuantity } } to collect drop-shippable items
+ // Intermediate structure supplierPartyId -> { ShoppingCartItem = { originalShipGroupIndex = dropShipQuantity } }
+ // to collect drop-shippable items
Map<String, Map<ShoppingCartItem, Map<Integer, BigDecimal>>> dropShipItems = new HashMap<>();
for (int shipGroupIndex = 0; shipGroupIndex < shipGroups.size(); shipGroupIndex++) {
@@ -4341,7 +4497,8 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
GenericValue productFacility = null;
try {
- productFacility = EntityQuery.use(delegator).from("ProductFacility").where("productId", productId, "facilityId", shipInfo.getFacilityId()).queryOne();
+ productFacility = EntityQuery.use(delegator).from("ProductFacility").where("productId", productId, "facilityId",
+ shipInfo.getFacilityId()).queryOne();
} catch (GenericEntityException e) {
Debug.logError("Error :" + e.getMessage(), MODULE);
e.printStackTrace();
@@ -4368,7 +4525,8 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
try {
// Get ATP for the product
- Map<String, Object> getProductInventoryAvailableResult = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.toMap("productId", productId, "facilityId", facilityId));
+ Map<String, Object> getProductInventoryAvailableResult = dispatcher.runSync("getInventoryAvailableByFacility",
+ UtilMisc.toMap("productId", productId, "facilityId", facilityId));
if (ServiceUtil.isError(getProductInventoryAvailableResult)) {
String errorMessage = ServiceUtil.getErrorMessage(getProductInventoryAvailableResult);
Debug.logError(errorMessage, MODULE);
@@ -4383,7 +4541,8 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
} catch (GenericServiceException gee) {
- Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderRunServiceGetInventoryAvailableByFacilityError", locale) + gee.getMessage(), MODULE);
+ Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderRunServiceGetInventoryAvailableByFacilityError", locale)
+ + gee.getMessage(), MODULE);
}
} else {
@@ -4398,7 +4557,9 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
// Find a supplier for the product
String supplierPartyId = null;
try {
- Map<String, Object> getSuppliersForProductResult = dispatcher.runSync("getSuppliersForProduct", UtilMisc.<String, Object>toMap("productId", productId, "quantity", dropShipQuantity, "canDropShip", "Y", "currencyUomId", getCurrency()));
+ Map<String, Object> getSuppliersForProductResult = dispatcher.runSync("getSuppliersForProduct",
+ UtilMisc.<String, Object>toMap("productId", productId, "quantity", dropShipQuantity, "canDropShip", "Y", "currencyUomId",
+ getCurrency()));
if (ServiceUtil.isError(getSuppliersForProductResult)) {
String errorMessage = ServiceUtil.getErrorMessage(getSuppliersForProductResult);
Debug.logError(errorMessage, MODULE);
@@ -4413,7 +4574,8 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
supplierPartyId = supplierProduct.getString("partyId");
}
} catch (GenericServiceException e) {
- Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderRunServiceGetSuppliersForProductError", locale) + e.getMessage(), MODULE);
+ Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderRunServiceGetSuppliersForProductError", locale)
+ + e.getMessage(), MODULE);
}
// Leave the items untouched if we couldn't find a supplier
@@ -4587,10 +4749,10 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
}
public static class ProductPromoUseInfo implements Serializable, Comparable<ProductPromoUseInfo> {
- public String productPromoId = null;
- public String productPromoCodeId = null;
- public BigDecimal totalDiscountAmount = BigDecimal.ZERO;
- public BigDecimal quantityLeftInActions = BigDecimal.ZERO;
+ private String productPromoId = null;
+ private String productPromoCodeId = null;
+ private BigDecimal totalDiscountAmount = BigDecimal.ZERO;
+ private BigDecimal quantityLeftInActions = BigDecimal.ZERO;
private Map<ShoppingCartItem, BigDecimal> usageInfoMap = null;
public ProductPromoUseInfo(String productPromoId, String productPromoCodeId, BigDecimal totalDiscountAmount, BigDecimal quantityLeftInActions, Map<ShoppingCartItem, BigDecimal> usageInfoMap) {
@@ -4601,25 +4763,56 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
this.usageInfoMap = usageInfoMap;
}
+ /**
+ * Gets product promo id.
+ *
+ * @return the product promo id
+ */
public String getProductPromoId() {
return this.productPromoId;
}
+ /**
+ * Gets product promo code id.
+ *
+ * @return the product promo code id
+ */
public String getProductPromoCodeId() {
return this.productPromoCodeId;
}
+ /**
+ * Gets total discount amount.
+ *
+ * @return the total discount amount
+ */
public BigDecimal getTotalDiscountAmount() {
return this.totalDiscountAmount;
}
+ /**
+ * Gets quantity left in actions.
+ *
+ * @return the quantity left in actions
+ */
public BigDecimal getQuantityLeftInActions() {
return this.quantityLeftInActions;
}
+ /**
+ * Gets usage info map.
+ *
+ * @return the usage info map
+ */
public Map<ShoppingCartItem, BigDecimal> getUsageInfoMap() {
return this.usageInfoMap;
}
+
+ /**
+ * Gets usage weight.
+ *
+ * @return the usage weight
+ */
public BigDecimal getUsageWeight() {
Iterator<Entry<ShoppingCartItem, BigDecimal>> lineItems = this.usageInfoMap.entrySet().iterator();
BigDecimal totalAmount = BigDecimal.ZERO;
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 1d2ff58..7835519 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
@@ -1206,7 +1206,6 @@ public class ShoppingCartEvents {
* <code>String</code> in the request object and indicate whether
* the result was an error or not and whether the errors were
* critical or not
- *
* @param result The result returned from the
* <code>ShoppingCartHelper</code>
* @param request The servlet request instance to set the error messages
@@ -1274,7 +1273,6 @@ public class ShoppingCartEvents {
/**
* set the order name of the cart based on request. right now will always return "success"
- *
*/
public static String setOrderName(HttpServletRequest request, HttpServletResponse response) {
ShoppingCart cart = getCartObject(request);
@@ -1285,7 +1283,6 @@ public class ShoppingCartEvents {
/**
* set the PO number of the cart based on request. right now will always return "success"
- *
*/
public static String setPoNumber(HttpServletRequest request, HttpServletResponse response) {
ShoppingCart cart = getCartObject(request);
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java
index 634870f..484ac43 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java
@@ -80,7 +80,6 @@ public class ShoppingCartHelper {
/**
* Changes will be made to the cart directly, as opposed
* to a copy of the cart provided.
- *
* @param cart The cart to manipulate
*/
public ShoppingCartHelper(Delegator delegator, LocalDispatcher dispatcher, ShoppingCart cart) {
@@ -386,7 +385,6 @@ public class ShoppingCartHelper {
* for each; if no parameter for a certain product in the category, or if
* quantity is 0, do not add.
* If a _ign_${itemGroupNumber} is appended to the name it will be put in that group instead of the default in the request parameter in itemGroupNumber
- *
* There are 2 options for the syntax:
* - name="quantity_${productId}" value="${quantity}
* - name="product_${whatever}" value="${productId}" (note: quantity is always 1)
@@ -1039,7 +1037,6 @@ public class ShoppingCartHelper {
}
/**
* Select an agreement
- *
* @param agreementId
*/
public Map<String, Object> selectAgreement(String agreementId) {
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 cda6cf6..78791e6 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
@@ -73,18 +73,20 @@ import org.apache.ofbiz.service.ServiceUtil;
@SuppressWarnings("serial")
public class ShoppingCartItem implements java.io.Serializable {
+ public static final MathContext GEN_ROUNDING = new MathContext(10);
+ protected static final String[] attributeNames = {"shoppingListId", "shoppingListItemSeqId", "surveyResponses",
+ "itemDesiredDeliveryDate", "itemComment", "fromInventoryItemId"};
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",
- "itemDesiredDeliveryDate", "itemComment", "fromInventoryItemId"};
-
- public static final MathContext GEN_ROUNDING = new MathContext(10);
-
private transient Delegator delegator = null;
- /** the actual or variant product */
+ /**
+ * the actual or variant product
+ */
private transient GenericValue _product = null;
- /** the virtual product if _product is a variant */
+ /**
+ * the virtual product if _product is a variant
+ */
private transient GenericValue _parentProduct = null;
private String delegatorName = null;
@@ -93,16 +95,24 @@ public class ShoppingCartItem implements java.io.Serializable {
private String supplierProductId = null;
private String parentProductId = null;
private String externalId = null;
- /** ends up in orderItemTypeId */
+ /**
+ * ends up in orderItemTypeId
+ */
private String itemType = null;
private ShoppingCart.ShoppingCartItemGroup itemGroup = null;
private String productCategoryId = null;
private String itemDescription = null;
- /** for reservations: date start*/
+ /**
+ * for reservations: date start
+ */
private Timestamp reservStart = null;
- /** for reservations: length */
+ /**
+ * for reservations: length
+ */
private BigDecimal reservLength = BigDecimal.ZERO;
- /** for reservations: number of persons using */
+ /**
+ * for reservations: number of persons using
+ */
private BigDecimal reservPersons = BigDecimal.ZERO;
private String accommodationMapId = null;
private String accommodationSpotId = null;
@@ -111,24 +121,35 @@ public class ShoppingCartItem implements java.io.Serializable {
private BigDecimal displayPrice = null;
private BigDecimal recurringBasePrice = null;
private BigDecimal recurringDisplayPrice = null;
- /** comes from price calc, used for special promo price promotion action */
+ /**
+ * comes from price calc, used for special promo price promotion action
+ */
private BigDecimal specialPromoPrice = null;
- /** for reservations: extra % 2nd person */
+ /**
+ * for reservations: extra % 2nd person
+ */
private BigDecimal reserv2ndPPPerc = BigDecimal.ZERO;
- /** for reservations: extra % Nth person */
+ /**
+ * for reservations: extra % Nth person
+ */
private BigDecimal reservNthPPPerc = BigDecimal.ZERO;
private BigDecimal listPrice = BigDecimal.ZERO;
- /** flag to know if the price have been modified */
+ /**
+ * flag to know if the price have been modified
+ */
private boolean isModifiedPrice = false;
private BigDecimal selectedAmount = BigDecimal.ZERO;
private String requirementId = null;
private String quoteId = null;
private String quoteItemSeqId = null;
// The following three optional fields are used to collect information for the OrderItemAssoc entity
- private String associatedOrderId = null; // the order Id, if any, to which the given item is associated (typically a sales order item can be associated to a purchase order item, for example in drop shipments)
+ private String associatedOrderId = null;
+ // the order Id, if any, to which the given item is associated (typically a sales order item can be associated to a purchase order item,
+ // for example in drop shipments)
private String associatedOrderItemSeqId = null; // the order item Id, if any, to which the given item is associated
- private String orderItemAssocTypeId = "PURCHASE_ORDER"; // the type of association between this item and an external item; by default, for backward compatibility, a PURCHASE association is used (i.e. the extarnal order is a sales order and this item is a purchase order item created to fulfill the sales order item
-
+ private String orderItemAssocTypeId = "PURCHASE_ORDER"; // the type of association between this item and an external item; by default,
+ // for backward compatibility, a PURCHASE association is used (i.e. the extarnal order is a sales order and this item is a purchase order item
+ // created to fulfill the sales order item
private String statusId = null;
private Map<String, String> orderItemAttributes = null;
private Map<String, Object> attributes = null;
@@ -154,29 +175,213 @@ public class ShoppingCartItem implements java.io.Serializable {
private List<GenericValue> featuresForSupplier = new LinkedList<>();
/**
+ * Clone an item.
+ */
+ public ShoppingCartItem(ShoppingCartItem item) {
+ this.delegator = item.getDelegator();
+ try {
+ this._product = item.getProduct();
+ } catch (IllegalStateException e) {
+ this._product = null;
+ }
+ try {
+ this._parentProduct = item.getParentProduct();
+ } catch (IllegalStateException e) {
+ this._parentProduct = null;
+ }
+ this.delegatorName = item.delegatorName;
+ this.prodCatalogId = item.getProdCatalogId();
+ this.productId = item.getProductId();
+ this.supplierProductId = item.getSupplierProductId();
+ this.parentProductId = item.getParentProductId();
+ this.externalId = item.getExternalId();
+ this.itemType = item.getItemType();
+ this.itemGroup = item.getItemGroup();
+ this.productCategoryId = item.getProductCategoryId();
+ this.itemDescription = item.itemDescription;
+ this.reservStart = item.getReservStart();
+ this.reservLength = item.getReservLength();
+ this.reservPersons = item.getReservPersons();
+ this.accommodationMapId = item.getAccommodationMapId();
+ this.accommodationSpotId = item.getAccommodationSpotId();
+ this.quantity = item.getQuantity();
+ this.setBasePrice(item.getBasePrice());
+ this.setDisplayPrice(item.getDisplayPrice());
+ this.setRecurringBasePrice(item.getRecurringBasePrice());
+ this.setRecurringDisplayPrice(item.getRecurringDisplayPrice());
+ this.setSpecialPromoPrice(item.getSpecialPromoPrice());
+ this.reserv2ndPPPerc = item.getReserv2ndPPPerc();
+ this.reservNthPPPerc = item.getReservNthPPPerc();
+ this.listPrice = item.getListPrice();
+ this.setIsModifiedPrice(item.getIsModifiedPrice());
+ this.selectedAmount = item.getSelectedAmount();
+ this.requirementId = item.getRequirementId();
+ this.quoteId = item.getQuoteId();
+ this.quoteItemSeqId = item.getQuoteItemSeqId();
+ this.associatedOrderId = item.getAssociatedOrderId();
+ this.associatedOrderItemSeqId = item.getAssociatedOrderItemSeqId();
+ this.orderItemAssocTypeId = item.getOrderItemAssocTypeId();
+ this.setStatusId(item.getStatusId());
+ this.orderItemAttributes = item.getOrderItemAttributes() == null ? new HashMap<>() : new HashMap<>(item.getOrderItemAttributes());
+ this.attributes = item.getAttributes() == null ? new HashMap<>() : new HashMap<>(item.getAttributes());
+ this.setOrderItemSeqId(item.getOrderItemSeqId());
+ this.locale = item.locale;
+ this.setShipBeforeDate(item.getShipBeforeDate());
+ this.setShipAfterDate(item.getShipAfterDate());
+ this.setEstimatedShipDate(item.getEstimatedShipDate());
+ this.setCancelBackOrderDate(item.getCancelBackOrderDate());
+ this.contactMechIdsMap = item.getOrderItemContactMechIds() == null ? null : new HashMap<>(item.getOrderItemContactMechIds());
+ this.orderItemPriceInfos = item.getOrderItemPriceInfos() == null ? null : new LinkedList<>(item.getOrderItemPriceInfos());
+ this.itemAdjustments.addAll(item.getAdjustments());
+ this.isPromo = item.getIsPromo();
+ this.promoQuantityUsed = item.promoQuantityUsed;
+ this.quantityUsedPerPromoCandidate = new HashMap<>(item.quantityUsedPerPromoCandidate);
+ this.quantityUsedPerPromoFailed = new HashMap<>(item.quantityUsedPerPromoFailed);
+ this.quantityUsedPerPromoActual = new HashMap<>(item.quantityUsedPerPromoActual);
+ this.additionalProductFeatureAndAppls = item.getAdditionalProductFeatureAndAppls() == null
+ ? null : new HashMap<>(item.getAdditionalProductFeatureAndAppls());
+ if (item.getAlternativeOptionProductIds() != null) {
+ List<String> tempAlternativeOptionProductIds = new LinkedList<>();
+ tempAlternativeOptionProductIds.addAll(item.getAlternativeOptionProductIds());
+ this.setAlternativeOptionProductIds(tempAlternativeOptionProductIds);
+ }
+ if (item.configWrapper != null) {
+ this.configWrapper = new ProductConfigWrapper(item.configWrapper);
+ }
+ this.featuresForSupplier.addAll(item.featuresForSupplier);
+ }
+
+ /**
+ * Cannot create shopping cart item with no parameters
+ */
+ protected ShoppingCartItem() {
+ }
+
+ /**
+ * Creates new ShoppingCartItem object.
+ * @deprecated Use {@link #ShoppingCartItem(GenericValue, Map, Map, String, Locale, String, ShoppingCartItemGroup, LocalDispatcher)} instead
+ */
+ @Deprecated
+ protected ShoppingCartItem(GenericValue product, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
+ String prodCatalogId, Locale locale, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup) {
+ this(product, additionalProductFeatureAndAppls, attributes, prodCatalogId, locale, itemType, itemGroup, null);
+ }
+
+ /**
+ * Creates new ShoppingCartItem object.
+ * @param dispatcher TODO
+ */
+ protected ShoppingCartItem(GenericValue product, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
+ String prodCatalogId, Locale locale,
+ String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher) {
+ this(product, additionalProductFeatureAndAppls, attributes, prodCatalogId, null, locale, itemType, itemGroup, null);
+ String productName = ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", this.locale, dispatcher, "html");
+ // if the productName is null or empty, see if there is an associated virtual product and get the productName of that product
+ if (UtilValidate.isEmpty(productName)) {
+ GenericValue parentProduct = this.getParentProduct();
+ if (parentProduct != null) {
+ productName = ProductContentWrapper.getProductContentAsText(parentProduct, "PRODUCT_NAME", this.locale, dispatcher, "html");
+ }
+ }
+
+ if (productName == null) {
+ this.itemDescription = "";
+ } else {
+ this.itemDescription = productName;
+ }
+ }
+
+ /**
+ * Creates new ShoppingCartItem object.
+ */
+ protected ShoppingCartItem(GenericValue product, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
+ String prodCatalogId, ProductConfigWrapper configWrapper, Locale locale, String itemType,
+ ShoppingCart.ShoppingCartItemGroup itemGroup, GenericValue parentProduct) {
+ this._product = product;
+ this.productId = _product.getString("productId");
+ this._parentProduct = parentProduct;
+ if (parentProduct != null) {
+ this.parentProductId = _parentProduct.getString("productId");
+ }
+ if (UtilValidate.isEmpty(itemType)) {
+ if (UtilValidate.isNotEmpty(_product.getString("productTypeId"))) {
+ if ("ASSET_USAGE".equals(_product.getString("productTypeId"))) {
+ this.itemType = "RENTAL_ORDER_ITEM"; // will create additional workeffort/asset usage records
+ } else if ("ASSET_USAGE_OUT_IN".equals(_product.getString("productTypeId"))) {
+ this.itemType = "RENTAL_ORDER_ITEM";
+ } else {
+ this.itemType = "PRODUCT_ORDER_ITEM";
+ }
+ } else {
+ // NOTE DEJ20100111: it seems safe to assume here that because a product is passed in that even if the product has no type this type
+ // of item still applies; thanks to whoever wrote the previous code, that's a couple of hours tracking this down that I wouldn't
+ // have minded doing something else with... :)
+ this.itemType = "PRODUCT_ORDER_ITEM";
+ }
+ } else {
+ this.itemType = itemType;
+ }
+ this.itemGroup = itemGroup;
+ this.prodCatalogId = prodCatalogId;
+ this.attributes = (attributes == null ? new HashMap<>() : attributes);
+ this.delegator = _product.getDelegator();
+ this.delegatorName = _product.getDelegator().getDelegatorName();
+ this.addAllProductFeatureAndAppls(additionalProductFeatureAndAppls);
+ this.locale = locale;
+ if (UtilValidate.isNotEmpty(configWrapper)) {
+ this.configWrapper = configWrapper;
+ if (UtilValidate.isEmpty(configWrapper.getConfigId())) { //new product configuration. Persist it
+ ProductConfigWorker.storeProductConfigWrapper(configWrapper, getDelegator());
+ }
+ }
+ }
+
+ /**
+ * Creates new ShopingCartItem object.
+ */
+ protected ShoppingCartItem(Delegator delegator, String itemTypeId, String description, String categoryId, BigDecimal basePrice,
+ Map<String, Object> attributes, String prodCatalogId, Locale locale, ShoppingCart.ShoppingCartItemGroup itemGroup) {
+ this.delegator = delegator;
+ this.itemType = itemTypeId;
+ this.itemGroup = itemGroup;
+ this.itemDescription = description;
+ this.productCategoryId = categoryId;
+ if (basePrice != null) {
+ this.setBasePrice(basePrice);
+ this.setDisplayPrice(basePrice);
+ }
+ this.attributes = (attributes == null ? new HashMap<>() : attributes);
+ this.prodCatalogId = prodCatalogId;
+ this.delegatorName = delegator.getDelegatorName();
+ this.locale = locale;
+ }
+
+ /**
* Makes a ShoppingCartItem for a purchase order item and adds it to the cart.
* NOTE: This method will get the product entity and check to make sure it can be purchased.
- *
- * @param cartLocation The location to place this item; null will place at the end
- * @param productId The primary key of the product being added
- * @param quantity The quantity to add
+ * @param cartLocation The location to place this item; null will place at the end
+ * @param productId The primary key of the product being added
+ * @param quantity The quantity to add
* @param additionalProductFeatureAndAppls Product feature/appls map
- * @param attributes All unique attributes for this item (NOT features)
- * @param prodCatalogId The catalog this item was added from
- * @param configWrapper The product configuration wrapper (null if the product is not configurable)
- * @param dispatcher LocalDispatcher object for doing promotions, etc
- * @param cart The parent shopping cart object this item will belong to
- * @param supplierProduct GenericValue of SupplierProduct entity, containing product description and prices
- * @param shipBeforeDate Request that the shipment be made before this date
- * @param shipAfterDate Request that the shipment be made after this date
- * @param cancelBackOrderDate The date which if crossed causes order cancellation
+ * @param attributes All unique attributes for this item (NOT features)
+ * @param prodCatalogId The catalog this item was added from
+ * @param configWrapper The product configuration wrapper (null if the product is not configurable)
+ * @param dispatcher LocalDispatcher object for doing promotions, etc
+ * @param cart The parent shopping cart object this item will belong to
+ * @param supplierProduct GenericValue of SupplierProduct entity, containing product description and prices
+ * @param shipBeforeDate Request that the shipment be made before this date
+ * @param shipAfterDate Request that the shipment be made after this date
+ * @param cancelBackOrderDate The date which if crossed causes order cancellation
* @return a new ShoppingCartItem object
* @throws CartItemModifyException
*/
public static ShoppingCartItem makePurchaseOrderItem(Integer cartLocation, String productId, BigDecimal selectedAmount, BigDecimal quantity,
- Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup,
- LocalDispatcher dispatcher, ShoppingCart cart, GenericValue supplierProduct, Timestamp shipBeforeDate, Timestamp shipAfterDate, Timestamp cancelBackOrderDate)
- throws CartItemModifyException, ItemNotFoundException {
+ Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
+ String prodCatalogId, ProductConfigWrapper configWrapper, String itemType,
+ ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher, ShoppingCart cart,
+ GenericValue supplierProduct, Timestamp shipBeforeDate, Timestamp shipAfterDate,
+ Timestamp cancelBackOrderDate)
+ throws CartItemModifyException, ItemNotFoundException {
Delegator delegator = cart.getDelegator();
GenericValue product = null;
@@ -194,11 +399,13 @@ public class ShoppingCartItem implements java.io.Serializable {
Debug.logWarning(excMsg, MODULE);
throw new ItemNotFoundException(excMsg);
}
- ShoppingCartItem newItem = new ShoppingCartItem(product, additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper, cart.getLocale(), itemType, itemGroup, null);
+ ShoppingCartItem newItem = new ShoppingCartItem(product, additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper,
+ cart.getLocale(), itemType, itemGroup, null);
// check to see if product is virtual
if ("Y".equals(product.getString("isVirtual"))) {
- Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId", product.getString("productId"));
+ Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId",
+ product.getString("productId"));
String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_virtual", messageMap, cart.getLocale());
@@ -209,9 +416,11 @@ public class ShoppingCartItem implements java.io.Serializable {
// check to see if the product is fully configured
if ("AGGREGATED".equals(product.getString("productTypeId")) || "AGGREGATED_SERVICE".equals(product.getString("productTypeId"))) {
if (configWrapper == null || !configWrapper.isCompleted()) {
- Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId", product.getString("productId"));
+ Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId",
+ product.getString("productId"));
- String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_not_configured_correctly", messageMap, cart.getLocale());
+ String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_not_configured_correctly", messageMap,
+ cart.getLocale());
Debug.logWarning(excMsg, MODULE);
throw new CartItemModifyException(excMsg);
@@ -229,8 +438,8 @@ public class ShoppingCartItem implements java.io.Serializable {
newItem.setSelectedAmount(selectedAmount);
}
- // set the ship before/after/dates and cancel back order date. this needs to happen before setQuantity because setQuantity causes the ship group's dates to be
- // checked versus the cart item's
+ // set the ship before/after/dates and cancel back order date. this needs to happen before setQuantity because setQuantity causes the ship
+ // group's dates to be checked versus the cart item's
newItem.setShipBeforeDate(shipBeforeDate != null ? shipBeforeDate : cart.getDefaultShipBeforeDate());
newItem.setShipAfterDate(shipAfterDate != null ? shipAfterDate : cart.getDefaultShipAfterDate());
newItem.setCancelBackOrderDate(cancelBackOrderDate != null ? cancelBackOrderDate : cart.getCancelBackOrderDate());
@@ -263,7 +472,6 @@ public class ShoppingCartItem implements java.io.Serializable {
/**
* Makes a ShoppingCartItem and adds it to the cart.
* NOTE: This method will get the product entity and check to make sure it can be purchased.
- *
* @param cartLocation The location to place this item; null will place at the end
* @param productId The primary key of the product being added
* @param selectedAmount Optional. Defaults to 0.0. If a selectedAmount is needed (complements the quantity value), pass it in here.
@@ -284,14 +492,18 @@ public class ShoppingCartItem implements java.io.Serializable {
* @param cart Required. The parent shopping cart object this item will belong to.
* @param triggerExternalOpsBool Optional. Defaults to true. Trigger external operations (like promotions and such)?
* @param triggerPriceRulesBool Optional. Defaults to true. Trigger the price rules to calculate the price for this item?
- *
* @return a new ShoppingCartItem object
* @throws CartItemModifyException
*/
- public static ShoppingCartItem makeItem(Integer cartLocation, String productId, BigDecimal selectedAmount, BigDecimal quantity, BigDecimal unitPrice,
- Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, Timestamp shipBeforeDate, Timestamp shipAfterDate,
- Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper,
- String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher, ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, String parentProductId, Boolean skipInventoryChecks, Boolean skipProductChecks)
+ public static ShoppingCartItem makeItem(Integer cartLocation, String productId, BigDecimal selectedAmount, BigDecimal quantity,
+ BigDecimal unitPrice,
+ Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, Timestamp shipBeforeDate,
+ Timestamp shipAfterDate,
+ Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
+ String prodCatalogId, ProductConfigWrapper configWrapper,
+ String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher,
+ ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, String parentProductId,
+ Boolean skipInventoryChecks, Boolean skipProductChecks)
throws CartItemModifyException, ItemNotFoundException {
return makeItem(cartLocation, productId, selectedAmount, quantity, unitPrice,
@@ -305,37 +517,42 @@ public class ShoppingCartItem implements java.io.Serializable {
/*
* Makes a ShoppingCartItem and adds it to the cart.
* @param reserveAfterDate Optional.
- */
- public static ShoppingCartItem makeItem(Integer cartLocation, String productId, BigDecimal selectedAmount, BigDecimal quantity, BigDecimal unitPrice,
- Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId, Timestamp shipBeforeDate, Timestamp shipAfterDate,
- Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper,
- String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher, ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, String parentProductId, Boolean skipInventoryChecks, Boolean skipProductChecks)
- throws CartItemModifyException, ItemNotFoundException {
+ */
+ public static ShoppingCartItem makeItem(Integer cartLocation, String productId, BigDecimal selectedAmount, BigDecimal quantity,
+ BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId,
+ String accommodationSpotId, Timestamp shipBeforeDate, Timestamp shipAfterDate,
+ Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId,
+ ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher,
+ ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, String parentProductId, Boolean skipInventoryChecks,
+ Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException {
return makeItem(cartLocation, productId, selectedAmount, quantity, unitPrice,
- reservStart, reservLength, reservPersons, accommodationMapId, accommodationSpotId, shipBeforeDate, shipAfterDate, null,
- additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper,
- itemType, itemGroup, dispatcher, cart, triggerExternalOpsBool, triggerPriceRulesBool,
- parentProductId, skipInventoryChecks, skipProductChecks);
+ reservStart, reservLength, reservPersons, accommodationMapId, accommodationSpotId, shipBeforeDate, shipAfterDate, null,
+ additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper,
+ itemType, itemGroup, dispatcher, cart, triggerExternalOpsBool, triggerPriceRulesBool,
+ parentProductId, skipInventoryChecks, skipProductChecks);
}
/**
* Makes a ShoppingCartItem and adds it to the cart.
- * @param accommodationMapId Optional. reservations add into workeffort
+ * @param accommodationMapId Optional. reservations add into workeffort
* @param accommodationSpotId Optional. reservations add into workeffort
*/
- public static ShoppingCartItem makeItem(Integer cartLocation, String productId, BigDecimal selectedAmount, BigDecimal quantity, BigDecimal unitPrice,
- Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId, Timestamp shipBeforeDate, Timestamp shipAfterDate, Timestamp reserveAfterDate,
- Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper,
- String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher, ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, String parentProductId, Boolean skipInventoryChecks, Boolean skipProductChecks)
+ public static ShoppingCartItem makeItem(Integer cartLocation, String productId, BigDecimal selectedAmount, BigDecimal quantity,
+ BigDecimal unitPrice,
+ Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId,
+ String accommodationSpotId, Timestamp shipBeforeDate, Timestamp shipAfterDate, Timestamp reserveAfterDate,
+ Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
+ String prodCatalogId, ProductConfigWrapper configWrapper,
+ String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher,
+ ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, String parentProductId,
+ Boolean skipInventoryChecks, Boolean skipProductChecks)
throws CartItemModifyException, ItemNotFoundException {
Delegator delegator = cart.getDelegator();
GenericValue product = findProduct(delegator, skipProductChecks, prodCatalogId, productId, cart.getLocale());
GenericValue parentProduct = null;
- if (parentProductId != null)
- {
- try
- {
+ if (parentProductId != null) {
+ try {
parentProduct = EntityQuery.use(delegator).from("Product").where("productId", parentProductId).cache().queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.toString(), MODULE);
@@ -351,7 +568,6 @@ public class ShoppingCartItem implements java.io.Serializable {
* Makes a ShoppingCartItem and adds it to the cart.
* WARNING: This method does not check if the product is in a purchase category.
* rental fields were added.
- *
* @param cartLocation The location to place this item; null will place at the end
* @param product The product entity relating to the product being added
* @param selectedAmount Optional. Defaults to 0.0. If a selectedAmount is needed (complements the quantity value), pass it in here.
@@ -372,36 +588,45 @@ public class ShoppingCartItem implements java.io.Serializable {
* @param cart Required. The parent shopping cart object this item will belong to.
* @param triggerExternalOpsBool Optional. Defaults to true. Trigger external operations (like promotions and such)?
* @param triggerPriceRulesBool Optional. Defaults to true. Trigger the price rules to calculate the price for this item?
- *
* @return a new ShoppingCartItem object
* @throws CartItemModifyException
*/
public static ShoppingCartItem makeItem(Integer cartLocation, GenericValue product, BigDecimal selectedAmount,
- BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
- Timestamp shipBeforeDate, Timestamp shipAfterDate, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
- String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher,
- ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, GenericValue parentProduct, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException {
+ BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength,
+ BigDecimal reservPersons,
+ Timestamp shipBeforeDate, Timestamp shipAfterDate, Map<String,
+ GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
+ String prodCatalogId, ProductConfigWrapper configWrapper, String itemType,
+ ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher,
+ ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool,
+ GenericValue parentProduct, Boolean skipInventoryChecks, Boolean skipProductChecks)
+ throws CartItemModifyException {
return makeItem(cartLocation, product, selectedAmount,
- quantity, unitPrice, reservStart, reservLength, reservPersons,
- null, null, shipBeforeDate, shipAfterDate, null, additionalProductFeatureAndAppls, attributes,
- prodCatalogId, configWrapper, itemType, itemGroup, dispatcher, cart,
- triggerExternalOpsBool, triggerPriceRulesBool, parentProduct, skipInventoryChecks, skipProductChecks);
+ quantity, unitPrice, reservStart, reservLength, reservPersons,
+ null, null, shipBeforeDate, shipAfterDate, null, additionalProductFeatureAndAppls, attributes,
+ prodCatalogId, configWrapper, itemType, itemGroup, dispatcher, cart,
+ triggerExternalOpsBool, triggerPriceRulesBool, parentProduct, skipInventoryChecks, skipProductChecks);
}
/**
* Makes a ShoppingCartItem and adds it to the cart.
- * @param accommodationMapId Optional. reservations add into workeffort
+ * @param accommodationMapId Optional. reservations add into workeffort
* @param accommodationSpotId Optional. reservations add into workeffort
- */
+ */
public static ShoppingCartItem makeItem(Integer cartLocation, GenericValue product, BigDecimal selectedAmount,
- BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
- String accommodationMapId, String accommodationSpotId,
- Timestamp shipBeforeDate, Timestamp shipAfterDate, Timestamp reserveAfterDate, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
- String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher,
- ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, GenericValue parentProduct, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException {
-
- ShoppingCartItem newItem = new ShoppingCartItem(product, additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper, cart.getLocale(), itemType, itemGroup, parentProduct);
+ BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength,
+ BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId,
+ Timestamp shipBeforeDate, Timestamp shipAfterDate, Timestamp reserveAfterDate,
+ Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
+ String prodCatalogId, ProductConfigWrapper configWrapper, String itemType,
+ ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher,
+ ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool,
+ GenericValue parentProduct, Boolean skipInventoryChecks, Boolean skipProductChecks)
+ throws CartItemModifyException {
+
+ ShoppingCartItem newItem = new ShoppingCartItem(product, additionalProductFeatureAndAppls, attributes, prodCatalogId, configWrapper,
+ cart.getLocale(), itemType, itemGroup, parentProduct);
selectedAmount = selectedAmount == null ? BigDecimal.ZERO : selectedAmount;
unitPrice = unitPrice == null ? BigDecimal.ZERO : unitPrice;
@@ -412,7 +637,8 @@ public class ShoppingCartItem implements java.io.Serializable {
// check to see if product is virtual
if ("Y".equals(product.getString("isVirtual"))) {
- Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId", product.getString("productId"));
+ Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId",
+ product.getString("productId"));
String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_virtual", messageMap, cart.getLocale());
@@ -518,7 +744,7 @@ public class ShoppingCartItem implements java.io.Serializable {
}
public static GenericValue findProduct(Delegator delegator, boolean skipProductChecks, String prodCatalogId,
- String productId, Locale locale) throws ItemNotFoundException {
+ String productId, Locale locale) throws ItemNotFoundException {
GenericValue product;
try {
@@ -529,7 +755,8 @@ public class ShoppingCartItem implements java.io.Serializable {
if (!skipProductChecks && product != null && purchaseProductCategoryId != null) {
if (!CategoryWorker.isProductInCategory(delegator, product.getString("productId"), purchaseProductCategoryId)) {
// a Purchase allow productCategoryId was found, but the product is not in the category, axe it...
- Debug.logWarning("Product [" + productId + "] is not in the purchase allow category [" + purchaseProductCategoryId + "] and cannot be purchased", MODULE);
+ Debug.logWarning("Product [" + productId + "] is not in the purchase allow category [" + purchaseProductCategoryId
+ + "] and cannot be purchased", MODULE);
product = null;
}
}
@@ -548,7 +775,8 @@ public class ShoppingCartItem implements java.io.Serializable {
return product;
}
- public static void isValidCartProduct(ProductConfigWrapper configWrapper, GenericValue product, Timestamp nowTimestamp, Locale locale) throws CartItemModifyException {
+ public static void isValidCartProduct(ProductConfigWrapper configWrapper, GenericValue product, Timestamp nowTimestamp, Locale locale)
+ throws CartItemModifyException {
// check to see if introductionDate hasn't passed yet
if (product.get("introductionDate") != null && nowTimestamp.before(product.getTimestamp("introductionDate"))) {
Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"),
@@ -581,321 +809,71 @@ public class ShoppingCartItem implements java.io.Serializable {
String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_not_configured_correctly",
messageMap, locale);
Debug.logWarning(excMsg, MODULE);
- throw new CartItemModifyException(excMsg);
- }
- }
- }
-
- /**
- * Makes a non-product ShoppingCartItem and adds it to the cart.
- * NOTE: This is only for non-product items; items without a product entity (work items, bulk items, etc)
- *
- * @param cartLocation The location to place this item; null will place at the end
- * @param itemType The OrderItemTypeId for the item being added
- * @param itemDescription The optional description of the item
- * @param productCategoryId The optional category the product *will* go in
- * @param basePrice The price for this item
- * @param selectedAmount
- * @param quantity The quantity to add
- * @param attributes All unique attributes for this item (NOT features)
- * @param prodCatalogId The catalog this item was added from
- * @param dispatcher LocalDispatcher object for doing promotions, etc
- * @param cart The parent shopping cart object this item will belong to
- * @param triggerExternalOpsBool Indicates if we should run external operations (promotions, auto-save, etc)
- * @return a new ShoppingCartItem object
- * @throws CartItemModifyException
- */
- public static ShoppingCartItem makeItem(Integer cartLocation, String itemType, String itemDescription, String productCategoryId,
- BigDecimal basePrice, BigDecimal selectedAmount, BigDecimal quantity, Map<String, Object> attributes, String prodCatalogId, ShoppingCart.ShoppingCartItemGroup itemGroup,
- LocalDispatcher dispatcher, ShoppingCart cart, Boolean triggerExternalOpsBool) throws CartItemModifyException {
-
- Delegator delegator = cart.getDelegator();
- ShoppingCartItem newItem = new ShoppingCartItem(delegator, itemType, itemDescription, productCategoryId, basePrice, attributes, prodCatalogId, cart.getLocale(), itemGroup);
-
- // add to cart before setting quantity so that we can get order total, etc
- if (cartLocation == null) {
- cart.addItemToEnd(newItem);
- } else {
- cart.addItem(cartLocation, newItem);
- }
-
- boolean triggerExternalOps = triggerExternalOpsBool == null ? true : triggerExternalOpsBool;
-
- try {
- newItem.setQuantity(quantity, dispatcher, cart, triggerExternalOps);
- } catch (CartItemModifyException e) {
- cart.removeEmptyCartItems();
- throw e;
- }
-
- if (selectedAmount != null) {
- newItem.setSelectedAmount(selectedAmount);
- }
- return newItem;
- }
-
- /** Clone an item. */
- public ShoppingCartItem(ShoppingCartItem item) {
- this.delegator = item.getDelegator();
- try {
- this._product = item.getProduct();
- } catch (IllegalStateException e) {
- this._product = null;
- }
- try {
- this._parentProduct = item.getParentProduct();
- } catch (IllegalStateException e) {
- this._parentProduct = null;
- }
- this.delegatorName = item.delegatorName;
- this.prodCatalogId = item.getProdCatalogId();
- this.productId = item.getProductId();
- this.supplierProductId = item.getSupplierProductId();
- this.parentProductId = item.getParentProductId();
- this.externalId = item.getExternalId();
- this.itemType = item.getItemType();
- this.itemGroup = item.getItemGroup();
- this.productCategoryId = item.getProductCategoryId();
- this.itemDescription = item.itemDescription;
- this.reservStart = item.getReservStart();
- this.reservLength = item.getReservLength();
- this.reservPersons = item.getReservPersons();
- this.accommodationMapId = item.getAccommodationMapId();
- this.accommodationSpotId = item.getAccommodationSpotId();
- this.quantity = item.getQuantity();
- this.setBasePrice(item.getBasePrice());
- this.setDisplayPrice(item.getDisplayPrice());
- this.setRecurringBasePrice(item.getRecurringBasePrice());
- this.setRecurringDisplayPrice(item.getRecurringDisplayPrice());
- this.setSpecialPromoPrice(item.getSpecialPromoPrice());
- this.reserv2ndPPPerc = item.getReserv2ndPPPerc();
- this.reservNthPPPerc = item.getReservNthPPPerc();
- this.listPrice = item.getListPrice();
- this.setIsModifiedPrice(item.getIsModifiedPrice());
- this.selectedAmount = item.getSelectedAmount();
- this.requirementId = item.getRequirementId();
- this.quoteId = item.getQuoteId();
- this.quoteItemSeqId = item.getQuoteItemSeqId();
- this.associatedOrderId = item.getAssociatedOrderId();
- this.associatedOrderItemSeqId = item.getAssociatedOrderItemSeqId();
- this.orderItemAssocTypeId = item.getOrderItemAssocTypeId();
- this.setStatusId(item.getStatusId());
- this.orderItemAttributes = item.getOrderItemAttributes() == null ? new HashMap<>() : new HashMap<>(item.getOrderItemAttributes());
- this.attributes = item.getAttributes() == null ? new HashMap<>() : new HashMap<>(item.getAttributes());
- this.setOrderItemSeqId(item.getOrderItemSeqId());
- this.locale = item.locale;
- this.setShipBeforeDate(item.getShipBeforeDate());
- this.setShipAfterDate(item.getShipAfterDate());
- this.setEstimatedShipDate(item.getEstimatedShipDate());
- this.setCancelBackOrderDate(item.getCancelBackOrderDate());
- this.contactMechIdsMap = item.getOrderItemContactMechIds() == null ? null : new HashMap<>(item.getOrderItemContactMechIds());
- this.orderItemPriceInfos = item.getOrderItemPriceInfos() == null ? null : new LinkedList<>(item.getOrderItemPriceInfos());
- this.itemAdjustments.addAll(item.getAdjustments());
- this.isPromo = item.getIsPromo();
- this.promoQuantityUsed = item.promoQuantityUsed;
- this.quantityUsedPerPromoCandidate = new HashMap<>(item.quantityUsedPerPromoCandidate);
- this.quantityUsedPerPromoFailed = new HashMap<>(item.quantityUsedPerPromoFailed);
- this.quantityUsedPerPromoActual = new HashMap<>(item.quantityUsedPerPromoActual);
- this.additionalProductFeatureAndAppls = item.getAdditionalProductFeatureAndAppls() == null
- ? null : new HashMap<>(item.getAdditionalProductFeatureAndAppls());
- if (item.getAlternativeOptionProductIds() != null) {
- List<String> tempAlternativeOptionProductIds = new LinkedList<>();
- tempAlternativeOptionProductIds.addAll(item.getAlternativeOptionProductIds());
- this.setAlternativeOptionProductIds(tempAlternativeOptionProductIds);
- }
- if (item.configWrapper != null) {
- this.configWrapper = new ProductConfigWrapper(item.configWrapper);
- }
- this.featuresForSupplier.addAll(item.featuresForSupplier);
- }
-
- /** Cannot create shopping cart item with no parameters */
- protected ShoppingCartItem() { }
-
- /** Creates new ShoppingCartItem object.
- * @deprecated Use {@link #ShoppingCartItem(GenericValue, Map, Map, String, Locale, String, ShoppingCartItemGroup, LocalDispatcher)} instead*/
- @Deprecated
- protected ShoppingCartItem(GenericValue product, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, Locale locale, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup) {
- this(product, additionalProductFeatureAndAppls, attributes, prodCatalogId, locale, itemType, itemGroup, null);
- }
-
- /** Creates new ShoppingCartItem object.
- * @param dispatcher TODO*/
- protected ShoppingCartItem(GenericValue product, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, Locale locale,
- String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher) {
- this(product, additionalProductFeatureAndAppls, attributes, prodCatalogId, null, locale, itemType, itemGroup, null);
- String productName = ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", this.locale, dispatcher, "html");
- // if the productName is null or empty, see if there is an associated virtual product and get the productName of that product
- if (UtilValidate.isEmpty(productName)) {
- GenericValue parentProduct = this.getParentProduct();
- if (parentProduct != null) {
- productName = ProductContentWrapper.getProductContentAsText(parentProduct, "PRODUCT_NAME", this.locale, dispatcher, "html");
- }
- }
-
- if (productName == null) {
- this.itemDescription = "";
- } else {
- this.itemDescription = productName;
- }
- }
-
- /** Creates new ShoppingCartItem object. */
- protected ShoppingCartItem(GenericValue product, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, Locale locale, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, GenericValue parentProduct) {
- this._product = product;
- this.productId = _product.getString("productId");
- this._parentProduct = parentProduct;
- if (parentProduct != null) {
- this.parentProductId = _parentProduct.getString("productId");
- }
- if (UtilValidate.isEmpty(itemType)) {
- if (UtilValidate.isNotEmpty(_product.getString("productTypeId"))) {
- if ("ASSET_USAGE".equals(_product.getString("productTypeId"))) {
- this.itemType = "RENTAL_ORDER_ITEM"; // will create additional workeffort/asset usage records
- } else if ("ASSET_USAGE_OUT_IN".equals(_product.getString("productTypeId"))) {
- this.itemType = "RENTAL_ORDER_ITEM";
- } else {
- this.itemType = "PRODUCT_ORDER_ITEM";
- }
- } else {
- // NOTE DEJ20100111: it seems safe to assume here that because a product is passed in that even if the product has no type this type of item still applies; thanks to whoever wrote the previous code, that's a couple of hours tracking this down that I wouldn't have minded doing something else with... :)
- this.itemType = "PRODUCT_ORDER_ITEM";
- }
- } else {
- this.itemType = itemType;
- }
- this.itemGroup = itemGroup;
- this.prodCatalogId = prodCatalogId;
- this.attributes = (attributes == null ? new HashMap<>() : attributes);
- this.delegator = _product.getDelegator();
- this.delegatorName = _product.getDelegator().getDelegatorName();
- this.addAllProductFeatureAndAppls(additionalProductFeatureAndAppls);
- this.locale = locale;
- if (UtilValidate.isNotEmpty(configWrapper)) {
- this.configWrapper = configWrapper;
- if (UtilValidate.isEmpty(configWrapper.getConfigId())) { //new product configuration. Persist it
- ProductConfigWorker.storeProductConfigWrapper(configWrapper, getDelegator());
- }
- }
- }
-
- /** Creates new ShopingCartItem object. */
- protected ShoppingCartItem(Delegator delegator, String itemTypeId, String description, String categoryId, BigDecimal basePrice, Map<String, Object> attributes, String prodCatalogId, Locale locale, ShoppingCart.ShoppingCartItemGroup itemGroup) {
- this.delegator = delegator;
- this.itemType = itemTypeId;
- this.itemGroup = itemGroup;
- this.itemDescription = description;
- this.productCategoryId = categoryId;
- if (basePrice != null) {
- this.setBasePrice(basePrice);
- this.setDisplayPrice(basePrice);
- }
- this.attributes = (attributes == null ? new HashMap<>() : attributes);
- this.prodCatalogId = prodCatalogId;
- this.delegatorName = delegator.getDelegatorName();
- this.locale = locale;
- }
-
- public String getProdCatalogId() {
- return this.prodCatalogId;
- }
-
- public void setExternalId(String externalId) {
- this.externalId = externalId;
- }
-
- public String getExternalId() {
- return this.externalId;
- }
-
- /** Sets the user selected amount */
- public void setSelectedAmount(BigDecimal selectedAmount) {
- this.selectedAmount = selectedAmount;
- }
-
- /** Returns the user selected amount */
- public BigDecimal getSelectedAmount() {
- return this.selectedAmount;
- }
-
- /** Sets the base price for the item; use with caution */
- public void setBasePrice(BigDecimal basePrice) {
- this.basePrice = basePrice;
- }
-
- /** Sets the display price for the item; use with caution */
- public void setDisplayPrice(BigDecimal displayPrice) {
- this.displayPrice = displayPrice;
- }
-
- /** Sets the base price for the item; use with caution */
- public void setRecurringBasePrice(BigDecimal recurringBasePrice) {
- this.recurringBasePrice = recurringBasePrice;
- }
-
- /** Sets the display price for the item; use with caution */
- public void setRecurringDisplayPrice(BigDecimal recurringDisplayPrice) {
- this.recurringDisplayPrice = recurringDisplayPrice;
- }
-
- public void setSpecialPromoPrice(BigDecimal specialPromoPrice) {
- this.specialPromoPrice = specialPromoPrice;
- }
-
- /** Sets the extra % for second person */
- public void setReserv2ndPPPerc(BigDecimal reserv2ndPPPerc) {
- this.reserv2ndPPPerc = reserv2ndPPPerc;
- }
- /** Sets the extra % for third and following person */
- public void setReservNthPPPerc(BigDecimal reservNthPPPerc) {
- this.reservNthPPPerc = reservNthPPPerc;
- }
- /** Sets the reservation start date */
- public void setReservStart(Timestamp reservStart) {
- this.reservStart = reservStart != null ? (Timestamp) reservStart.clone() : null;
- }
- /** Sets the reservation length */
- public void setReservLength(BigDecimal reservLength) {
- this.reservLength = reservLength;
- }
- /** Sets number of persons using the reservation */
- public void setReservPersons(BigDecimal reservPersons) {
- this.reservPersons = reservPersons;
- }
- /** Sets accommodationId using the reservation */
- public void setAccommodationId(String accommodationMapId, String accommodationSpotId) {
- this.accommodationMapId = accommodationMapId;
- this.accommodationSpotId = accommodationSpotId;
+ throw new CartItemModifyException(excMsg);
+ }
+ }
}
- /** Sets the quantity for the item and validates the change in quantity, etc */
- public void setQuantity(BigDecimal quantity, LocalDispatcher dispatcher, ShoppingCart cart) throws CartItemModifyException {
- this.setQuantity(quantity, dispatcher, cart, true);
- }
+ /**
+ * Makes a non-product ShoppingCartItem and adds it to the cart.
+ * NOTE: This is only for non-product items; items without a product entity (work items, bulk items, etc)
+ * @param cartLocation The location to place this item; null will place at the end
+ * @param itemType The OrderItemTypeId for the item being added
+ * @param itemDescription The optional description of the item
+ * @param productCategoryId The optional category the product *will* go in
+ * @param basePrice The price for this item
+ * @param selectedAmount
+ * @param quantity The quantity to add
+ * @param attributes All unique attributes for this item (NOT features)
+ * @param prodCatalogId The catalog this item was added from
+ * @param dispatcher LocalDispatcher object for doing promotions, etc
+ * @param cart The parent shopping cart object this item will belong to
+ * @param triggerExternalOpsBool Indicates if we should run external operations (promotions, auto-save, etc)
+ * @return a new ShoppingCartItem object
+ * @throws CartItemModifyException
+ */
+ public static ShoppingCartItem makeItem(Integer cartLocation, String itemType, String itemDescription, String productCategoryId,
+ BigDecimal basePrice, BigDecimal selectedAmount, BigDecimal quantity, Map<String, Object> attributes,
+ String prodCatalogId, ShoppingCart.ShoppingCartItemGroup itemGroup,
+ LocalDispatcher dispatcher, ShoppingCart cart, Boolean triggerExternalOpsBool)
+ throws CartItemModifyException {
- /** Sets the quantity for the item and validates the change in quantity, etc */
- public void setQuantity(BigDecimal quantity, LocalDispatcher dispatcher, ShoppingCart cart, boolean triggerExternalOps) throws CartItemModifyException {
- this.setQuantity(quantity, dispatcher, cart, triggerExternalOps, true);
- }
+ Delegator delegator = cart.getDelegator();
+ ShoppingCartItem newItem = new ShoppingCartItem(delegator, itemType, itemDescription, productCategoryId, basePrice, attributes, prodCatalogId, cart.getLocale(), itemGroup);
- /** Sets the quantity for the item and validates the change in quantity, etc */
- public void setQuantity(BigDecimal quantity, LocalDispatcher dispatcher, ShoppingCart cart, boolean triggerExternalOps, boolean resetShipGroup) throws CartItemModifyException {
- this.setQuantity(quantity, dispatcher, cart, triggerExternalOps, resetShipGroup, true, false);
- }
+ // add to cart before setting quantity so that we can get order total, etc
+ if (cartLocation == null) {
+ cart.addItemToEnd(newItem);
+ } else {
+ cart.addItem(cartLocation, newItem);
+ }
- /** Sets the quantity for the item and validates the change in quantity, etc */
- public void setQuantity(BigDecimal quantity, LocalDispatcher dispatcher, ShoppingCart cart, boolean triggerExternalOps, boolean resetShipGroup, boolean updateProductPrice) throws CartItemModifyException {
- this.setQuantity(quantity, dispatcher, cart, triggerExternalOps, resetShipGroup, updateProductPrice, false);
+ boolean triggerExternalOps = triggerExternalOpsBool == null ? true : triggerExternalOpsBool;
+
+ try {
+ newItem.setQuantity(quantity, dispatcher, cart, triggerExternalOps);
+ } catch (CartItemModifyException e) {
+ cart.removeEmptyCartItems();
+ throw e;
+ }
+
+ if (selectedAmount != null) {
+ newItem.setSelectedAmount(selectedAmount);
+ }
+ return newItem;
}
- /** returns "OK" when the product can be booked or returns a string with the dates the related fixed Asset is not available */
+ /**
+ * returns "OK" when the product can be booked or returns a string with the dates the related fixed Asset is not available
+ */
public static String checkAvailability(String productId, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, ShoppingCart cart) {
Delegator delegator = cart.getDelegator();
// find related fixedAsset
List<GenericValue> selFixedAssetProduct = null;
GenericValue fixedAssetProduct = null;
try {
- selFixedAssetProduct = EntityQuery.use(delegator).from("FixedAssetProduct").where("productId", productId, "fixedAssetProductTypeId", "FAPT_USE").filterByDate(UtilDateTime.nowTimestamp(), "fromDate", "thruDate").queryList();
+ selFixedAssetProduct = EntityQuery.use(delegator).from("FixedAssetProduct").where("productId", productId,
+ "fixedAssetProductTypeId", "FAPT_USE").filterByDate(UtilDateTime.nowTimestamp(), "fromDate", "thruDate").queryList();
} catch (GenericEntityException e) {
Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productId", productId);
String msg = UtilProperties.getMessage(RES_ERROR, "item.cannot_find_Fixed_Asset", messageMap, cart.getLocale());
@@ -953,7 +931,8 @@ public class ShoppingCartItem implements java.io.Serializable {
// find an existing Day exception record
Timestamp exceptionDateStartTime = new Timestamp((reservStart.getTime() + (dayCount++ * 86400000)));
try {
- techDataCalendarExcDay = EntityQuery.use(delegator).from("TechDataCalendarExcDay").where("calendarId", fixedAsset.get("calendarId"), "exceptionDateStartTime", exceptionDateStartTime).queryOne();
+ techDataCalendarExcDay = EntityQuery.use(delegator).from("TechDataCalendarExcDay").where("calendarId", fixedAsset.get("calendarId"),
+ "exceptionDateStartTime", exceptionDateStartTime).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e, MODULE);
}
@@ -994,10 +973,94 @@ public class ShoppingCartItem implements java.io.Serializable {
return msg;
}
- protected boolean isInventoryAvailableOrNotRequired(BigDecimal quantity, String productStoreId, LocalDispatcher dispatcher) throws CartItemModifyException {
+ public static String getPurchaseOrderItemDescription(GenericValue product, GenericValue supplierProduct, Locale locale,
+ LocalDispatcher dispatcher) {
+
+ String itemDescription = null;
+
+ if (supplierProduct != null) {
+ itemDescription = supplierProduct.getString("supplierProductName");
+ }
+
+ if (UtilValidate.isEmpty(itemDescription)) {
+ itemDescription = ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", locale, dispatcher, "html");
+ }
+
+ return itemDescription;
+ }
+
+ public String getProdCatalogId() {
+ return this.prodCatalogId;
+ }
+
+ public String getExternalId() {
+ return this.externalId;
+ }
+
+ public void setExternalId(String externalId) {
+ this.externalId = externalId;
+ }
+
+ /**
+ * Returns the user selected amount
+ */
+ public BigDecimal getSelectedAmount() {
+ return this.selectedAmount;
+ }
+
+ /**
+ * Sets the user selected amount
+ */
+ public void setSelectedAmount(BigDecimal selectedAmount) {
+ this.selectedAmount = selectedAmount;
+ }
+
+ /**
+ * Sets accommodationId using the reservation
+ */
+ public void setAccommodationId(String accommodationMapId, String accommodationSpotId) {
+ this.accommodationMapId = accommodationMapId;
+ this.accommodationSpotId = accommodationSpotId;
+ }
+
+ /**
+ * Sets the quantity for the item and validates the change in quantity, etc
+ */
+ public void setQuantity(BigDecimal quantity, LocalDispatcher dispatcher, ShoppingCart cart) throws CartItemModifyException {
+ this.setQuantity(quantity, dispatcher, cart, true);
+ }
+
+ /**
+ * Sets the quantity for the item and validates the change in quantity, etc
+ */
+ public void setQuantity(BigDecimal quantity, LocalDispatcher dispatcher, ShoppingCart cart, boolean triggerExternalOps)
+ throws CartItemModifyException {
+ this.setQuantity(quantity, dispatcher, cart, triggerExternalOps, true);
+ }
+
+ /**
+ * Sets the quantity for the item and validates the change in quantity, etc
+ */
+ public void setQuantity(BigDecimal quantity, LocalDispatcher dispatcher, ShoppingCart cart, boolean triggerExternalOps, boolean resetShipGroup)
+ throws CartItemModifyException {
+ this.setQuantity(quantity, dispatcher, cart, triggerExternalOps, resetShipGroup, true, false);
+ }
+
+ /**
+ * Sets the quantity for the item and validates the change in quantity, etc
+ */
+ public void setQuantity(BigDecimal quantity, LocalDispatcher dispatcher, ShoppingCart cart, boolean triggerExternalOps, boolean resetShipGroup,
+ boolean updateProductPrice) throws CartItemModifyException {
+ this.setQuantity(quantity, dispatcher, cart, triggerExternalOps, resetShipGroup, updateProductPrice, false);
+ }
+
+ protected boolean isInventoryAvailableOrNotRequired(BigDecimal quantity, String productStoreId, LocalDispatcher dispatcher)
+ throws CartItemModifyException {
boolean inventoryAvailable = true;
try {
- Map<String, Object> invReqResult = dispatcher.runSync("isStoreInventoryAvailableOrNotRequired", UtilMisc.<String, Object>toMap("productStoreId", productStoreId, "productId", productId, "product", this.getProduct(), "quantity", quantity));
+ Map<String, Object> invReqResult = dispatcher.runSync("isStoreInventoryAvailableOrNotRequired",
+ UtilMisc.<String, Object>toMap("productStoreId", productStoreId, "productId", productId, "product", this.getProduct(),
+ "quantity", quantity));
if (ServiceUtil.isError(invReqResult)) {
String errorMessage = ServiceUtil.getErrorMessage(invReqResult);
Debug.logError(errorMessage, MODULE);
@@ -1013,7 +1076,7 @@ public class ShoppingCartItem implements java.io.Serializable {
}
protected void setQuantity(BigDecimal quantity, LocalDispatcher dispatcher, ShoppingCart cart, boolean triggerExternalOps, boolean resetShipGroup,
- boolean updateProductPrice, boolean skipInventoryChecks) throws CartItemModifyException {
+ boolean updateProductPrice, boolean skipInventoryChecks) throws CartItemModifyException {
if (this.quantity.compareTo(quantity) == 0) {
return;
}
@@ -1028,11 +1091,12 @@ public class ShoppingCartItem implements java.io.Serializable {
String productStoreId = cart.getProductStoreId();
if (!skipInventoryChecks && !"PURCHASE_ORDER".equals(cart.getOrderType())) {
- // check inventory if new quantity is greater than old quantity; don't worry about inventory getting pulled out from under, that will be handled at checkout time
+ // check inventory if new quantity is greater than old quantity; don't worry about inventory getting pulled out from under,
+ // that will be handled at checkout time
if (_product != null && quantity.compareTo(this.quantity) > 0) {
if (!isInventoryAvailableOrNotRequired(quantity, productStoreId, dispatcher)) {
- Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("requestedQuantity", UtilFormatOut.formatQuantity(quantity.doubleValue()),
- "productName", this.getName(dispatcher), "productId", productId);
+ Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("requestedQuantity",
+ UtilFormatOut.formatQuantity(quantity.doubleValue()), "productName", this.getName(dispatcher), "productId", productId);
String excMsg = UtilProperties.getMessage(RESOURCE, "OrderDoNotHaveEnoughProducts", messageMap, cart.getLocale());
Debug.logWarning(excMsg, MODULE);
throw new CartItemModifyException(excMsg);
@@ -1077,7 +1141,7 @@ public class ShoppingCartItem implements java.io.Serializable {
}
public void calcDepositAdjustments() {
- List<GenericValue>itemAdjustments = this.getAdjustments();
+ List<GenericValue> itemAdjustments = this.getAdjustments();
try {
GenericValue depositAmount = EntityQuery.use(delegator).from("ProductPrice")
.where("productId", this.getProductId(), "productPricePurposeId", "DEPOSIT", "productPriceTypeId", "DEFAULT_PRICE")
@@ -1104,6 +1168,7 @@ public class ShoppingCartItem implements java.io.Serializable {
Debug.logError("Error in fetching deposite price details!!", MODULE);
}
}
+
public void updatePrice(LocalDispatcher dispatcher, ShoppingCart cart) throws CartItemModifyException {
// set basePrice using the calculateProductPrice service
if (_product != null && isModifiedPrice == false) {
@@ -1114,11 +1179,11 @@ public class ShoppingCartItem implements java.io.Serializable {
if (partyId != null) {
priceContext.put("partyId", partyId);
}
- GenericValue userLogin= cart.getUserLogin();
+ GenericValue userLogin = cart.getUserLogin();
if (userLogin != null) {
priceContext.put("userLogin", userLogin);
}
- GenericValue autoUserLogin= cart.getAutoUserLogin();
+ GenericValue autoUserLogin = cart.getAutoUserLogin();
if (autoUserLogin != null) {
priceContext.put("autoUserLogin", autoUserLogin);
}
@@ -1147,11 +1212,13 @@ public class ShoppingCartItem implements java.io.Serializable {
if (ServiceUtil.isError(priceResult)) {
String errorMessage = ServiceUtil.getErrorMessage(priceResult);
Debug.logError(errorMessage, MODULE);
- throw new CartItemModifyException("There was an error while calculating the price: " + ServiceUtil.getErrorMessage(priceResult));
+ throw new CartItemModifyException("There was an error while calculating the price: "
+ + ServiceUtil.getErrorMessage(priceResult));
}
Boolean validPriceFound = (Boolean) priceResult.get("validPriceFound");
if (!validPriceFound) {
- throw new CartItemModifyException("Could not find a valid price for the product with ID [" + this.getProductId() + "] and supplier with ID [" + partyId + "], not adding to cart.");
+ throw new CartItemModifyException("Could not find a valid price for the product with ID [" + this.getProductId()
+ + "] and supplier with ID [" + partyId + "], not adding to cart.");
}
if (isAlternativePacking) {
@@ -1165,7 +1232,8 @@ public class ShoppingCartItem implements java.io.Serializable {
} else {
if (productId != null) {
String productStoreId = cart.getProductStoreId();
- List<GenericValue> productSurvey = ProductStoreWorker.getProductSurveys(delegator, productStoreId, productId, "CART_ADD", parentProductId);
+ List<GenericValue> productSurvey = ProductStoreWorker.getProductSurveys(delegator, productStoreId, productId, "CART_ADD",
+ parentProductId);
if (UtilValidate.isNotEmpty(productSurvey) && UtilValidate.isNotEmpty(attributes)) {
List<String> surveyResponses = UtilGenerics.cast(attributes.get("surveyResponses"));
if (UtilValidate.isNotEmpty(surveyResponses)) {
@@ -1201,11 +1269,13 @@ public class ShoppingCartItem implements java.io.Serializable {
if (ServiceUtil.isError(priceResult)) {
String errorMessage = ServiceUtil.getErrorMessage(priceResult);
Debug.logError(errorMessage, MODULE);
- throw new CartItemModifyException("There was an error while calculating the price: " + ServiceUtil.getErrorMessage(priceResult));
+ throw new CartItemModifyException("There was an error while calculating the price: "
+ + ServiceUtil.getErrorMessage(priceResult));
}
Boolean validPriceFound = (Boolean) priceResult.get("validPriceFound");
if (Boolean.FALSE.equals(validPriceFound)) {
- throw new CartItemModifyException("Could not find a valid price for the product with ID [" + this.getProductId() + "], not adding to cart.");
+ throw new CartItemModifyException("Could not find a valid price for the product with ID [" + this.getProductId()
+ + "], not adding to cart.");
}
//set alternative product price
@@ -1253,11 +1323,13 @@ public class ShoppingCartItem implements java.io.Serializable {
if (productStore != null && "Y".equals(productStore.get("showPricesWithVatTax"))) {
BigDecimal totalPrice = configWrapper.getTotalPrice();
// Get Taxes
- Map<String, Object> totalPriceWithTaxMap = dispatcher.runSync("calcTaxForDisplay", UtilMisc.toMap("basePrice", totalPrice, "productId", this.productId, "productStoreId", cart.getProductStoreId()));
+ Map<String, Object> totalPriceWithTaxMap = dispatcher.runSync("calcTaxForDisplay", UtilMisc.toMap("basePrice",
+ totalPrice, "productId", this.productId, "productStoreId", cart.getProductStoreId()));
if (ServiceUtil.isError(totalPriceWithTaxMap)) {
String errorMessage = ServiceUtil.getErrorMessage(totalPriceWithTaxMap);
Debug.logError(errorMessage, MODULE);
- throw new CartItemModifyException("There was an error while calculating tax: " + ServiceUtil.getErrorMessage(priceResult));
+ throw new CartItemModifyException("There was an error while calculating tax: "
+ + ServiceUtil.getErrorMessage(priceResult));
}
this.setDisplayPrice((BigDecimal) totalPriceWithTaxMap.get("priceWithTax"));
} else {
@@ -1292,16 +1364,30 @@ public class ShoppingCartItem implements java.io.Serializable {
}
}
- /** Returns the quantity. */
+ /**
+ * Returns the quantity.
+ */
public BigDecimal getQuantity() {
return this.quantity;
}
- /** Returns the reservation start date. */
+ /**
+ * Returns the reservation start date.
+ */
public Timestamp getReservStart() {
return this.getReservStart(BigDecimal.ZERO);
}
- /** Returns the reservation start date with a number of days added. */
+
+ /**
+ * Sets the reservation start date
+ */
+ public void setReservStart(Timestamp reservStart) {
+ this.reservStart = reservStart != null ? (Timestamp) reservStart.clone() : null;
+ }
+
+ /**
+ * Returns the reservation start date with a number of days added.
+ */
public Timestamp getReservStart(BigDecimal addDays) {
if (addDays.compareTo(BigDecimal.ZERO) == 0) {
return this.reservStart != null ? (Timestamp) this.reservStart.clone() : null;
@@ -1311,24 +1397,53 @@ public class ShoppingCartItem implements java.io.Serializable {
}
return null;
}
- /** Returns the reservation length. */
+
+ /**
+ * Returns the reservation length.
+ */
public BigDecimal getReservLength() {
return this.reservLength;
}
- /** Returns the reservation number of persons. */
+
+ /**
+ * Sets the reservation length
+ */
+ public void setReservLength(BigDecimal reservLength) {
+ this.reservLength = reservLength;
+ }
+
+ /**
+ * Returns the reservation number of persons.
+ */
public BigDecimal getReservPersons() {
return this.reservPersons;
}
- /** Returns accommodationMapId */
+ /**
+ * Sets number of persons using the reservation
+ */
+ public void setReservPersons(BigDecimal reservPersons) {
+ this.reservPersons = reservPersons;
+ }
+
+ /**
+ * Returns accommodationMapId
+ */
public String getAccommodationMapId() {
return this.accommodationMapId;
}
- /** Returns accommodationSpotId */
+
+ /**
+ * Returns accommodationSpotId
+ */
public String getAccommodationSpotId() {
return this.accommodationSpotId;
}
+ /**
+ * Gets promo quantity used.
+ * @return the promo quantity used
+ */
public synchronized BigDecimal getPromoQuantityUsed() {
if (this.getIsPromo()) {
return this.quantity;
@@ -1336,6 +1451,10 @@ public class ShoppingCartItem implements java.io.Serializable {
return this.promoQuantityUsed;
}
+ /**
+ * Gets promo quantity available.
+ * @return the promo quantity available
+ */
public synchronized BigDecimal getPromoQuantityAvailable() {
if (this.getIsPromo()) {
return BigDecimal.ZERO;
@@ -1343,14 +1462,26 @@ public class ShoppingCartItem implements java.io.Serializable {
return this.quantity.subtract(this.promoQuantityUsed);
}
+ /**
+ * Gets quantity used per promo actual iter.
+ * @return the quantity used per promo actual iter
+ */
public Iterator<Map.Entry<GenericPK, BigDecimal>> getQuantityUsedPerPromoActualIter() {
return this.quantityUsedPerPromoActual.entrySet().iterator();
}
+ /**
+ * Gets quantity used per promo candidate iter.
+ * @return the quantity used per promo candidate iter
+ */
public Iterator<Map.Entry<GenericPK, BigDecimal>> getQuantityUsedPerPromoCandidateIter() {
return this.quantityUsedPerPromoCandidate.entrySet().iterator();
}
+ /**
+ * Gets quantity used per promo failed iter.
+ * @return the quantity used per promo failed iter
+ */
public Iterator<Map.Entry<GenericPK, BigDecimal>> getQuantityUsedPerPromoFailedIter() {
return this.quantityUsedPerPromoFailed.entrySet().iterator();
}
@@ -1384,6 +1515,11 @@ public class ShoppingCartItem implements java.io.Serializable {
return BigDecimal.ZERO;
}
+ /**
+ * Gets promo quantity candidate use.
+ * @param productPromoCondAction the product promo cond action
+ * @return the promo quantity candidate use
+ */
public BigDecimal getPromoQuantityCandidateUse(GenericValue productPromoCondAction) {
GenericPK productPromoCondActionPK = productPromoCondAction.getPrimaryKey();
BigDecimal existingValue = this.quantityUsedPerPromoCandidate.get(productPromoCondActionPK);
@@ -1393,6 +1529,11 @@ public class ShoppingCartItem implements java.io.Serializable {
return existingValue;
}
+ /**
+ * Gets promo quantity candidate use action and all conds.
+ * @param productPromoAction the product promo action
+ * @return the promo quantity candidate use action and all conds
+ */
public BigDecimal getPromoQuantityCandidateUseActionAndAllConds(GenericValue productPromoAction) {
BigDecimal totalUse = BigDecimal.ZERO;
String productPromoId = productPromoAction.getString("productPromoId");
@@ -1420,13 +1561,19 @@ public class ShoppingCartItem implements java.io.Serializable {
return totalUse;
}
+ /**
+ * Reset promo rule use.
+ * @param productPromoId the product promo id
+ * @param productPromoRuleId the product promo rule id
+ */
public synchronized void resetPromoRuleUse(String productPromoId, String productPromoRuleId) {
Iterator<Map.Entry<GenericPK, BigDecimal>> entryIter = this.quantityUsedPerPromoCandidate.entrySet().iterator();
while (entryIter.hasNext()) {
Map.Entry<GenericPK, BigDecimal> entry = entryIter.next();
GenericPK productPromoCondActionPK = entry.getKey();
BigDecimal quantityUsed = entry.getValue();
- if (productPromoId.equals(productPromoCondActionPK.getString("productPromoId")) && productPromoRuleId.equals(productPromoCondActionPK.getString("productPromoRuleId"))) {
+ if (productPromoId.equals(productPromoCondActionPK.getString("productPromoId"))
+ && productPromoRuleId.equals(productPromoCondActionPK.getString("productPromoRuleId"))) {
entryIter.remove();
BigDecimal existingValue = this.quantityUsedPerPromoFailed.get(productPromoCondActionPK);
if (existingValue == null) {
@@ -1439,13 +1586,19 @@ public class ShoppingCartItem implements java.io.Serializable {
}
}
+ /**
+ * Confirm promo rule use.
+ * @param productPromoId the product promo id
+ * @param productPromoRuleId the product promo rule id
+ */
public synchronized void confirmPromoRuleUse(String productPromoId, String productPromoRuleId) {
Iterator<Map.Entry<GenericPK, BigDecimal>> entryIter = this.quantityUsedPerPromoCandidate.entrySet().iterator();
while (entryIter.hasNext()) {
Map.Entry<GenericPK, BigDecimal> entry = entryIter.next();
GenericPK productPromoCondActionPK = entry.getKey();
BigDecimal quantityUsed = entry.getValue();
- if (productPromoId.equals(productPromoCondActionPK.getString("productPromoId")) && productPromoRuleId.equals(productPromoCondActionPK.getString("productPromoRuleId"))) {
+ if (productPromoId.equals(productPromoCondActionPK.getString("productPromoId"))
+ && productPromoRuleId.equals(productPromoCondActionPK.getString("productPromoRuleId"))) {
entryIter.remove();
BigDecimal existingValue = this.quantityUsedPerPromoActual.get(productPromoCondActionPK);
if (existingValue == null) {
@@ -1464,24 +1617,23 @@ public class ShoppingCartItem implements java.io.Serializable {
this.promoQuantityUsed = this.getIsPromo() ? this.quantity : BigDecimal.ZERO;
}
- /** Sets the item comment. */
- public void setItemComment(String itemComment) {
- this.setAttribute("itemComment", itemComment);
- }
-
- /** Returns the item's comment. */
+ /**
+ * Returns the item's comment.
+ */
public String getItemComment() {
return (String) this.getAttribute("itemComment");
}
- /** Sets the item's customer desired delivery date. */
- public void setDesiredDeliveryDate(Timestamp ddDate) {
- if (ddDate != null) {
- this.setAttribute("itemDesiredDeliveryDate", ddDate.toString());
- }
+ /**
+ * Sets the item comment.
+ */
+ public void setItemComment(String itemComment) {
+ this.setAttribute("itemComment", itemComment);
}
- /** Returns the item's customer desired delivery date. */
+ /**
+ * Returns the item's customer desired delivery date.
+ */
public Timestamp getDesiredDeliveryDate() {
String ddDate = (String) this.getAttribute("itemDesiredDeliveryDate");
@@ -1489,75 +1641,111 @@ public class ShoppingCartItem implements java.io.Serializable {
try {
return Timestamp.valueOf(ddDate);
} catch (IllegalArgumentException e) {
- Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderProblemGettingItemDesiredDeliveryDateFor", UtilMisc.toMap("productId", this.getProductId()), locale));
+ Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderProblemGettingItemDesiredDeliveryDateFor",
+ UtilMisc.toMap("productId", this.getProductId()), locale));
return null;
}
}
return null;
}
- /** Sets the date to ship before */
- public void setShipBeforeDate(Timestamp date) {
- this.shipBeforeDate = date != null ? (Timestamp) date.clone() : null;
-
+ /**
+ * Sets the item's customer desired delivery date.
+ */
+ public void setDesiredDeliveryDate(Timestamp ddDate) {
+ if (ddDate != null) {
+ this.setAttribute("itemDesiredDeliveryDate", ddDate.toString());
+ }
}
- /** Returns the date to ship before */
+ /**
+ * Returns the date to ship before
+ */
public Timestamp getShipBeforeDate() {
return this.shipBeforeDate != null ? (Timestamp) this.shipBeforeDate.clone() : null;
}
- /** Sets the date to ship after */
- public void setShipAfterDate(Timestamp date) {
- this.shipAfterDate = date != null ? (Timestamp) date.clone() : null;
+ /**
+ * Sets the date to ship before
+ */
+ public void setShipBeforeDate(Timestamp date) {
+ this.shipBeforeDate = date != null ? (Timestamp) date.clone() : null;
+
}
- /** Returns the date to ship after */
+ /**
+ * Returns the date to ship after
+ */
public Timestamp getShipAfterDate() {
return this.shipAfterDate != null ? (Timestamp) this.shipAfterDate.clone() : null;
}
- /** Sets the date to ship after */
- public void setReserveAfterDate(Timestamp date) {
- this.reserveAfterDate = date != null ? (Timestamp) date.clone() : null;
+ /**
+ * Sets the date to ship after
+ */
+ public void setShipAfterDate(Timestamp date) {
+ this.shipAfterDate = date != null ? (Timestamp) date.clone() : null;
}
- /** Returns the date to ship after */
+ /**
+ * Returns the date to ship after
+ */
public Timestamp getReserveAfterDate() {
return this.reserveAfterDate != null ? (Timestamp) this.reserveAfterDate.clone() : null;
}
- /** Sets the cancel back order date */
- public void setCancelBackOrderDate(Timestamp date) {
- this.cancelBackOrderDate = date != null ? (Timestamp) date.clone() : null;
+ /**
+ * Sets the date to ship after
+ */
+ public void setReserveAfterDate(Timestamp date) {
+ this.reserveAfterDate = date != null ? (Timestamp) date.clone() : null;
}
- /** Returns the cancel back order date */
+ /**
+ * Returns the cancel back order date
+ */
public Timestamp getCancelBackOrderDate() {
return this.cancelBackOrderDate != null ? (Timestamp) this.cancelBackOrderDate.clone() : null;
}
- /** Sets the date to EstimatedShipDate */
- public void setEstimatedShipDate(Timestamp date) {
- this.estimatedShipDate = date != null ? (Timestamp) date.clone() : null;
+ /**
+ * Sets the cancel back order date
+ */
+ public void setCancelBackOrderDate(Timestamp date) {
+ this.cancelBackOrderDate = date != null ? (Timestamp) date.clone() : null;
}
- /** Returns the date to EstimatedShipDate */
+ /**
+ * Returns the date to EstimatedShipDate
+ */
public Timestamp getEstimatedShipDate() {
return this.estimatedShipDate != null ? (Timestamp) this.estimatedShipDate.clone() : null;
}
- /** Sets the item type. */
- public void setItemType(String itemType) {
- this.itemType = itemType;
+ /**
+ * Sets the date to EstimatedShipDate
+ */
+ public void setEstimatedShipDate(Timestamp date) {
+ this.estimatedShipDate = date != null ? (Timestamp) date.clone() : null;
}
- /** Returns the item type. */
+ /**
+ * Returns the item type.
+ */
public String getItemType() {
return this.itemType;
}
- /** Returns the item type. */
+ /**
+ * Sets the item type.
+ */
+ public void setItemType(String itemType) {
+ this.itemType = itemType;
+ }
+
+ /**
+ * Returns the item type.
+ */
public GenericValue getItemTypeGenericValue() {
try {
return this.getDelegator().findOne("OrderItemType", UtilMisc.toMap("orderItemTypeId", this.itemType), true);
@@ -1567,33 +1755,47 @@ public class ShoppingCartItem implements java.io.Serializable {
}
}
- /** Sets the item group. */
- public void setItemGroup(ShoppingCart.ShoppingCartItemGroup itemGroup) {
- this.itemGroup = itemGroup;
- }
-
- /** Sets the item group. */
+ /**
+ * Sets the item group.
+ */
public void setItemGroup(String groupNumber, ShoppingCart cart) {
this.itemGroup = cart.getItemGroupByNumber(groupNumber);
}
- /** Returns the item group. */
+ /**
+ * Returns the item group.
+ */
public ShoppingCart.ShoppingCartItemGroup getItemGroup() {
return this.itemGroup;
}
+ /**
+ * Sets the item group.
+ */
+ public void setItemGroup(ShoppingCart.ShoppingCartItemGroup itemGroup) {
+ this.itemGroup = itemGroup;
+ }
+
+ /**
+ * Is in item group boolean.
+ * @param groupNumber the group number
+ * @return the boolean
+ */
public boolean isInItemGroup(String groupNumber) {
return !(this.itemGroup == null) && this.itemGroup.getGroupNumber().equals(groupNumber);
}
- /** Returns the item type description. */
+ /**
+ * Returns the item type description.
+ */
public String getItemTypeDescription() {
GenericValue orderItemType = null;
if (this.getItemType() != null) {
try {
orderItemType = this.getDelegator().findOne("OrderItemType", UtilMisc.toMap("orderItemTypeId", this.getItemType()), true);
} catch (GenericEntityException e) {
- Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderProblemsGettingOrderItemTypeFor", UtilMisc.toMap("orderItemTypeId", this.getItemType()), locale));
+ Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderProblemsGettingOrderItemTypeFor",
+ UtilMisc.toMap("orderItemTypeId", this.getItemType()), locale));
}
}
if (orderItemType != null) {
@@ -1602,24 +1804,38 @@ public class ShoppingCartItem implements java.io.Serializable {
return null;
}
- /** Returns the productCategoryId for the item or null if none. */
+ /**
+ * Returns the productCategoryId for the item or null if none.
+ */
public String getProductCategoryId() {
return this.productCategoryId;
}
+ /**
+ * Sets product category id.
+ * @param productCategoryId the product category id
+ */
public void setProductCategoryId(String productCategoryId) {
this.productCategoryId = productCategoryId;
}
+ /**
+ * Gets order item seq id.
+ * @return the order item seq id
+ */
+ public String getOrderItemSeqId() {
+ return orderItemSeqId;
+ }
+
+ /**
+ * Sets order item seq id.
+ * @param orderItemSeqId the order item seq id
+ */
public void setOrderItemSeqId(String orderItemSeqId) {
Debug.logInfo("Setting orderItemSeqId - " + orderItemSeqId, MODULE);
this.orderItemSeqId = orderItemSeqId;
}
- public String getOrderItemSeqId() {
- return orderItemSeqId;
- }
-
public void setShoppingList(String shoppingListId, String itemSeqId) {
attributes.put("shoppingListId", shoppingListId);
attributes.put("shoppingListItemSeqId", itemSeqId);
@@ -1633,77 +1849,111 @@ public class ShoppingCartItem implements java.io.Serializable {
return (String) attributes.get("shoppingListItemSeqId");
}
- /** Sets the requirementId. */
+ /**
+ * Returns the requirementId.
+ */
+ public String getRequirementId() {
+ return this.requirementId;
+ }
+
+ /**
+ * Sets the requirementId.
+ */
public void setRequirementId(String requirementId) {
this.requirementId = requirementId;
}
- /** Returns the requirementId. */
- public String getRequirementId() {
- return this.requirementId;
+ /**
+ * Returns the quoteId.
+ */
+ public String getQuoteId() {
+ return this.quoteId;
}
- /** Sets the quoteId. */
+ /**
+ * Sets the quoteId.
+ */
public void setQuoteId(String quoteId) {
this.quoteId = quoteId;
}
- /** Returns the quoteId. */
- public String getQuoteId() {
- return this.quoteId;
+ /**
+ * Returns the quoteItemSeqId.
+ */
+ public String getQuoteItemSeqId() {
+ return this.quoteItemSeqId;
}
- /** Sets the quoteItemSeqId. */
+ /**
+ * Sets the quoteItemSeqId.
+ */
public void setQuoteItemSeqId(String quoteItemSeqId) {
this.quoteItemSeqId = quoteItemSeqId;
}
- /** Returns the quoteItemSeqId. */
- public String getQuoteItemSeqId() {
- return this.quoteItemSeqId;
+ /**
+ * Returns the OrderItemAssocTypeId.
+ */
+ public String getOrderItemAssocTypeId() {
+ return this.orderItemAssocTypeId;
}
- /** Sets the orderItemAssocTypeId. */
+ /**
+ * Sets the orderItemAssocTypeId.
+ */
public void setOrderItemAssocTypeId(String orderItemAssocTypeId) {
if (orderItemAssocTypeId != null) {
this.orderItemAssocTypeId = orderItemAssocTypeId;
}
}
- /** Returns the OrderItemAssocTypeId. */
- public String getOrderItemAssocTypeId() {
- return this.orderItemAssocTypeId;
+ /**
+ * Returns the associatedId.
+ */
+ public String getAssociatedOrderId() {
+ return this.associatedOrderId;
}
- /** Sets the associatedOrderId. */
+ /**
+ * Sets the associatedOrderId.
+ */
public void setAssociatedOrderId(String associatedOrderId) {
this.associatedOrderId = associatedOrderId;
}
- /** Returns the associatedId. */
- public String getAssociatedOrderId() {
- return this.associatedOrderId;
+ /**
+ * Returns the associatedOrderItemSeqId.
+ */
+ public String getAssociatedOrderItemSeqId() {
+ return this.associatedOrderItemSeqId;
}
- /** Sets the associatedOrderItemSeqId. */
+ /**
+ * Sets the associatedOrderItemSeqId.
+ */
public void setAssociatedOrderItemSeqId(String associatedOrderItemSeqId) {
this.associatedOrderItemSeqId = associatedOrderItemSeqId;
}
- /** Returns the associatedOrderItemSeqId. */
- public String getAssociatedOrderItemSeqId() {
- return this.associatedOrderItemSeqId;
- }
-
+ /**
+ * Gets status id.
+ * @return the status id
+ */
public String getStatusId() {
return this.statusId;
}
+ /**
+ * Sets status id.
+ * @param statusId the status id
+ */
public void setStatusId(String statusId) {
this.statusId = statusId;
}
- /** Returns true if shipping charges apply to this item. */
+ /**
+ * Returns true if shipping charges apply to this item.
+ */
public boolean shippingApplies() {
GenericValue product = getProduct();
if (product != null) {
@@ -1713,7 +1963,9 @@ public class ShoppingCartItem implements java.io.Serializable {
return false;
}
- /** Returns true if tax charges apply to this item. */
+ /**
+ * Returns true if tax charges apply to this item.
+ */
public boolean taxApplies() {
GenericValue product = getProduct();
if (product != null) {
@@ -1743,22 +1995,28 @@ public class ShoppingCartItem implements java.io.Serializable {
this.locale = locale;
}
- /** Set the item's description. */
- public void setName(String itemName) {
- this.itemDescription = itemName;
- }
- /** Returns the item's description.
- * @deprecated use getName(LocalDispatcher dispatcher)
- **/
+ /**
+ * Returns the item's description.
+ * @deprecated use getName(LocalDispatcher dispatcher)
+ **/
@Deprecated
public String getName() {
return itemDescription;
}
- /** Returns the item's description or PRODUCT_NAME from content. */
+ /**
+ * Set the item's description.
+ */
+ public void setName(String itemName) {
+ this.itemDescription = itemName;
+ }
+
+ /**
+ * Returns the item's description or PRODUCT_NAME from content.
+ */
public String getName(LocalDispatcher dispatcher) {
- if (itemDescription != null) {
- return itemDescription;
+ if (itemDescription != null) {
+ return itemDescription;
}
GenericValue product = getProduct();
if (product != null) {
@@ -1778,7 +2036,9 @@ public class ShoppingCartItem implements java.io.Serializable {
return "";
}
- /** Returns the item's description. */
+ /**
+ * Returns the item's description.
+ */
public String getDescription(LocalDispatcher dispatcher) {
GenericValue product = getProduct();
@@ -1801,11 +2061,17 @@ public class ShoppingCartItem implements java.io.Serializable {
return null;
}
+ /**
+ * Gets config wrapper.
+ * @return the config wrapper
+ */
public ProductConfigWrapper getConfigWrapper() {
return configWrapper;
}
- /** Returns the item's unit weight */
+ /**
+ * Returns the item's unit weight
+ */
public BigDecimal getWeight() {
GenericValue product = getProduct();
if (product != null) {
@@ -1828,7 +2094,9 @@ public class ShoppingCartItem implements java.io.Serializable {
return BigDecimal.ZERO;
}
- /** Returns the item's pieces included */
+ /**
+ * Returns the item's pieces included
+ */
public long getPiecesIncluded() {
GenericValue product = getProduct();
if (product != null) {
@@ -1851,7 +2119,9 @@ public class ShoppingCartItem implements java.io.Serializable {
return 1;
}
- /** Returns a Set of the item's features */
+ /**
+ * Returns a Set of the item's features
+ */
public Set<String> getFeatureSet() {
Set<String> featureSet = new LinkedHashSet<>();
GenericValue product = this.getProduct();
@@ -1859,7 +2129,8 @@ public class ShoppingCartItem implements java.io.Serializable {
List<GenericValue> featureAppls = null;
try {
featureAppls = product.getRelated("ProductFeatureAppl", null, null, false);
- List<EntityExpr> filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE"));
+ List<EntityExpr> filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId",
+ EntityOperator.EQUALS, "STANDARD_FEATURE"));
filterExprs.add(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE"));
featureAppls = EntityUtil.filterByOr(featureAppls, filterExprs);
} catch (GenericEntityException e) {
@@ -1878,14 +2149,17 @@ public class ShoppingCartItem implements java.io.Serializable {
}
return featureSet;
}
- /** Returns a list of the item's standard features */
+
+ /**
+ * Returns a list of the item's standard features
+ */
public List<GenericValue> getStandardFeatureList() {
List<GenericValue> features = null;
GenericValue product = this.getProduct();
if (product != null) {
try {
List<GenericValue> featureAppls = product.getRelated("ProductFeatureAndAppl", null, null, false);
- features=EntityUtil.filterByAnd(featureAppls, UtilMisc.toMap("productFeatureApplTypeId", "STANDARD_FEATURE"));
+ features = EntityUtil.filterByAnd(featureAppls, UtilMisc.toMap("productFeatureApplTypeId", "STANDARD_FEATURE"));
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to get features from product : " + product.get("productId"), MODULE);
}
@@ -1893,25 +2167,30 @@ public class ShoppingCartItem implements java.io.Serializable {
return features;
}
- /** Returns a List of the item's features for supplier*/
- public List<GenericValue> getFeaturesForSupplier(LocalDispatcher dispatcher, String partyId) {
- List<GenericValue> featureAppls = getStandardFeatureList();
- if (UtilValidate.isNotEmpty(featureAppls)) {
- try {
- Map<String, Object> result = dispatcher.runSync("convertFeaturesForSupplier", UtilMisc.toMap("partyId", partyId, "productFeatures", featureAppls));
- if (ServiceUtil.isError(result)) {
- String errorMessage = ServiceUtil.getErrorMessage(result);
- Debug.logError(errorMessage, MODULE);
- }
- featuresForSupplier = UtilGenerics.cast(result.get("convertedProductFeatures"));
- } catch (GenericServiceException e) {
- Debug.logError(e, "Unable to get features for supplier from product : " + this.productId, MODULE);
- }
- }
- return featuresForSupplier;
- }
-
- /** Returns the item's size (length + girth) */
+ /**
+ * Returns a List of the item's features for supplier
+ */
+ public List<GenericValue> getFeaturesForSupplier(LocalDispatcher dispatcher, String partyId) {
+ List<GenericValue> featureAppls = getStandardFeatureList();
+ if (UtilValidate.isNotEmpty(featureAppls)) {
+ try {
+ Map<String, Object> result = dispatcher.runSync("convertFeaturesForSupplier", UtilMisc.toMap("partyId", partyId,
+ "productFeatures", featureAppls));
+ if (ServiceUtil.isError(result)) {
+ String errorMessage = ServiceUtil.getErrorMessage(result);
+ Debug.logError(errorMessage, MODULE);
+ }
+ featuresForSupplier = UtilGenerics.cast(result.get("convertedProductFeatures"));
+ } catch (GenericServiceException e) {
+ Debug.logError(e, "Unable to get features for supplier from product : " + this.productId, MODULE);
+ }
+ }
+ return featuresForSupplier;
+ }
+
+ /**
+ * Returns the item's size (length + girth)
+ */
public BigDecimal getSize() {
GenericValue product = getProduct();
if (product != null) {
@@ -1940,7 +2219,7 @@ public class ShoppingCartItem implements java.io.Serializable {
}
// determine girth (longest field is length)
- BigDecimal[] sizeInfo = { height, width, depth };
+ BigDecimal[] sizeInfo = {height, width, depth};
Arrays.sort(sizeInfo);
return (sizeInfo[0].add(sizeInfo[0])).add(sizeInfo[1].add(sizeInfo[1])).add(sizeInfo[2]);
@@ -1949,7 +2228,6 @@ public class ShoppingCartItem implements java.io.Serializable {
return BigDecimal.ZERO;
}
-
public Map<String, Object> getItemProductInfo() {
Map<String, Object> itemInfo = new HashMap<>();
itemInfo.put("productId", this.getProductId());
@@ -1970,7 +2248,9 @@ public class ShoppingCartItem implements java.io.Serializable {
return itemInfo;
}
- /** Returns the base price. */
+ /**
+ * Returns the base price.
+ */
public BigDecimal getBasePrice() {
BigDecimal curBasePrice;
if (selectedAmount.compareTo(BigDecimal.ZERO) > 0) {
@@ -1981,6 +2261,13 @@ public class ShoppingCartItem implements java.io.Serializable {
return curBasePrice;
}
+ /**
+ * Sets the base price for the item; use with caution
+ */
+ public void setBasePrice(BigDecimal basePrice) {
+ this.basePrice = basePrice;
+ }
+
public BigDecimal getDisplayPrice() {
BigDecimal curDisplayPrice;
if (this.displayPrice == null) {
@@ -1995,10 +2282,21 @@ public class ShoppingCartItem implements java.io.Serializable {
return curDisplayPrice;
}
+ /**
+ * Sets the display price for the item; use with caution
+ */
+ public void setDisplayPrice(BigDecimal displayPrice) {
+ this.displayPrice = displayPrice;
+ }
+
public BigDecimal getSpecialPromoPrice() {
return this.specialPromoPrice;
}
+ public void setSpecialPromoPrice(BigDecimal specialPromoPrice) {
+ this.specialPromoPrice = specialPromoPrice;
+ }
+
public BigDecimal getRecurringBasePrice() {
if (this.recurringBasePrice == null) {
return null;
@@ -2010,6 +2308,13 @@ public class ShoppingCartItem implements java.io.Serializable {
return this.recurringBasePrice;
}
+ /**
+ * Sets the base price for the item; use with caution
+ */
+ public void setRecurringBasePrice(BigDecimal recurringBasePrice) {
+ this.recurringBasePrice = recurringBasePrice;
+ }
+
public BigDecimal getRecurringDisplayPrice() {
if (this.recurringDisplayPrice == null) {
return this.getRecurringBasePrice();
@@ -2021,47 +2326,88 @@ public class ShoppingCartItem implements java.io.Serializable {
return this.recurringDisplayPrice;
}
- /** Returns the list price. */
+ /**
+ * Sets the display price for the item; use with caution
+ */
+ public void setRecurringDisplayPrice(BigDecimal recurringDisplayPrice) {
+ this.recurringDisplayPrice = recurringDisplayPrice;
+ }
+
+ /**
+ * Returns the list price.
+ */
public BigDecimal getListPrice() {
return listPrice;
}
+ /**
+ * Sets list price.
+ * @param listPrice the list price
+ */
public void setListPrice(BigDecimal listPrice) {
this.listPrice = listPrice;
}
- /** Returns isModifiedPrice */
+ /**
+ * Returns isModifiedPrice
+ */
public boolean getIsModifiedPrice() {
return isModifiedPrice;
}
- /** Set isModifiedPrice */
+ /**
+ * Set isModifiedPrice
+ */
public void setIsModifiedPrice(boolean isModifiedPrice) {
this.isModifiedPrice = isModifiedPrice;
}
- /** get the percentage for the second person */
+ /**
+ * get the percentage for the second person
+ */
public BigDecimal getReserv2ndPPPerc() {
return reserv2ndPPPerc;
}
- /** get the percentage for the third and following person */
+ /**
+ * Sets the extra % for second person
+ */
+ public void setReserv2ndPPPerc(BigDecimal reserv2ndPPPerc) {
+ this.reserv2ndPPPerc = reserv2ndPPPerc;
+ }
+
+ /**
+ * get the percentage for the third and following person
+ */
public BigDecimal getReservNthPPPerc() {
return reservNthPPPerc;
}
+ /**
+ * Sets the extra % for third and following person
+ */
+ public void setReservNthPPPerc(BigDecimal reservNthPPPerc) {
+ this.reservNthPPPerc = reservNthPPPerc;
+ }
- /** Returns the "other" adjustments. */
+ /**
+ * Returns the "other" adjustments.
+ */
public BigDecimal getOtherAdjustments() {
return OrderReadHelper.calcItemAdjustments(quantity, getBasePrice(), this.getAdjustments(), true, false, false, false, false);
}
- /** Returns the "other" adjustments. */
+ /**
+ * Returns the "other" adjustments.
+ */
public BigDecimal getOtherAdjustmentsRecurring() {
- return OrderReadHelper.calcItemAdjustmentsRecurringBd(quantity, getRecurringBasePrice() == null ? BigDecimal.ZERO : getRecurringBasePrice(), this.getAdjustments(), true, false, false, false, false);
+ return OrderReadHelper.calcItemAdjustmentsRecurringBd(quantity, getRecurringBasePrice() == null ? BigDecimal.ZERO : getRecurringBasePrice(),
+ this.getAdjustments(), true, false, false, false, false);
}
- /** calculates for a reservation the percentage/100 extra for more than 1 person. */
+ /**
+ * calculates for a reservation the percentage/100 extra for more than 1 person.
+ */
// similar code at EditShoppingList.groovy
public BigDecimal getRentalAdjustment() {
if (!"RENTAL_ORDER_ITEM".equals(this.itemType)) {
@@ -2088,7 +2434,9 @@ public class ShoppingCartItem implements java.io.Serializable {
return rentalValue.movePointLeft(2).multiply(getReservLength()); // return total rental adjustment
}
- /** Returns the total line price. */
+ /**
+ * Returns the total line price.
+ */
public BigDecimal getItemSubTotal(BigDecimal quantity) {
BigDecimal basePrice = getBasePrice();
BigDecimal rentalAdj = getRentalAdjustment();
@@ -2096,18 +2444,34 @@ public class ShoppingCartItem implements java.io.Serializable {
return basePrice.multiply(quantity).multiply(rentalAdj).add(otherAdj);
}
+ /**
+ * Gets item sub total.
+ * @return the item sub total
+ */
public BigDecimal getItemSubTotal() {
return this.getItemSubTotal(this.getQuantity());
}
+ /**
+ * Gets display item sub total.
+ * @return the display item sub total
+ */
public BigDecimal getDisplayItemSubTotal() {
return this.getDisplayPrice().multiply(this.getQuantity()).multiply(this.getRentalAdjustment()).add(this.getOtherAdjustments());
}
+ /**
+ * Gets display item sub total no adj.
+ * @return the display item sub total no adj
+ */
public BigDecimal getDisplayItemSubTotalNoAdj() {
return this.getDisplayPrice().multiply(this.getQuantity());
}
+ /**
+ * Gets display item recurring sub total.
+ * @return the display item recurring sub total
+ */
public BigDecimal getDisplayItemRecurringSubTotal() {
BigDecimal curRecurringDisplayPrice = this.getRecurringDisplayPrice();
@@ -2118,6 +2482,10 @@ public class ShoppingCartItem implements java.io.Serializable {
return curRecurringDisplayPrice.multiply(this.getQuantity()).add(this.getOtherAdjustmentsRecurring());
}
+ /**
+ * Gets display item recurring sub total no adj.
+ * @return the display item recurring sub total no adj
+ */
public BigDecimal getDisplayItemRecurringSubTotalNoAdj() {
BigDecimal curRecurringDisplayPrice = this.getRecurringDisplayPrice();
if (curRecurringDisplayPrice == null) {
@@ -2127,6 +2495,10 @@ public class ShoppingCartItem implements java.io.Serializable {
return curRecurringDisplayPrice.multiply(this.getQuantity());
}
+ /**
+ * Add all product feature and appls.
+ * @param productFeatureAndApplsToAdd the product feature and appls to add
+ */
public void addAllProductFeatureAndAppls(Map<String, GenericValue> productFeatureAndApplsToAdd) {
if (productFeatureAndApplsToAdd == null) {
return;
@@ -2136,6 +2508,10 @@ public class ShoppingCartItem implements java.io.Serializable {
}
}
+ /**
+ * Put additional product feature and appl.
+ * @param additionalProductFeatureAndAppl the additional product feature and appl
+ */
public void putAdditionalProductFeatureAndAppl(GenericValue additionalProductFeatureAndAppl) {
if (additionalProductFeatureAndAppl == null) {
return;
@@ -2167,12 +2543,18 @@ public class ShoppingCartItem implements java.io.Serializable {
}
if (amount == null && recurringAmount == null) {
- Debug.logWarning("In putAdditionalProductFeatureAndAppl the amount and recurringAmount are null for this adjustment: " + orderAdjustment, MODULE);
+ Debug.logWarning("In putAdditionalProductFeatureAndAppl the amount and recurringAmount are null for this adjustment: "
+ + orderAdjustment, MODULE);
}
this.addAdjustment(orderAdjustment);
}
+ /**
+ * Gets additional product feature and appl.
+ * @param productFeatureTypeId the product feature type id
+ * @return the additional product feature and appl
+ */
public GenericValue getAdditionalProductFeatureAndAppl(String productFeatureTypeId) {
if (this.additionalProductFeatureAndAppls == null) {
return null;
@@ -2180,6 +2562,11 @@ public class ShoppingCartItem implements java.io.Serializable {
return this.additionalProductFeatureAndAppls.get(productFeatureTypeId);
}
+ /**
+ * Remove additional product feature and appl generic value.
+ * @param productFeatureTypeId the product feature type id
+ * @return the generic value
+ */
public GenericValue removeAdditionalProductFeatureAndAppl(String productFeatureTypeId) {
if (this.additionalProductFeatureAndAppls == null) {
return null;
@@ -2194,10 +2581,19 @@ public class ShoppingCartItem implements java.io.Serializable {
return oldAdditionalProductFeatureAndAppl;
}
+ /**
+ * Gets additional product feature and appls.
+ * @return the additional product feature and appls
+ */
public Map<String, GenericValue> getAdditionalProductFeatureAndAppls() {
return this.additionalProductFeatureAndAppls;
}
+ /**
+ * Gets feature id qty map.
+ * @param quantity the quantity
+ * @return the feature id qty map
+ */
public Map<String, BigDecimal> getFeatureIdQtyMap(BigDecimal quantity) {
Map<String, BigDecimal> featureMap = new HashMap<>();
GenericValue product = this.getProduct();
@@ -2205,7 +2601,8 @@ public class ShoppingCartItem implements java.io.Serializable {
List<GenericValue> featureAppls = null;
try {
featureAppls = product.getRelated("ProductFeatureAppl", null, null, false);
- List<EntityExpr> filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "STANDARD_FEATURE"));
+ List<EntityExpr> filterExprs = UtilMisc.toList(EntityCondition.makeCondition("productFeatureApplTypeId",
+ EntityOperator.EQUALS, "STANDARD_FEATURE"));
filterExprs.add(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "REQUIRED_FEATURE"));
filterExprs.add(EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.EQUALS, "DISTINGUISHING_FEAT"));
featureAppls = EntityUtil.filterByOr(featureAppls, filterExprs);
@@ -2271,7 +2668,9 @@ public class ShoppingCartItem implements java.io.Serializable {
this.orderItemAttributes.put(name, value);
}
- /** Return an OrderItemAttribute. */
+ /**
+ * Return an OrderItemAttribute.
+ */
public String getOrderItemAttribute(String name) {
if (orderItemAttributes == null) {
return null;
@@ -2293,18 +2692,34 @@ public class ShoppingCartItem implements java.io.Serializable {
return itemAdjustments.indexOf(adjustment);
}
+ /**
+ * Remove adjustment.
+ * @param adjustment the adjustment
+ */
public void removeAdjustment(GenericValue adjustment) {
itemAdjustments.remove(adjustment);
}
+ /**
+ * Remove adjustment.
+ * @param index the index
+ */
public void removeAdjustment(int index) {
itemAdjustments.remove(index);
}
+ /**
+ * Gets adjustments.
+ * @return the adjustments
+ */
public List<GenericValue> getAdjustments() {
return itemAdjustments;
}
+ /**
+ * Remove feature adjustment.
+ * @param productFeatureId the product feature id
+ */
public void removeFeatureAdjustment(String productFeatureId) {
if (productFeatureId == null) {
return;
@@ -2313,6 +2728,10 @@ public class ShoppingCartItem implements java.io.Serializable {
itemAdjustments.removeIf(itemAdjustment -> productFeatureId.equals(itemAdjustment.getString("productFeatureId")));
}
+ /**
+ * Gets order item price infos.
+ * @return the order item price infos
+ */
public List<GenericValue> getOrderItemPriceInfos() {
return orderItemPriceInfos;
}
@@ -2335,30 +2754,53 @@ public class ShoppingCartItem implements java.io.Serializable {
return contactMechIdsMap.remove(contactMechPurposeTypeId);
}
+ /**
+ * Gets order item contact mech ids.
+ * @return the order item contact mech ids
+ */
public Map<String, String> getOrderItemContactMechIds() {
return contactMechIdsMap;
}
- public void setIsPromo(boolean isPromo) {
- this.isPromo = isPromo;
- }
-
+ /**
+ * Gets is promo.
+ * @return the is promo
+ */
public boolean getIsPromo() {
return this.isPromo;
}
+ /**
+ * Sets is promo.
+ * @param isPromo the is promo
+ */
+ public void setIsPromo(boolean isPromo) {
+ this.isPromo = isPromo;
+ }
+
public List<String> getAlternativeOptionProductIds() {
return this.alternativeOptionProductIds;
}
+
+ /**
+ * Sets alternative option product ids.
+ * @param alternativeOptionProductIds the alternative option product ids
+ */
public void setAlternativeOptionProductIds(List<String> alternativeOptionProductIds) {
this.alternativeOptionProductIds = alternativeOptionProductIds;
}
+ /**
+ * Equals boolean.
+ * @param item the item
+ * @return the boolean
+ */
public boolean equals(ShoppingCartItem item) {
if (item == null) {
return false;
}
- return this.equals(item.getProductId(), item.additionalProductFeatureAndAppls, item.attributes, item.prodCatalogId, item.selectedAmount, item.getItemType(), item.getItemGroup(), item.getIsPromo());
+ return this.equals(item.getProductId(), item.additionalProductFeatureAndAppls, item.attributes, item.prodCatalogId, item.selectedAmount,
+ item.getItemType(), item.getItemGroup(), item.getIsPromo());
}
@Override
@@ -2372,35 +2814,53 @@ public class ShoppingCartItem implements java.io.Serializable {
}
/** Compares the specified object with this cart item. Defaults isPromo to false. Default to no itemGroup. */
- public boolean equals(String productId, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, BigDecimal selectedAmount) {
+ public boolean equals(String productId, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
+ String prodCatalogId, BigDecimal selectedAmount) {
return equals(productId, additionalProductFeatureAndAppls, attributes, prodCatalogId, selectedAmount, null, null, false);
}
/** Compares the specified object with this cart item. Defaults isPromo to false. */
- public boolean equals(String productId, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, BigDecimal selectedAmount) {
- return equals(productId, null, BigDecimal.ZERO, BigDecimal.ZERO, null, null, additionalProductFeatureAndAppls, attributes, prodCatalogId, selectedAmount, configWrapper, itemType, itemGroup, false);
+ public boolean equals(String productId, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
+ String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup,
+ BigDecimal selectedAmount) {
+ return equals(productId, null, BigDecimal.ZERO, BigDecimal.ZERO, null, null, additionalProductFeatureAndAppls, attributes, prodCatalogId,
+ selectedAmount, configWrapper, itemType, itemGroup, false);
}
- /** Compares the specified object with this cart item including rental data. Defaults isPromo to false. */
- public boolean equals(String productId, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, BigDecimal selectedAmount) {
- return equals(productId, reservStart, reservLength, reservPersons, null, null, additionalProductFeatureAndAppls, attributes, prodCatalogId, selectedAmount, configWrapper, itemType, itemGroup, false);
+
+ /**
+ * Compares the specified object with this cart item including rental data. Defaults isPromo to false.
+ */
+ public boolean equals(String productId, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, Map<String,
+ GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId,
+ ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, BigDecimal selectedAmount) {
+ return equals(productId, reservStart, reservLength, reservPersons, null, null, additionalProductFeatureAndAppls, attributes, prodCatalogId,
+ selectedAmount, configWrapper, itemType, itemGroup, false);
}
/** Compares the specified object with this cart item. Defaults isPromo to false. */
- public boolean equals(String productId, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, BigDecimal selectedAmount, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, boolean isPromo) {
- return equals(productId, null, BigDecimal.ZERO, BigDecimal.ZERO, null, null, additionalProductFeatureAndAppls, attributes, prodCatalogId, selectedAmount, null, itemType, itemGroup, isPromo);
+ public boolean equals(String productId, Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes,
+ String prodCatalogId, BigDecimal selectedAmount, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup,
+ boolean isPromo) {
+ return equals(productId, null, BigDecimal.ZERO, BigDecimal.ZERO, null, null, additionalProductFeatureAndAppls, attributes, prodCatalogId,
+ selectedAmount, null, itemType, itemGroup, isPromo);
}
/** Compares the specified object with this cart item. */
- public boolean equals(String productId, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId,
- Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId, BigDecimal selectedAmount,
- ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, boolean isPromo) {
- return equals(productId, reservStart, reservLength, reservPersons, accommodationMapId, accommodationSpotId, additionalProductFeatureAndAppls, attributes, null, prodCatalogId, selectedAmount, configWrapper, itemType, itemGroup, isPromo);
+ public boolean equals(String productId, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId,
+ String accommodationSpotId,
+ Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, String prodCatalogId,
+ BigDecimal selectedAmount,
+ ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, boolean isPromo) {
+ return equals(productId, reservStart, reservLength, reservPersons, accommodationMapId, accommodationSpotId, additionalProductFeatureAndAppls,
+ attributes, null, prodCatalogId, selectedAmount, configWrapper, itemType, itemGroup, isPromo);
}
/** Compares the specified object order item attributes. */
- public boolean equals(String productId, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId,
- Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, Map<String, String> orderItemAttributes, String prodCatalogId, BigDecimal selectedAmount,
- ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, boolean isPromo) {
+ public boolean equals(String productId, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId,
+ String accommodationSpotId,
+ Map<String, GenericValue> additionalProductFeatureAndAppls, Map<String, Object> attributes, Map<String,
+ String> orderItemAttributes, String prodCatalogId, BigDecimal selectedAmount,
+ ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, boolean isPromo) {
if (this.productId == null || productId == null) {
// all non-product items are unique
return false;
@@ -2455,7 +2915,8 @@ public class ShoppingCartItem implements java.io.Serializable {
}
if ((this.attributes == null && UtilValidate.isNotEmpty(attributes)) || (UtilValidate.isNotEmpty(this.attributes) && attributes == null)
- || (this.attributes != null && attributes != null && (this.attributes.size() != attributes.size() || !(this.attributes.equals(attributes))))) {
+ || (this.attributes != null && attributes != null && (this.attributes.size() != attributes.size()
+ || !(this.attributes.equals(attributes))))) {
return false;
}
@@ -2481,9 +2942,11 @@ public class ShoppingCartItem implements java.io.Serializable {
return false;
}
- // order item attribute unique
- return !((this.orderItemAttributes == null && UtilValidate.isNotEmpty(orderItemAttributes)) || (UtilValidate.isNotEmpty(this.orderItemAttributes) && orderItemAttributes == null)
- || (this.orderItemAttributes != null && orderItemAttributes != null && (this.orderItemAttributes.size() != orderItemAttributes.size() || !(this.orderItemAttributes.equals(orderItemAttributes)))));
+ // order item attribute unique
+ return !((this.orderItemAttributes == null && UtilValidate.isNotEmpty(orderItemAttributes))
+ || (UtilValidate.isNotEmpty(this.orderItemAttributes) && orderItemAttributes == null)
+ || (this.orderItemAttributes != null && orderItemAttributes != null && (this.orderItemAttributes.size() != orderItemAttributes.size()
+ || !(this.orderItemAttributes.equals(orderItemAttributes)))));
}
/** Gets the Product entity. If it is not already retreived gets it from the delegator */
@@ -2501,6 +2964,10 @@ public class ShoppingCartItem implements java.io.Serializable {
return this._product;
}
+ /**
+ * Gets parent product.
+ * @return the parent product
+ */
public GenericValue getParentProduct() {
if (this._parentProduct != null) {
return this._parentProduct;
@@ -2509,11 +2976,15 @@ public class ShoppingCartItem implements java.io.Serializable {
throw new IllegalStateException("Bad product id");
}
- this._parentProduct = ProductWorker.getParentProduct(productId, this.getDelegator());
+ this._parentProduct = ProductWorker.getParentProduct(productId, this.getDelegator());
return this._parentProduct;
}
+ /**
+ * Gets parent product id.
+ * @return the parent product id
+ */
public String getParentProductId() {
GenericValue parentProduct = this.getParentProduct();
if (parentProduct != null) {
@@ -2522,6 +2993,10 @@ public class ShoppingCartItem implements java.io.Serializable {
return null;
}
+ /**
+ * Gets optional product features.
+ * @return the optional product features
+ */
public Map<String, List<GenericValue>> getOptionalProductFeatures() {
if (_product != null) {
return ProductWorker.getOptionalProductFeatures(getDelegator(), this.productId);
@@ -2530,6 +3005,10 @@ public class ShoppingCartItem implements java.io.Serializable {
return new HashMap<>();
}
+ /**
+ * Gets delegator.
+ * @return the delegator
+ */
public Delegator getDelegator() {
if (delegator == null) {
if (UtilValidate.isEmpty(delegatorName)) {
@@ -2540,6 +3019,13 @@ public class ShoppingCartItem implements java.io.Serializable {
return delegator;
}
+ /**
+ * Explode item list.
+ * @param cart the cart
+ * @param dispatcher the dispatcher
+ * @return the list
+ * @throws CartItemModifyException the cart item modify exception
+ */
public List<ShoppingCartItem> explodeItem(ShoppingCart cart, LocalDispatcher dispatcher) throws CartItemModifyException {
BigDecimal baseQuantity = this.getQuantity();
List<ShoppingCartItem> newItems = new ArrayList<>();
@@ -2555,7 +3041,7 @@ public class ShoppingCartItem implements java.io.Serializable {
Debug.logInfo("Clone's adj: " + item.getAdjustments(), MODULE);
if (UtilValidate.isNotEmpty(item.getAdjustments())) {
List<GenericValue> adjustments = UtilMisc.makeListWritable(item.getAdjustments());
- for (GenericValue adjustment: adjustments) {
+ for (GenericValue adjustment : adjustments) {
if (adjustment != null) {
item.removeAdjustment(adjustment);
@@ -2585,7 +3071,7 @@ public class ShoppingCartItem implements java.io.Serializable {
// re-calc this item's adjustments
if (UtilValidate.isNotEmpty(this.getAdjustments())) {
List<GenericValue> adjustments = UtilMisc.makeListWritable(this.getAdjustments());
- for (GenericValue adjustment: adjustments) {
+ for (GenericValue adjustment : adjustments) {
if (adjustment != null) {
this.removeAdjustment(adjustment);
@@ -2605,19 +3091,4 @@ public class ShoppingCartItem implements java.io.Serializable {
}
return newItems;
}
-
- public static String getPurchaseOrderItemDescription(GenericValue product, GenericValue supplierProduct, Locale locale, LocalDispatcher dispatcher) {
-
- String itemDescription = null;
-
- if (supplierProduct != null) {
- itemDescription = supplierProduct.getString("supplierProductName");
- }
-
- if (UtilValidate.isEmpty(itemDescription)) {
- itemDescription = ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", locale, dispatcher, "html");
- }
-
- return itemDescription;
- }
}
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 fcfd3e9..0943381 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
@@ -1269,4 +1269,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/shipping/ShippingEstimateWrapper.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java
index 150b5ef..cb962a7 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java
@@ -40,24 +40,24 @@ public class ShippingEstimateWrapper {
private static final String MODULE = ShippingEstimateWrapper.class.getName();
- protected Delegator delegator = null;
- protected LocalDispatcher dispatcher = null;
-
- protected Map<GenericValue, BigDecimal> shippingEstimates = null;
- protected List<GenericValue> shippingTimeEstimates = null;
- protected List<GenericValue> shippingMethods = null;
-
- protected GenericValue shippingAddress = null;
- protected GenericValue originAddress = null;
- protected Map<String, BigDecimal> shippableItemFeatures = null;
- protected List<BigDecimal> shippableItemSizes = null;
- protected List<Map<String, Object>> shippableItemInfo = null;
- protected String productStoreId = null;
- protected BigDecimal shippableQuantity = BigDecimal.ZERO;
- protected BigDecimal shippableWeight = BigDecimal.ZERO;
- protected BigDecimal shippableTotal = BigDecimal.ZERO;
- protected String partyId = null;
- protected String supplierPartyId = null;
+ private Delegator delegator = null;
+ private LocalDispatcher dispatcher = null;
+
+ private Map<GenericValue, BigDecimal> shippingEstimates = null;
+ private List<GenericValue> shippingTimeEstimates = null;
+ private List<GenericValue> shippingMethods = null;
+
+ private GenericValue shippingAddress = null;
+ private GenericValue originAddress = null;
+ private Map<String, BigDecimal> shippableItemFeatures = null;
+ private List<BigDecimal> shippableItemSizes = null;
+ private List<Map<String, Object>> shippableItemInfo = null;
+ private String productStoreId = null;
+ private BigDecimal shippableQuantity = BigDecimal.ZERO;
+ private BigDecimal shippableWeight = BigDecimal.ZERO;
+ private BigDecimal shippableTotal = BigDecimal.ZERO;
+ private String partyId = null;
+ private String supplierPartyId = null;
public static ShippingEstimateWrapper getWrapper(LocalDispatcher dispatcher, ShoppingCart cart, int shipGroup) {
return new ShippingEstimateWrapper(dispatcher, cart, shipGroup);
@@ -83,7 +83,8 @@ public class ShippingEstimateWrapper {
if (UtilValidate.isNotEmpty(cart.getShipGroupItems(shipGroup))) {
try {
for (ShoppingCartItem item : cart.getShipGroupItems(shipGroup).keySet()) {
- GenericValue allowanceProductPrice = EntityQuery.use(delegator).from("ProductPrice").where("productPriceTypeId", "SHIPPING_ALLOWANCE", "productId", item.getProductId()).filterByDate().queryFirst();
+ GenericValue allowanceProductPrice = EntityQuery.use(delegator).from("ProductPrice").where("productPriceTypeId",
+ "SHIPPING_ALLOWANCE", "productId", item.getProductId()).filterByDate().queryFirst();
if (allowanceProductPrice != null && UtilValidate.isNotEmpty(allowanceProductPrice.get("price"))) {
totalAllowance = totalAllowance.add(allowanceProductPrice.getBigDecimal("price")).multiply(item.getQuantity());
}
@@ -97,6 +98,9 @@ public class ShippingEstimateWrapper {
this.loadShipmentTimeEstimates();
}
+ /**
+ * Load shipping methods.
+ */
protected void loadShippingMethods() {
try {
this.shippingMethods = ProductStoreWorker.getAvailableStoreShippingMethods(delegator, productStoreId,
@@ -106,6 +110,10 @@ public class ShippingEstimateWrapper {
}
}
+ /**
+ * Load estimates.
+ * @param totalAllowance the total allowance
+ */
protected void loadEstimates(BigDecimal totalAllowance) {
this.shippingEstimates = new HashMap<>();
if (shippingMethods != null) {
@@ -118,7 +126,8 @@ public class ShippingEstimateWrapper {
Map<String, Object> estimateMap = ShippingEvents.getShipGroupEstimate(dispatcher, delegator, "SALES_ORDER",
shippingMethodTypeId, carrierPartyId, carrierRoleTypeId, shippingCmId, productStoreId,
- supplierPartyId, shippableItemInfo, shippableWeight, shippableQuantity, shippableTotal, partyId, productStoreShipMethId, totalAllowance);
+ supplierPartyId, shippableItemInfo, shippableWeight, shippableQuantity, shippableTotal, partyId, productStoreShipMethId,
+ totalAllowance);
if (ServiceUtil.isSuccess(estimateMap)) {
BigDecimal shippingTotal = (BigDecimal) estimateMap.get("shippingTotal");
@@ -128,6 +137,9 @@ public class ShippingEstimateWrapper {
}
}
+ /**
+ * Load shipment time estimates.
+ */
protected void loadShipmentTimeEstimates() {
this.shippingTimeEstimates = new LinkedList<>();
@@ -137,27 +149,50 @@ public class ShippingEstimateWrapper {
String carrierRoleTypeId = shipMethod.getString("roleTypeId");
String carrierPartyId = shipMethod.getString("partyId");
- shippingTimeEstimates.addAll(ShippingEvents.getShipmentTimeEstimates(delegator, shipmentMethodTypeId, carrierPartyId, carrierRoleTypeId, shippingAddress, originAddress));
+ shippingTimeEstimates.addAll(ShippingEvents.getShipmentTimeEstimates(delegator, shipmentMethodTypeId, carrierPartyId,
+ carrierRoleTypeId, shippingAddress, originAddress));
}
}
}
+ /**
+ * Gets shipping methods.
+ * @return the shipping methods
+ */
public List<GenericValue> getShippingMethods() {
return shippingMethods;
}
+ /**
+ * Gets all estimates.
+ * @return the all estimates
+ */
public Map<GenericValue, BigDecimal> getAllEstimates() {
return shippingEstimates;
}
+ /**
+ * Gets shipping estimate.
+ * @param storeCarrierShipMethod the store carrier ship method
+ * @return the shipping estimate
+ */
public BigDecimal getShippingEstimate(GenericValue storeCarrierShipMethod) {
return shippingEstimates.get(storeCarrierShipMethod);
}
+ /**
+ * Gets shipping time estimates.
+ * @return the shipping time estimates
+ */
public List<GenericValue> getShippingTimeEstimates() {
return shippingTimeEstimates;
}
+ /**
+ * Gets shipping time estimate in day.
+ * @param storeCarrierShipMethod the store carrier ship method
+ * @return the shipping time estimate in day
+ */
public Double getShippingTimeEstimateInDay(GenericValue storeCarrierShipMethod) {
return ShippingEvents.getShippingTimeEstimateInDay(dispatcher, storeCarrierShipMethod, shippingTimeEstimates);
}
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
index 7d50d24..6e03f69 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
@@ -522,7 +522,6 @@ public class ShippingEvents {
/**
* Return the {@link GenericValue} ShipmentTimeEstimate matching the carrier shipment method
- *
* @param storeCarrierShipMethod ShipmentMethod used for estimation
* @param shippingTimeEstimates available configured estimation
* @return
@@ -542,7 +541,6 @@ public class ShippingEvents {
/**
* Return the number of days estimated for shipping
- *
* @param dispatcher
* @param storeCarrierShipMethod ShipmentMethod used for estimation
* @param shippingTimeEstimates available configured estimation
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
index f195f1a..a7288a1 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
@@ -419,7 +419,6 @@ public class ShoppingListServices {
/**
* Create a new shoppingCart form a shoppingList
- *
* @param dispatcher the local dispatcher
* @param shoppingList a GenericValue object of the shopping list
* @param locale the locale in use
@@ -431,7 +430,6 @@ public class ShoppingListServices {
/**
* Add a shoppinglist to an existing shoppingcart
- *
* @param listCart the shopping cart list
* @param dispatcher the local dispatcher
* @param shoppingList a GenericValue object of the shopping list
@@ -551,7 +549,6 @@ public class ShoppingListServices {
* Given an orderId, this service will look through all its OrderItems and for each shoppingListItemId
* and shoppingListItemSeqId, update the quantity purchased in the ShoppingListItem entity. Used for
* tracking how many of shopping list items are purchased. This service is mounted as a seca on storeOrder.
- *
* @param ctx - The DispatchContext that this service is operating in
* @param context - Map containing the input parameters
* @return Map with the result of the service, the output parameters
diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
index c6b0f1f..bdba2c9 100644
--- a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
+++ b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java
@@ -272,7 +272,6 @@ public class CommunicationEventServices {
/**
* Service to send all content associated to a FILE_TRANSFER_COMM CommunicationEvent,
* with contactMechIdTo as a FtpAdress contactMech
- *
* @param ctx
* @param context
* @return
@@ -859,28 +858,21 @@ public class CommunicationEventServices {
/**
* This service is the main one for processing incoming emails.
- *
* Its only argument is a wrapper for the JavaMail MimeMessage object.
* From this object, all the fields, headers and content of the message can be accessed.
- *
* The first thing this service does is try to discover the partyId of the message sender
* by doing a reverse find on the email address. It uses the findPartyFromEmailAddress service to do this.
- *
* It then creates a CommunicationEvent entity by calling the createCommunicationEvent service using the appropriate fields from the email and the
* discovered partyId, if it exists, as the partyIdFrom. Note that it sets the communicationEventTypeId
* field to AUTO_EMAIL_COMM. This is useful for tracking email generated communications.
- *
* The service tries to find appropriate content for inclusion in the CommunicationEvent.content field.
* If the contentType of the content starts with "text", the getContent() call returns a string and it is used.
* If the contentType starts with "multipart", then the "parts" of the content are iterated thru and the first
* one of mime type, "text/..." is used.
- *
* If the contentType has a value of "multipart" then the parts of the content (except the one used in the main
* CommunicationEvent.content field) are cycled thru and attached to the CommunicationEvent entity using the
* createCommContentDataResource service. This happens in the EmailWorker.addAttachmentsToCommEvent method.
- *
* However multiparts can contain multiparts. A recursive function has been added.
- *
* -Al Byers - Hans Bakker
* @param dctx the dispatch context
* @param context the context
diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java
index 5a4f1fb..aea7203 100644
--- a/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java
+++ b/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java
@@ -874,7 +874,6 @@ public class ContactMechServices {
/**
* Just wraps the ContactMechWorker method of the same name.
- *
*@param ctx The DispatchContext that this service is operating in
*@param context Map containing the input parameters
*@return Map with the result of the service, the output parameters
diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechWorker.java b/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechWorker.java
index 2f96d04..0144ce0 100644
--- a/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechWorker.java
+++ b/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechWorker.java
@@ -1009,7 +1009,6 @@ public class ContactMechWorker {
/**
* Returns a <b>PostalAddress</b> <code>GenericValue</code> as a URL encoded <code>String</code>.
- *
* @param postalAddress A <b>PostalAddress</b> <code>GenericValue</code>.
* @return A URL encoded <code>String</code>.
* @throws GenericEntityException
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 a1ffe1a..9be9e7b 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
@@ -1894,7 +1894,6 @@ public class PartyServices {
* Changes the association of contact mechs, purposes, notes, orders and attributes from
* one party to another for the purpose of merging records together. Flags the from party
* as disabled so it no longer appears in a search.
- *
* @param dctx the dispatch context
* @param context the context
* @return the result of the service execution
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 cbaab5a..8a42484 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
@@ -231,7 +231,6 @@ public class PartyWorker {
* The matching process is as follows:
* 1. Calls {@link #findMatchingPartyPostalAddress(Delegator, String, String, String, String, String, String, String, String)} to retrieve a list of address matched PartyAndPostalAddress records. Results are limited to Parties of type PERSON.
* 2. For each matching PartyAndPostalAddress record, the Person record for the Party is then retrieved and an upper case comparison is performed against the supplied firstName, lastName and if provided, middleName.
- *
* @param delegator Delegator instance
* @param address1 PostalAddress.address1 to match against (Required).
* @param address2 Optional PostalAddress.address2 to match against.
@@ -301,7 +300,6 @@ public class PartyWorker {
* Finds all matching parties based on the values provided. Excludes party records with a statusId of PARTY_DISABLED. Results are ordered by descending PartyContactMech.fromDate.
* 1. Candidate addresses are found by querying PartyAndPostalAddress using the supplied city and if provided, stateProvinceGeoId, postalCode, postalCodeExt and countryGeoId
* 2. In-memory address line comparisons are then performed against the supplied address1 and if provided, address2. Address lines are compared after the strings have been converted using {@link #makeMatchingString(Delegator, String)}.
- *
* @param delegator Delegator instance
* @param address1 PostalAddress.address1 to match against (Required).
* @param address2 Optional PostalAddress.address2 to match against.
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java
index 9bc6868..0d4d461 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java
@@ -240,7 +240,6 @@ public final class SeoContextFilter implements Filter {
/**
* Forward a uri according to forward pattern regular expressions. Note: this is developed for Filter usage.
- *
* @param uri String to reverse transform
* @return String
*/
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java
index b501302..9263e97 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java
@@ -150,7 +150,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* Check whether the category map is initialed.
- *
* @return a boolean value to indicate whether the category map has been initialized.
*/
public static boolean isCategoryMapInitialed() {
@@ -159,7 +158,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* Get the category name/id map.
- *
* @return the category name/id map
*/
public static Map<String, String> getCategoryNameIdMap() {
@@ -168,7 +166,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* Get the category id/name map.
- *
* @return the category id/name map
*/
public static Map<String, String> getCategoryIdNameMap() {
@@ -178,7 +175,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* Initial category-name/category-id map. Note: as a key, the category-name should be: 1. ascii 2. lower cased and
* use hyphen between the words. If not, the category id will be used.
- *
*/
public static synchronized void initCategoryMap(HttpServletRequest request) {
Delegator delegator = (Delegator) request.getAttribute("delegator");
@@ -244,7 +240,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* Make product url according to the configurations.
- *
* @return String a catalog url
*/
public static String makeProductUrl(HttpServletRequest request, String productId, String currentCategoryId,
@@ -335,7 +330,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* Make category url according to the configurations.
- *
* @return String a category url
*/
public static String makeCategoryUrl(HttpServletRequest request, String currentCategoryId,
@@ -411,7 +405,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* Make product url according to the configurations.
- *
* @return String a catalog url
*/
public static String makeProductUrl(String contextPath, List<String> trail, String productId, String productName,
@@ -473,7 +466,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* Get a string lower cased and hyphen connected.
- *
* @param name
* a String to be transformed
* @return String nice name
@@ -502,7 +494,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* Forward a uri according to forward pattern regular expressions.
- *
* @param request
* @param response
* @param delegator
@@ -635,7 +626,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* Forward a category uri according to forward pattern regular expressions.
- *
* @param request
* @param response
* @param delegator
@@ -698,7 +688,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* This is used when building product url in services.
- *
* @param delegator
* @param wrapper
* @param prefix
@@ -789,7 +778,6 @@ public class CatalogUrlSeoTransform implements TemplateTransformModel {
/**
* This is used when building category url in services.
- *
* @param delegator
* @param wrapper
* @param prefix
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java
index 19f0004..46dac1a 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java
@@ -129,10 +129,8 @@ public class SeoTransform implements TemplateTransformModel {
/**
* Transform a url according to seo pattern regular expressions.
- *
* @param url, String to do the seo transform
* @param isAnon, boolean to indicate whether it's an anonymous visit.
- *
* @return String, the transformed url.
*/
public static String seoUrl(String url, boolean isAnon) {
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/UrlRegexpTransform.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/UrlRegexpTransform.java
index 5777adc..39b77de 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/UrlRegexpTransform.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/UrlRegexpTransform.java
@@ -185,12 +185,10 @@ public class UrlRegexpTransform implements TemplateTransformModel {
/**
* Transform a url according to seo pattern regular expressions.
- *
* @param url
* String to do the seo transform
* @param isAnon
* boolean to indicate whether it's an anonymous visit.
- *
* @return String the transformed url.
*/
public static String seoUrl(String url, boolean isAnon) {
@@ -248,7 +246,6 @@ public class UrlRegexpTransform implements TemplateTransformModel {
/**
* Forward a uri according to forward pattern regular expressions. Note: this is developed for Filter usage.
- *
* @param uri
* String to reverse transform
* @return String
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java
index 2dba196..6f5e3b6 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java
@@ -356,7 +356,7 @@ public final class ProductConfigWorker {
List<GenericValue> components = oneOption.getComponents();
for (GenericValue component: components) {
if (oneOption.isVirtualComponent(component) && UtilValidate.isNotEmpty(componentOptions)) {
- String componentOption = componentOptions.get(component.getString("productId"));
+ String componentOption = componentOptions.get(component.getString("productId"));
GenericValue configOptionProductOption = delegator.makeValue("ConfigOptionProductOption");
configOptionProductOption.put("configId", configId);
configOptionProductOption.put("configItemId", configItemId);
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java
index 63f66c8..07aa314 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java
@@ -51,7 +51,6 @@ public class ParametricSearch {
/**
* Gets all features associated with the specified category through:<br>
* ProductCategory -> ProductFeatureCategoryAppl -> ProductFeatureCategory -> ProductFeature.
- *
* @return a Map of Lists of ProductFeature GenericValue objects organized by productFeatureTypeId.
*/
public static Map<String, List<GenericValue>> makeCategoryFeatureLists(String productCategoryId, Delegator delegator) {
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java b/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java
index df7c9b9..71a201a 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java
@@ -63,7 +63,6 @@ public class ScaleImage {
* scaleImageInAllSize
* <p>
* Scale the original image into all different size Types (small, medium, large, detail)
- *
* @param context Context
* @param filenameToUse Filename of future image files
* @param viewType "Main" view or "additional" view
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java
index 01357b3..3c4b8c5 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java
@@ -104,7 +104,6 @@ public final class InventoryWorker {
/**
* Gets the quanitty of each product in the order that is outstanding across all orders of the given input type.
* Uses the OrderItemQuantityReportGroupByProduct view entity.
- *
* @param productIds Collection of disticnt productIds in an order. Use OrderReadHelper.getOrderProductIds()
* @param orderTypeId Either "SALES_ORDER" or "PURCHASE_ORDER"
* @param delegator The delegator to use
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 d528d05..d7bcd8e 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
@@ -73,7 +73,6 @@ public class ProductEvents {
/**
* Updates/adds keywords for all products
- *
* @param request HTTPRequest object for the current request
* @param response HTTPResponse object for the current request
* @return String specifying the exit status of this event
@@ -189,7 +188,6 @@ public class ProductEvents {
/**
* Updates ProductAssoc information according to UPDATE_MODE parameter
- *
* @param request The HTTPRequest object for the current request
* @param response The HTTPResponse object for the current request
* @return String specifying the exit status of this event
@@ -938,7 +936,6 @@ public class ProductEvents {
/**
* If ProductStore.requireCustomerRole == Y then the loggedin user must be associated with the store in the customer role.
* This event method is called from the ProductEvents.storeCheckLogin and ProductEvents.storeLogin
- *
* @param request
* @param response
* @return String with response, maybe "success" or "error" if logged in user is not associated with the ProductStore in the CUSTOMER role.
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java
index 48270b3..8dad651 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java
@@ -140,50 +140,88 @@ public class ProductSearch {
}
}
+ /**
+ * The type Product search context.
+ */
public static class ProductSearchContext {
- public int index = 1;
- public List<EntityCondition> entityConditionList = new LinkedList<>();
- public List<String> orderByList = new LinkedList<>();
- public List<String> fieldsToSelect = UtilMisc.toList("mainProductId");
- public DynamicViewEntity dynamicViewEntity = new DynamicViewEntity();
- public boolean productIdGroupBy = false;
- public boolean includedKeywordSearch = false;
- public Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
- public List<Set<String>> keywordFixedOrSetAndList = new LinkedList<>();
- public Set<String> orKeywordFixedSet = new HashSet<>();
- public Set<String> andKeywordFixedSet = new HashSet<>();
- public List<GenericValue> productSearchConstraintList = new LinkedList<>();
- public ResultSortOrder resultSortOrder = null;
- public Integer resultOffset = null;
- public Integer maxResults = null;
- protected Delegator delegator = null;
- protected String visitId = null;
- protected Integer totalResults = null;
-
- public Set<String> includeCategoryIds = new HashSet<>();
- public Set<String> excludeCategoryIds = new HashSet<>();
- public Set<String> alwaysIncludeCategoryIds = new HashSet<>();
-
- public List<Set<String>> includeCategoryIdOrSetAndList = new LinkedList<>();
- public List<Set<String>> alwaysIncludeCategoryIdOrSetAndList = new LinkedList<>();
-
- public Set<String> includeFeatureIds = new HashSet<>();
- public Set<String> excludeFeatureIds = new HashSet<>();
- public Set<String> alwaysIncludeFeatureIds = new HashSet<>();
-
- public List<Set<String>> includeFeatureIdOrSetAndList = new LinkedList<>();
- public List<Set<String>> alwaysIncludeFeatureIdOrSetAndList = new LinkedList<>();
-
- public Set<String> includeFeatureCategoryIds = new HashSet<>();
- public Set<String> excludeFeatureCategoryIds = new HashSet<>();
- public Set<String> alwaysIncludeFeatureCategoryIds = new HashSet<>();
-
- public Set<String> includeFeatureGroupIds = new HashSet<>();
- public Set<String> excludeFeatureGroupIds = new HashSet<>();
- public Set<String> alwaysIncludeFeatureGroupIds = new HashSet<>();
-
- public List<String> keywordTypeIds = new LinkedList<>();
- public String statusId = null;
+ private int index = 1;
+ private List<EntityCondition> entityConditionList = new LinkedList<>();
+ private List<String> orderByList = new LinkedList<>();
+ private List<String> fieldsToSelect = UtilMisc.toList("mainProductId");
+ private DynamicViewEntity dynamicViewEntity = new DynamicViewEntity();
+ private boolean productIdGroupBy = false;
+ private boolean includedKeywordSearch = false;
+ private Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
+ private List<Set<String>> keywordFixedOrSetAndList = new LinkedList<>();
+ private Set<String> orKeywordFixedSet = new HashSet<>();
+ private Set<String> andKeywordFixedSet = new HashSet<>();
+ private List<GenericValue> productSearchConstraintList = new LinkedList<>();
+ private ResultSortOrder resultSortOrder = null;
+ private Integer resultOffset = null;
+ private Integer maxResults = null;
+ private Delegator delegator = null;
+ private String visitId = null;
+ private Integer totalResults = null;
+
+ private Set<String> includeCategoryIds = new HashSet<>();
+ private Set<String> excludeCategoryIds = new HashSet<>();
+ private Set<String> alwaysIncludeCategoryIds = new HashSet<>();
+
+ private List<Set<String>> includeCategoryIdOrSetAndList = new LinkedList<>();
+ private List<Set<String>> alwaysIncludeCategoryIdOrSetAndList = new LinkedList<>();
+
+ private Set<String> includeFeatureIds = new HashSet<>();
+ private Set<String> excludeFeatureIds = new HashSet<>();
+ private Set<String> alwaysIncludeFeatureIds = new HashSet<>();
+
+ private List<Set<String>> includeFeatureIdOrSetAndList = new LinkedList<>();
+ private List<Set<String>> alwaysIncludeFeatureIdOrSetAndList = new LinkedList<>();
+
+ private Set<String> includeFeatureCategoryIds = new HashSet<>();
+ private Set<String> excludeFeatureCategoryIds = new HashSet<>();
+ private Set<String> alwaysIncludeFeatureCategoryIds = new HashSet<>();
+
+ private Set<String> includeFeatureGroupIds = new HashSet<>();
+ private Set<String> excludeFeatureGroupIds = new HashSet<>();
+ private Set<String> alwaysIncludeFeatureGroupIds = new HashSet<>();
+
+ public List<EntityCondition> getEntityConditionList() {
+ return entityConditionList;
+ }
+
+ public DynamicViewEntity getDynamicViewEntity() {
+ return dynamicViewEntity;
+ }
+
+ public List<String> getOrderByList() {
+ return orderByList;
+ }
+
+ public Timestamp getNowTimestamp() {
+ return nowTimestamp;
+ }
+
+ /**
+ * Sets keyword type ids.
+ *
+ * @param keywordTypeIds the keyword type ids
+ */
+ public void setKeywordTypeIds(List<String> keywordTypeIds) {
+ this.keywordTypeIds = keywordTypeIds;
+ }
+
+ private List<String> keywordTypeIds = new LinkedList<>();
+
+ /**
+ * Sets status id.
+ *
+ * @param statusId the status id
+ */
+ public void setStatusId(String statusId) {
+ this.statusId = statusId;
+ }
+
+ private String statusId = null;
public ProductSearchContext(Delegator delegator, String visitId) {
this.delegator = delegator;
@@ -193,10 +231,20 @@ public class ProductSearch {
dynamicViewEntity.addViewLink("PROD", "PRODCI", Boolean.TRUE, ModelKeyMap.makeKeyMapList("productId"));
}
+ /**
+ * Gets delegator.
+ *
+ * @return the delegator
+ */
public Delegator getDelegator() {
return this.delegator;
}
+ /**
+ * Add product search constraints.
+ *
+ * @param productSearchConstraintList the product search constraint list
+ */
public void addProductSearchConstraints(List<ProductSearchConstraint> productSearchConstraintList) {
// Go through the constraints and add them in
for (ProductSearchConstraint constraint: productSearchConstraintList) {
@@ -204,10 +252,20 @@ public class ProductSearch {
}
}
+ /**
+ * Sets result sort order.
+ *
+ * @param resultSortOrder the result sort order
+ */
public void setResultSortOrder(ResultSortOrder resultSortOrder) {
this.resultSortOrder = resultSortOrder;
}
+ /**
+ * Sets result offset.
+ *
+ * @param resultOffset the result offset
+ */
public void setResultOffset(Integer resultOffset) {
this.resultOffset = resultOffset;
}
@@ -387,7 +445,9 @@ public class ProductSearch {
this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "FromDate", "fromDate", null, null, null, null);
this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ThruDate", "thruDate", null, null, null, null);
this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
- incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
+ incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate",
+ EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate",
+ EntityOperator.GREATER_THAN, this.nowTimestamp)));
incExcCondList.add(EntityCondition.makeCondition(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
incExcCondList.add(EntityCondition.makeCondition(categoryPrefix + "ProductCategoryId", EntityOperator.EQUALS, includeCategoryId));
}
@@ -403,7 +463,9 @@ public class ProductSearch {
this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null);
this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null);
this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
- incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
+ incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate",
+ EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate",
+ EntityOperator.GREATER_THAN, this.nowTimestamp)));
incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "ProductFeatureId", EntityOperator.EQUALS, includeFeatureId));
}
@@ -418,14 +480,18 @@ public class ProductSearch {
this.dynamicViewEntity.addMemberEntity(entityAlias, "ProductFeatureAppl");
this.dynamicViewEntity.addMemberEntity(otherEntityAlias, "ProductFeature");
- this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "ProductFeatureCategoryId", "productFeatureCategoryId", null, null, null, null);
+ this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "ProductFeatureCategoryId", "productFeatureCategoryId",
+ null, null, null, null);
this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null);
this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null);
this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productFeatureId"));
- incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
+ incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate",
+ EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate",
+ EntityOperator.GREATER_THAN, this.nowTimestamp)));
incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
- incExcCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "ProductFeatureCategoryId", EntityOperator.EQUALS, includeFeatureCategoryId));
+ incExcCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "ProductFeatureCategoryId", EntityOperator.EQUALS,
+ includeFeatureCategoryId));
}
}
if (includeFeatureGroupIds.size() > 0) {
@@ -438,53 +504,68 @@ public class ProductSearch {
this.dynamicViewEntity.addMemberEntity(entityAlias, "ProductFeatureAppl");
this.dynamicViewEntity.addMemberEntity(otherEntityAlias, "ProductFeatureGroupAppl");
- this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "ProductFeatureGroupId", "productFeatureGroupId", null, null, null, null);
+ this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "ProductFeatureGroupId", "productFeatureGroupId", null,
+ null, null, null);
this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null);
this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null);
this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "FromDate", "fromDate", null, null, null, null);
this.dynamicViewEntity.addAlias(otherEntityAlias, otherFeaturePrefix + "ThruDate", "thruDate", null, null, null, null);
this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
this.dynamicViewEntity.addViewLink(entityAlias, otherEntityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productFeatureId"));
- incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
+ incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS,
+ null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate",
+ EntityOperator.GREATER_THAN, this.nowTimestamp)));
incExcCondList.add(EntityCondition.makeCondition(featurePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
- incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
+ incExcCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate",
+ EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(otherFeaturePrefix + "ThruDate",
+ EntityOperator.GREATER_THAN, this.nowTimestamp)));
incExcCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
- incExcCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "ProductFeatureGroupId", EntityOperator.EQUALS, includeFeatureGroupId));
+ incExcCondList.add(EntityCondition.makeCondition(otherFeaturePrefix + "ProductFeatureGroupId", EntityOperator.EQUALS,
+ includeFeatureGroupId));
}
}
if (excludeCategoryIds.size() > 0) {
List<EntityCondition> idExcludeCondList = new LinkedList<>();
- idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
+ idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null),
+ EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
idExcludeCondList.add(EntityCondition.makeCondition("productCategoryId", EntityOperator.IN, excludeCategoryIds));
- EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductCategoryMember", "productId", EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator);
+ EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductCategoryMember", "productId",
+ EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator);
incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond));
}
if (excludeFeatureIds.size() > 0) {
List<EntityCondition> idExcludeCondList = new LinkedList<>();
- idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
+ idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null),
+ EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
idExcludeCondList.add(EntityCondition.makeCondition("productFeatureId", EntityOperator.IN, excludeFeatureIds));
- EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductFeatureAppl", "productId", EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator);
+ EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductFeatureAppl", "productId",
+ EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator);
incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond));
}
if (excludeFeatureCategoryIds.size() > 0) {
List<EntityCondition> idExcludeCondList = new LinkedList<>();
- idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
+ idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null),
+ EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
idExcludeCondList.add(EntityCondition.makeCondition("productFeatureCategoryId", EntityOperator.IN, excludeFeatureCategoryIds));
- EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductFeatureAndAppl", "productId", EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator);
+ EntityConditionValue subSelCond = new EntityConditionSubSelect("ProductFeatureAndAppl", "productId",
+ EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator);
incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond));
}
if (excludeFeatureGroupIds.size() > 0) {
List<EntityCondition> idExcludeCondList = new LinkedList<>();
- idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
+ idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null),
+ EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
idExcludeCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
- idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("groupThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("groupThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
+ idExcludeCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("groupThruDate", EntityOperator.EQUALS, null),
+ EntityOperator.OR, EntityCondition.makeCondition("groupThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
idExcludeCondList.add(EntityCondition.makeCondition("groupFromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
idExcludeCondList.add(EntityCondition.makeCondition("productFeatureGroupId", EntityOperator.IN, excludeFeatureGroupIds));
- EntityConditionValue subSelCond = new EntityConditionSubSelect("ProdFeaGrpAppAndProdFeaApp", "productId", EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator);
+ EntityConditionValue subSelCond = new EntityConditionSubSelect("ProdFeaGrpAppAndProdFeaApp", "productId",
+ EntityCondition.makeCondition(idExcludeCondList, EntityOperator.AND), true, delegator);
incExcCondList.add(EntityCondition.makeCondition("mainProductId", EntityOperator.NOT_EQUAL, subSelCond));
}
@@ -498,7 +579,9 @@ public class ProductSearch {
this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "FromDate", "fromDate", null, null, null, null);
this.dynamicViewEntity.addAlias(entityAlias, categoryPrefix + "ThruDate", "thruDate", null, null, null, null);
this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
- alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
+ alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(categoryPrefix + "ThruDate",
+ EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(categoryPrefix + "ThruDate",
+ EntityOperator.GREATER_THAN, this.nowTimestamp)));
alwIncCondList.add(EntityCondition.makeCondition(categoryPrefix + "FromDate", EntityOperator.LESS_THAN, this.nowTimestamp));
alwIncCondList.add(EntityCondition.makeCondition(categoryPrefix + "ProductCategoryId", EntityOperator.IN, alwaysIncludeCategoryIds));
}
@@ -512,7 +595,9 @@ public class ProductSearch {
this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "FromDate", "fromDate", null, null, null, null);
this.dynamicViewEntity.addAlias(entityAlias, featurePrefix + "ThruDate", "thruDate", null, null, null, null);
this.dynamicViewEntity.addViewLink("PROD", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
- alwIncCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition(featurePrefix + "ThruDate", EntityOperator.GREATER_THAN, this.nowTimestamp)));
... 2763 lines suppressed ...