Skip to content
Permalink
Browse files

Reverted: Changes done at r#1857089 and r#1857090 (OFBIZ-10911)(OFBIZ…

…-10912)

The Cleanups introduced by those revisions has introduced some
unexpected regressions making the Gradle ‘loadAll’ task fail.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1857091 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Apr 7, 2019
1 parent fef3988 commit a15b7b1996866dad11ff7e14986d93a5fb6f9787
Showing with 251 additions and 157 deletions.
  1. +10 −6 applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java
  2. +1 −0 applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java
  3. +4 −2 applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
  4. +1 −1 applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java
  5. +5 −3 applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java
  6. +3 −3 applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java
  7. +8 −4 applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
  8. +12 −14 applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java
  9. +1 −1 applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
  10. +2 −2 applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java
  11. +1 −1 applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
  12. +8 −5 applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java
  13. +1 −1 applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java
  14. +11 −0 applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java
  15. +2 −1 applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java
  16. +3 −1 applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java
  17. +1 −1 applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java
  18. +3 −1 framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java
  19. +1 −0 framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java
  20. +1 −3 framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java
  21. +1 −0 framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java
  22. +3 −1 framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java
  23. +2 −0 framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
  24. +1 −1 framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
  25. +154 −97 framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
  26. +4 −2 framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMapProcessor.java
  27. +1 −2 framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/Iterate.java
  28. +3 −1 framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SOAPEventHandler.java
  29. +1 −1 framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java
  30. +2 −2 framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java
@@ -212,7 +212,8 @@
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";

GenericValue tempVal;
GenericValue tempVal = null;

try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -392,7 +393,8 @@
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";

GenericValue tempVal;
GenericValue tempVal = null;

try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -738,7 +740,7 @@
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";

GenericValue tempVal;
GenericValue tempVal = null;
try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -869,7 +871,8 @@
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";

GenericValue tempVal;
GenericValue tempVal = null;

try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -973,7 +976,7 @@
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";

GenericValue tempVal;
GenericValue tempVal = null;
try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -1095,7 +1098,8 @@
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";

GenericValue tempVal;
GenericValue tempVal = null;

