You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2006/08/20 12:32:19 UTC
svn commit: r432961 - in /incubator/ofbiz/trunk:
applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
framework/service/src/org/ofbiz/service/ServiceUtil.java
Author: jacopoc
Date: Sun Aug 20 03:32:17 2006
New Revision: 432961
URL: http://svn.apache.org/viewvc?rev=432961&view=rev
Log:
Moved addErrors private method from CheckOutHelper to ServiceUtil (as public static).
Modified:
incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java
Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=432961&r1=432960&r2=432961&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Sun Aug 20 03:32:17 2006
@@ -439,7 +439,7 @@
errorMessages.add(e.getMessage());
}
if (gcResult != null) {
- this.addErrors(errorMessages, errorMaps, gcResult);
+ ServiceUtil.addErrors(errorMessages, errorMaps, gcResult);
if (errorMessages.size() == 0 && errorMaps.size() == 0) {
// set the GC payment method
@@ -1356,9 +1356,7 @@
* This is a convenience method, primarily to match the original
* code structure of the adapter class <code>CheckOutEvents</code>.
* <p>
- * I would prefer to remove this altogether and move the method
- * {@link #addErrors(List, Map, Map) addErrors} to the utility
- * class {@link ServiceUtil ServiceUtil}
+ * I would prefer to remove this altogether.
*
* @see CheckOutHelper#finalizeOrderEntryOptions(String, String, String, String, String, String, String, String)
* @see CheckOutHelper#finalizeOrderEntryPayment(String, Double, boolean, boolean)
@@ -1377,13 +1375,13 @@
// set the shipping method
if (finalizeMode != null && finalizeMode.equals("ship")) {
callResult = this.finalizeOrderEntryShip(shipGroupIndex, shippingContactMechId);
- this.addErrors(errorMessages, errorMaps, callResult);
+ ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
}
// set the options
if (finalizeMode != null && finalizeMode.equals("options")) {
callResult = this.finalizeOrderEntryOptions(shipGroupIndex, shippingMethod, shippingInstructions, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate);
- this.addErrors(errorMessages, errorMaps, callResult);
+ ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
}
// set the payment
@@ -1391,16 +1389,16 @@
Map selectedPaymentMethods = null;
if (checkOutPaymentId != null) {
callResult = this.finalizeOrderEntryPayment(checkOutPaymentId, null, isSingleUsePayment, appendPayment);
- this.addErrors(errorMessages, errorMaps, callResult);
+ ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
selectedPaymentMethods = UtilMisc.toMap(checkOutPaymentId, null);
}
callResult = checkGiftCard(params, selectedPaymentMethods);
- this.addErrors(errorMessages, errorMaps, callResult);
+ ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
if (errorMessages.size() == 0 && errorMaps.size() == 0) {
String gcPaymentMethodId = (String) callResult.get("paymentMethodId");
Double giftCardAmount = (Double) callResult.get("amount");
Map gcCallRes = this.finalizeOrderEntryPayment(gcPaymentMethodId, giftCardAmount, true, true);
- this.addErrors(errorMessages, errorMaps, gcCallRes);
+ ServiceUtil.addErrors(errorMessages, errorMaps, gcCallRes);
}
}
@@ -1415,40 +1413,6 @@
}
return result;
- }
-
- /**
- * Takes the result of an invocation and extracts any error messages
- * and adds them to the targetList. This will handle both List and String
- * error messags.
- *
- * @param targetList The List to add the error messages to
- * @param targetMap The Map to add any Map error messages to
- * @param callResult The result from an invocation
- */
- private void addErrors(List targetList, Map targetMap, Map callResult) {
- List newList;
- //Map.Entry entry;
- //Iterator mapIter;
- Map errorMsgMap;
- //StringBuffer outMsg;
-
- //See if there is a single message
- if (callResult.containsKey(ModelService.ERROR_MESSAGE)) {
- targetList.add(callResult.get(ModelService.ERROR_MESSAGE));
- }
-
- //See if there is a message list
- if (callResult.containsKey(ModelService.ERROR_MESSAGE_LIST)) {
- newList = (List) callResult.get(ModelService.ERROR_MESSAGE_LIST);
- targetList.addAll(newList);
- }
-
- //See if there are an error message map
- if (callResult.containsKey(ModelService.ERROR_MESSAGE_MAP)) {
- errorMsgMap = (Map) callResult.get(ModelService.ERROR_MESSAGE_MAP);
- targetMap.putAll(errorMsgMap);
- }
}
public double availableAccountBalance(String billingAccountId) {
Modified: incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=432961&r1=432960&r2=432961&view=diff
==============================================================================
--- incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java (original)
+++ incubator/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java Sun Aug 20 03:32:17 2006
@@ -324,6 +324,37 @@
return outMsg.toString();
}
+ /**
+ * Takes the result of an invocation and extracts any error messages
+ * and adds them to the targetList or targetMap. This will handle both List and String
+ * error messags.
+ *
+ * @param targetList The List to add the error messages to
+ * @param targetMap The Map to add any Map error messages to
+ * @param callResult The result from an invocation
+ */
+ public static void addErrors(List targetList, Map targetMap, Map callResult) {
+ List newList;
+ Map errorMsgMap;
+
+ //See if there is a single message
+ if (callResult.containsKey(ModelService.ERROR_MESSAGE)) {
+ targetList.add(callResult.get(ModelService.ERROR_MESSAGE));
+ }
+
+ //See if there is a message list
+ if (callResult.containsKey(ModelService.ERROR_MESSAGE_LIST)) {
+ newList = (List) callResult.get(ModelService.ERROR_MESSAGE_LIST);
+ targetList.addAll(newList);
+ }
+
+ //See if there are an error message map
+ if (callResult.containsKey(ModelService.ERROR_MESSAGE_MAP)) {
+ errorMsgMap = (Map) callResult.get(ModelService.ERROR_MESSAGE_MAP);
+ targetMap.putAll(errorMsgMap);
+ }
+ }
+
public static Map purgeOldJobs(DispatchContext dctx, Map context) {
String sendPool = ServiceConfigUtil.getSendPool();
int daysToKeep = ServiceConfigUtil.getPurgeJobDays();