try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -222,6 +222,7 @@ public static String updatePublishLinks(HttpServletRequest request, HttpServletR
Timestamp origFromDate = null;
for (Object [] pubArr : origSubList) {
Timestamp fromDate = (Timestamp)pubArr[2];
origSubContentId = null;
if (fromDate != null) {
origSubContentId = (String)pubArr[0];
origFromDate = fromDate;
@@ -163,8 +163,10 @@
List<String> tmpPurposes = StringUtil.split(contentPurposeString, "|");
contentPurposeList.addAll(tmpPurposes);
}
context.put("contentPurposeList", contentPurposeList);
context.put("contentPurposeString", null);
if (contentPurposeList != null) {
context.put("contentPurposeList", contentPurposeList);
context.put("contentPurposeString", null);
}

if (Debug.infoOn()) {
Debug.logInfo("in persist... contentPurposeList(0):" + contentPurposeList, module);
@@ -195,7 +195,7 @@ public static void renderContentAsText(LocalDispatcher dispatcher, GenericValue
custMethod = EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", content.get("customMethodId")).cache().queryOne();
}
if (custMethod != null) serviceName = custMethod.getString("customMethodName");
if (UtilValidate.isNotEmpty(serviceName)) {
if (dispatcher != null && UtilValidate.isNotEmpty(serviceName)) {
DispatchContext dctx = dispatcher.getDispatchContext();
ModelService service = dctx.getModelService(serviceName);
if (service != null) {
@@ -350,9 +350,11 @@ protected void loadParents(String partBomTypeId, Date inDate, List<GenericValue>
oneChildNode = new BOMNode(oneChild.getString("productId"), delegator, dispatcher, userLogin);
// Configurator
// If the node is null this means that the node has been discarded by the rules.
oneChildNode.setParentNode(this);
oneChildNode.setTree(tree);
oneChildNode.loadParents(partBomTypeId, inDate, productFeatures);
if (oneChildNode != null) {
oneChildNode.setParentNode(this);
oneChildNode.setTree(tree);
oneChildNode.loadParents(partBomTypeId, inDate, productFeatures);
}
childrenNodes.add(oneChildNode);
}
}
@@ -319,16 +319,16 @@
fromDate = new Date();
}

BOMTree tree;
BOMTree tree = null;
try {
tree = new BOMTree(productId, bomType, fromDate, type, delegator, dispatcher, userLogin);
} catch (GenericEntityException gee) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale));
}
if (quantity != null) {
if (tree != null && quantity != null) {
tree.setRootQuantity(quantity);
}
if (amount != null) {
if (tree != null && amount != null) {
tree.setRootAmount(amount);
}
result.put("tree", tree);
@@ -1253,7 +1253,9 @@ public static void reserveInventory(Delegator delegator, LocalDispatcher dispatc
Map<String, Object> reserveResult = dispatcher.runSync("reserveStoreInventory", reserveInput);
if (ServiceUtil.isError(reserveResult)) {
String invErrMsg = "The product ";
invErrMsg += getProductName(product, orderItem);
if (product != null) {
invErrMsg += getProductName(product, orderItem);
}
invErrMsg += " with ID " + orderItem.getString("productId") + " is no longer in stock. Please try reducing the quantity or removing the product from this order.";
resErrorMessages.add(invErrMsg);
}
@@ -5982,8 +5984,10 @@ private static void saveUpdatedCartToOrder(LocalDispatcher dispatcher, Delegator

if (rowNumber == null) {
Long count = EntityQuery.use(delegator).from("OrderItemShipGroupAssoc").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryCount();
rowNumber = count.intValue();
result.put("rowNumber", rowNumber);
if (count != null) {
rowNumber = count.intValue();
result.put("rowNumber", rowNumber);
}
}

//find OISG Assoc
@@ -6095,7 +6099,7 @@ private static void saveUpdatedCartToOrder(LocalDispatcher dispatcher, Delegator
result.put("totalQuantity", totalQuantity);

//Only for multi service calling and the last row : test if orderItem quantity equals OrderItemShipGroupAssocs quantitys
if (rowCount != null) {
if (rowCount != null && rowNumber != null ) {
int rowCountInt = rowCount;
int rowNumberInt = rowNumber;
if (rowCountInt == rowNumberInt - 1) {
@@ -435,20 +435,18 @@ public static String setCheckOutOptions(HttpServletRequest request, HttpServletR
public static String checkoutValidation(HttpServletRequest request, HttpServletResponse response) {
ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("shoppingCart");
if (cart.isSalesOrder()) {
List<GenericValue> paymentMethodTypes = cart.getPaymentMethodTypes();
if (UtilValidate.isEmpty(paymentMethodTypes)) {
String errMsg = UtilProperties.getMessage(resource_error, "OrderNoPaymentMethodTypeSelected",
cart.getLocale());
request.setAttribute("_ERROR_MESSAGE_",errMsg);
return "error";
}
String shipmentMethod = cart.getShipmentMethodTypeId();
if (UtilValidate.isEmpty(shipmentMethod)) {
String errMsg = UtilProperties.getMessage(resource_error, "OrderNoShipmentMethodSelected",
cart.getLocale());
request.setAttribute("_ERROR_MESSAGE_",errMsg);
return "error";
}
List<GenericValue> paymentMethodTypes = cart.getPaymentMethodTypes();
if (UtilValidate.isEmpty(paymentMethodTypes)) {
String errMsg = UtilProperties.getMessage(resource_error, "OrderNoPaymentMethodTypeSelected", (cart != null ? cart.getLocale() : UtilHttp.getLocale(request)));
request.setAttribute("_ERROR_MESSAGE_",errMsg);
return "error";
}
String shipmentMethod = cart.getShipmentMethodTypeId();
if (UtilValidate.isEmpty(shipmentMethod)) {
String errMsg = UtilProperties.getMessage(resource_error, "OrderNoShipmentMethodSelected", (cart != null ? cart.getLocale() : UtilHttp.getLocale(request)));
request.setAttribute("_ERROR_MESSAGE_",errMsg);
return "error";
}
}
return "success";
}
@@ -4706,7 +4706,7 @@ public GenericValue getOriginAddress(ShoppingCart cart) {
Delegator delegator = cart.delegator;
//check information from the cart ship info
try {
if (facilityId != null) {
if (originAddress == null && facilityId != null) {
originAddress = ShippingEvents.getShippingOriginContactMechFromFacility(delegator, facilityId);
}
if (originAddress == null && supplierPartyId != null) {
@@ -471,7 +471,7 @@ public static String restoreAutoSaveList(HttpServletRequest request, HttpServlet
Debug.logError(e, module);
}
cart.setAutoSaveListId(autoSaveListId);
} else {
} else if (userLogin != null) {
String existingAutoSaveListId = null;
try {
existingAutoSaveListId = getAutoSaveListId(delegator, dispatcher, null, userLogin, cart.getProductStoreId());
@@ -519,7 +519,7 @@ public static String restoreAutoSaveList(HttpServletRequest request, HttpServlet
if (okayToLoad) {
String prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
try {
addListToCart(delegator, dispatcher, cart, prodCatalogId, autoSaveListId, false, false, true);
addListToCart(delegator, dispatcher, cart, prodCatalogId, autoSaveListId, false, false, userLogin != null ? true : false);
cart.setLastListRestore(UtilDateTime.nowTimestamp());
} catch (IllegalArgumentException e) {
Debug.logError(e, module);
@@ -171,7 +171,7 @@

// store the order
Map<String, Object> createResp = helper.createOrder(userLogin);
if (createResp == null || ServiceUtil.isError(createResp)) {
if (createResp == null || (createResp != null && ServiceUtil.isError(createResp))) {
Debug.logError("Cannot create order for shopping list - " + shoppingList, module);
} else {

@@ -157,7 +157,7 @@
}

String contactMechId = (String) context.get("contactMechId");
GenericValue contactMech;
GenericValue contactMech = null;
GenericValue partyContactMech = null;

try {
@@ -427,7 +427,7 @@
}

String contactMechId = (String) context.get("contactMechId");
GenericValue contactMech;
GenericValue contactMech = null;
GenericValue partyContactMech = null;

try {
@@ -469,7 +469,8 @@
GenericValue relatedEntityToSet = null;

if ("POSTAL_ADDRESS".equals(contactMech.getString("contactMechTypeId"))) {
GenericValue addr;
GenericValue addr = null;

try {
addr = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", contactMechId).queryOne();
} catch (GenericEntityException e) {
@@ -668,6 +669,7 @@
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
contactMech = null;
partyContactMech = null;
}
if (contactMech == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -685,7 +687,8 @@
GenericValue relatedEntityToSet = null;

if ("TELECOM_NUMBER".equals(contactMech.getString("contactMechTypeId"))) {
GenericValue telNum;
GenericValue telNum = null;

try {
telNum = EntityQuery.use(delegator).from("TelecomNumber").where("contactMechId", contactMechId).queryOne();
} catch (GenericEntityException e) {
@@ -831,7 +834,7 @@
String contactMechPurposeTypeId = (String) context.get("contactMechPurposeTypeId");
Timestamp fromDate = (Timestamp) context.get("fromDate");

GenericValue tempVal;
GenericValue tempVal = null;
try {
tempVal = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId)
@@ -249,7 +249,7 @@ private static String getCategoryFindEntityName(Delegator delegator, List<String
Debug.logError(e.getMessage(), module);
}

GenericValue productCategory;
GenericValue productCategory = null;
try {
productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryId).cache().queryOne();
} catch (GenericEntityException e) {
@@ -18,6 +18,7 @@
*******************************************************************************/
package org.apache.ofbiz.product.category;

import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
@@ -100,6 +101,7 @@ private SeoConfigUtil() {}
* Initialize url regular express configuration.
*/
public static void init() {
FileInputStream configFileIS = null;
String result = "success";
seoPatterns = new HashMap<String, Pattern>();
seoReplacements = new HashMap<String, String>();
@@ -320,6 +322,15 @@ public static void init() {
} catch (IOException e) {
result = "error";
Debug.logError(e, module);
} finally {
if (configFileIS != null) {
try {
configFileIS.close();
} catch (IOException e) {
result = "error";
Debug.logError(e, module);
}
}
}
if (seoReplacements.keySet().isEmpty()) {
useUrlRegexp = false;
@@ -79,9 +79,10 @@ public static ProductConfigWrapper getProductConfigWrapper(String productId, Str
} else {
configWrapper = new ProductConfigWrapper(configWrapper);
}
} catch (ProductConfigWrapperException we) {
configWrapper = null;
} catch (Exception e) {
Debug.logWarning(e.getMessage(), module);
configWrapper = null;
}
return configWrapper;
}
@@ -281,6 +281,7 @@ public static String updateProductAssoc(HttpServletRequest request, HttpServletR
productAssoc = EntityQuery.use(delegator).from(tempProductAssoc.getEntityName()).where(tempProductAssoc.getPrimaryKey()).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
productAssoc = null;
}
if (productAssoc == null) {
errMsg = UtilProperties.getMessage(resource,"productevents.could_not_remove_product_association_exist", UtilHttp.getLocale(request));
@@ -347,7 +348,8 @@ public static String updateProductAssoc(HttpServletRequest request, HttpServletR
request.setAttribute("ProductAssocCreateFromDate", fromDate);
}

GenericValue productAssoc;
GenericValue productAssoc = null;

try {
productAssoc = EntityQuery.use(delegator).from(tempProductAssoc.getEntityName()).where(tempProductAssoc.getPrimaryKey()).queryOne();
} catch (GenericEntityException e) {
@@ -517,7 +517,7 @@
UtilXml.addChildElementValue(dimensionsElement, "Length", UtilValidate.isNotEmpty(boxLength) ? ""+boxLength.intValue() : "", shipmentConfirmRequestDoc);
UtilXml.addChildElementValue(dimensionsElement, "Width", UtilValidate.isNotEmpty(boxWidth) ? ""+boxWidth.intValue() : "", shipmentConfirmRequestDoc);
UtilXml.addChildElementValue(dimensionsElement, "Height", UtilValidate.isNotEmpty(boxHeight) ? ""+boxHeight.intValue() : "", shipmentConfirmRequestDoc);
} else if (UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxLength"))
} else if (shipmentPackage != null && UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxLength"))
&& UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxWidth"))
&& UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxHeight"))) {
Element dimensionsElement = UtilXml.addChildElement(packageElement, "Dimensions", shipmentConfirmRequestDoc);
@@ -197,7 +197,9 @@ public static ScriptContext createScriptContext(Map<String, Object> context) {
localContext.put("context", context);
ScriptContext scriptContext = new SimpleScriptContext();
ScriptHelper helper = new ScriptHelperImpl(scriptContext);
localContext.put(SCRIPT_HELPER_KEY, helper);
if (helper != null) {
localContext.put(SCRIPT_HELPER_KEY, helper);
}
Bindings bindings = new SimpleBindings(localContext);
scriptContext.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
return scriptContext;
@@ -136,6 +136,7 @@ public static URL fromFilename(String filename) {
}
} catch (java.net.MalformedURLException e) {
Debug.logError(e, "unable to retrieve URL for file: " + filename, module);
url = null;
}
return url;
}

0 comments on commit a15b7b1

Please sign in to comment.
You can’t perform that action at this time.