You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2009/05/01 13:35:28 UTC

svn commit: r770642 - in /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting: ./ agreement/ finaccount/ invoice/ thirdparty/authorizedotnet/

Author: lektran
Date: Fri May  1 11:35:28 2009
New Revision: 770642

URL: http://svn.apache.org/viewvc?rev=770642&view=rev
Log:
revert r770618, something wrong with the generics

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/GlEvents.java
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/GlEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/GlEvents.java?rev=770642&r1=770641&r2=770642&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/GlEvents.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/GlEvents.java Fri May  1 11:35:28 2009
@@ -18,32 +18,35 @@
  *******************************************************************************/
 package org.ofbiz.accounting;
 
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import java.math.BigDecimal;
+import java.util.Map;
+import java.util.List;
+import java.util.Iterator;
+
 import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
-import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.webapp.event.EventHandlerException;
 
 public class GlEvents {
 
 public static final String module = GlEvents.class.getName();
-public static String createReconcileAccount(HttpServletRequest request, HttpServletResponse response) {
+public static String createReconcileAccount(HttpServletRequest request,HttpServletResponse response) {
     LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
     final GenericDelegator delegator = (GenericDelegator)request.getAttribute("delegator");
     GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
-    Map<String, Object> ctx = UtilHttp.getParameterMap(request);
+    Map ctx = UtilHttp.getParameterMap(request);
     String acctgTransId;
     String acctgTransEntrySeqId;
     String glAccountId = null;
@@ -64,16 +67,21 @@
         acctgTransEntrySeqId = (String) ctx.get("acctgTransEntrySeqId" + suffix);
         organizationPartyId = (String) ctx.get("organizationPartyId" + suffix);
         glAccountId = (String) ctx.get("glAccountId" + suffix);
+        GenericValue acctgTransEntry;
         try {
-            List<GenericValue> acctgTransEntries = delegator.findByAnd("AcctgTransEntry", UtilMisc.toMap("acctgTransId", acctgTransId, "acctgTransEntrySeqId", acctgTransEntrySeqId));
-                for (GenericValue acctgTransEntry : acctgTransEntries) {  //calculate amount for each AcctgTransEntry according to glAccountId based on debit and credit
-                    debitCreditFlag = acctgTransEntry.getString("debitCreditFlag");
+            List acctgTransEntries = delegator.findByAnd("AcctgTransEntry", UtilMisc.toMap("acctgTransId", acctgTransId, "acctgTransEntrySeqId", acctgTransEntrySeqId));
+            if (acctgTransEntries.size() > 0) {
+                Iterator acctgTransEntryItr = acctgTransEntries.iterator();
+                while (acctgTransEntryItr.hasNext()) {  //calculate amount for each AcctgTransEntry according to glAccountId based on debit and credit
+                    acctgTransEntry = (GenericValue) acctgTransEntryItr.next();
+                    debitCreditFlag = (String) acctgTransEntry.getString("debitCreditFlag");
                     if ("D".equalsIgnoreCase(debitCreditFlag)) {
                         amount = amount.add(acctgTransEntry.getBigDecimal("amount")); //for debit
                     } else {
-                        amount = amount.subtract(acctgTransEntry.getBigDecimal("amount")); //for credit
+                          amount = amount.subtract(acctgTransEntry.getBigDecimal("amount")); //for credit
                     }
                 }
+            }
             reconciledBalance = reconciledBalance.add(amount);  //total balance per glAccountId
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
@@ -81,8 +89,8 @@
         }
 
     }
-    Map<String, Object> fieldMap = UtilMisc.toMap("glReconciliationName", "Reconciliation at date " + UtilDateTime.nowTimestamp(), "glAccountId", glAccountId, "organizationPartyId", organizationPartyId, "reconciledDate", UtilDateTime.nowTimestamp(), "reconciledBalance", reconciledBalance, "userLogin", userLogin);
-    Map<String, Object> glReconResult = null;
+    Map fieldMap = UtilMisc.toMap("glReconciliationName", "Reconciliation at date " + UtilDateTime.nowTimestamp(), "glAccountId", glAccountId, "organizationPartyId", organizationPartyId, "reconciledDate", UtilDateTime.nowTimestamp(), "reconciledBalance", reconciledBalance, "userLogin", userLogin);
+    Map glReconResult = null;
     try {
         glReconResult = dispatcher.runSync("createGlReconciliation", fieldMap); //create GlReconciliation for the glAccountId
         if (ServiceUtil.isError(glReconResult)) {
@@ -102,22 +110,27 @@
         }
         acctgTransId = (String) ctx.get("acctgTransId" + suffix);
         acctgTransEntrySeqId = (String) ctx.get("acctgTransEntrySeqId" + suffix);
+        GenericValue acctgTransEntry;
         try {
-            List<GenericValue> acctgTransEntries = delegator.findByAnd("AcctgTransEntry", UtilMisc.toMap("acctgTransId", acctgTransId, "acctgTransEntrySeqId", acctgTransEntrySeqId));
-            for (GenericValue acctgTransEntry : acctgTransEntries) {
-                reconciledAmount = acctgTransEntry.getString("amount");
-                acctgTransId = acctgTransEntry.getString("acctgTransId");
-                acctgTransEntrySeqId = acctgTransEntry.getString("acctgTransEntrySeqId");
-                Map<String, Object> glReconEntryMap = UtilMisc.toMap("glReconciliationId", glReconciliationId, "acctgTransId", acctgTransId, "acctgTransEntrySeqId", acctgTransEntrySeqId, "reconciledAmount", reconciledAmount, "userLogin", userLogin);
-                Map<String, Object> glReconEntryResult = null;
-                try {
-                    glReconEntryResult = dispatcher.runSync("createGlReconciliationEntry", glReconEntryMap);
-                    if (ServiceUtil.isError(glReconEntryResult)) {
+            List acctgTransEntries = delegator.findByAnd("AcctgTransEntry", UtilMisc.toMap("acctgTransId", acctgTransId, "acctgTransEntrySeqId", acctgTransEntrySeqId));
+            if (acctgTransEntries.size() > 0) {
+                Iterator acctgTransEntryItr = acctgTransEntries.iterator();
+                while (acctgTransEntryItr.hasNext()) {
+                    acctgTransEntry = (GenericValue) acctgTransEntryItr.next();
+                    reconciledAmount = acctgTransEntry.getString("amount");
+                    acctgTransId = acctgTransEntry.getString("acctgTransId");
+                    acctgTransEntrySeqId = acctgTransEntry.getString("acctgTransEntrySeqId");
+                    Map glReconEntryMap = UtilMisc.toMap("glReconciliationId", glReconciliationId, "acctgTransId", acctgTransId, "acctgTransEntrySeqId", acctgTransEntrySeqId, "reconciledAmount", reconciledAmount, "userLogin", userLogin);
+                    Map glReconEntryResult = null;
+                    try {
+                        glReconEntryResult = dispatcher.runSync("createGlReconciliationEntry", glReconEntryMap);
+                        if (ServiceUtil.isError(glReconEntryResult)) {
+                            return "error";
+                        }
+                    } catch (GenericServiceException e) {
+                        Debug.logError(e, module);
                         return "error";
                     }
-                } catch (GenericServiceException e) {
-                    Debug.logError(e, module);
-                    return "error";
                 }
             }
         } catch (GenericEntityException e) {

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java?rev=770642&r1=770641&r2=770642&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java Fri May  1 11:35:28 2009
@@ -20,12 +20,11 @@
 package org.ofbiz.accounting.agreement;
 
 import java.math.BigDecimal;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-
 import javolution.util.FastList;
-
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilNumber;
@@ -76,11 +75,11 @@
      *              currencyUomId   String  Currency
      *              productId       String  Product Id
      */
-    public static Map<String, Object> getCommissionForProduct(DispatchContext ctx, Map<String, Object> context) {
+    public static Map getCommissionForProduct(DispatchContext ctx, Map context) {
         GenericDelegator delegator = ctx.getDelegator();
         Locale locale = (Locale) context.get("locale");
         String errMsg = null;
-        List<Map<String, Object>> commissions = FastList.newInstance();
+        List commissions = FastList.newInstance();
 
         try {
             BigDecimal amount = ((BigDecimal)context.get("amount"));
@@ -95,12 +94,12 @@
 
             // Collect agreementItems applicable to this orderItem/returnItem
             // TODO: partyIds should be part of this query!
-            List<GenericValue> agreementItems = delegator.findByAndCache("AgreementItemAndProductAppl", UtilMisc.toMap(
+            List agreementItems = delegator.findByAndCache("AgreementItemAndProductAppl", UtilMisc.toMap(
                     "productId", productId,
                     "agreementItemTypeId", "AGREEMENT_COMMISSION"));
             // Try the first available virtual product if this is a variant product
             if (agreementItems.size() == 0) {
-                List<GenericValue> productAssocs = delegator.findByAndCache("ProductAssoc", UtilMisc.toMap(
+                List productAssocs = delegator.findByAndCache("ProductAssoc", UtilMisc.toMap(
                         "productIdTo", productId,
                         "productAssocTypeId", "PRODUCT_VARIANT"));
                 productAssocs = EntityUtil.filterByDate(productAssocs);
@@ -114,8 +113,10 @@
             // this is not very efficient if there were many
             agreementItems = EntityUtil.filterByDate(agreementItems);
 
-            for (GenericValue agreementItem : agreementItems) {
-                List<GenericValue> terms = delegator.findByAndCache("AgreementTerm", UtilMisc.toMap(
+            Iterator it = agreementItems.iterator();
+            while (it.hasNext()) {
+                GenericValue agreementItem = (GenericValue) it.next();
+                List terms = delegator.findByAndCache("AgreementTerm", UtilMisc.toMap(
                         "agreementId", agreementItem.getString("agreementId"),
                         "agreementItemSeqId", agreementItem.getString("agreementItemSeqId"),
                         "invoiceItemTypeId", invoiceItemTypeId));
@@ -126,9 +127,11 @@
 
                     // number of days due for commission, which will be the lowest termDays of all the AgreementTerms
                     long days = -1;
-                    for (GenericValue term : terms) {
-                        String termTypeId = term.getString("termTypeId");
-                        BigDecimal termValue = term.getBigDecimal("termValue");
+                    Iterator itt = terms.iterator();
+                    while (itt.hasNext()) {
+                        GenericValue elem = (GenericValue) itt.next();
+                        String termTypeId = elem.getString("termTypeId");
+                        BigDecimal termValue = elem.getBigDecimal("termValue");
                         if (termValue != null) {
                             if (termTypeId.equals("FIN_COMM_FIXED")) {
                                 commission = commission.add(termValue.multiply(quantity));
@@ -144,7 +147,7 @@
                         }
 
                         // see if we need to update the number of days for paying commission
-                        Long termDays = term.getLong("termDays");
+                        Long termDays = elem.getLong("termDays");
                         if (termDays != null) {
                             // if days is greater than zero, then it has been set with another value, so we use the lowest term days
                             // if days is less than zero, then it has not been set yet.
@@ -162,7 +165,7 @@
                     commission = negative ? commission.negate() : commission;
                     commission = commission.setScale(decimals, rounding);
 
-                    Map<String, Object> partyCommissionResult = UtilMisc.toMap(
+                    Map partyCommissionResult = UtilMisc.toMap(
                             "partyIdFrom", agreementItem.getString("partyIdFrom"),
                             "partyIdTo", agreementItem.getString("partyIdTo"),
                             "commission", commission,
@@ -176,7 +179,7 @@
             }
         } catch (GenericEntityException e) {
             Debug.logWarning(e, module);
-            Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.getMessage());
+            Map messageMap = UtilMisc.toMap("errMessage", e.getMessage());
             errMsg = UtilProperties.getMessage("CommonUiLabels", "CommonDatabaseProblem", messageMap, locale);
             return ServiceUtil.returnError(errMsg);
         }

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?rev=770642&r1=770641&r2=770642&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java Fri May  1 11:35:28 2009
@@ -19,36 +19,33 @@
 
 package org.ofbiz.accounting.finaccount;
 
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.List;
-import java.util.Map;
-
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
-import org.ofbiz.accounting.payment.PaymentGatewayServices;
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.GeneralException;
-import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilProperties;
-import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.entity.GenericDelegator;
-import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityExpr;
 import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.condition.EntityConditionList;
 import org.ofbiz.entity.util.EntityFindOptions;
 import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.order.finaccount.FinAccountHelper;
+import org.ofbiz.base.util.*;
 import org.ofbiz.order.order.OrderReadHelper;
+import org.ofbiz.order.finaccount.FinAccountHelper;
+import org.ofbiz.accounting.payment.PaymentGatewayServices;
 import org.ofbiz.product.store.ProductStoreWorker;
-import org.ofbiz.service.DispatchContext;
-import org.ofbiz.service.GenericServiceException;
-import org.ofbiz.service.LocalDispatcher;
-import org.ofbiz.service.ServiceUtil;
+
+import java.util.Map;
+import java.util.List;
+import java.util.Set;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+
+import javolution.util.FastMap;
+import javolution.util.FastList;
 
 /**
  * FinAccountPaymentServices - Financial account used as payment method
@@ -57,8 +54,8 @@
 
     public static final String module = FinAccountPaymentServices.class.getName();
 
-    // base payment integration services
-    public static Map<String, Object> finAccountPreAuth(DispatchContext dctx, Map<String, Object> context) {
+    // base payment intergration services
+    public static Map finAccountPreAuth(DispatchContext dctx, Map context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
         GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -73,7 +70,7 @@
         // check for an existing auth trans and cancel it
         GenericValue authTrans = PaymentGatewayServices.getAuthTransaction(paymentPref);
         if (authTrans != null) {
-            Map<String, Object> input = UtilMisc.toMap("userLogin", userLogin, "finAccountAuthId", authTrans.get("referenceNum"));
+            Map input = UtilMisc.toMap("userLogin", userLogin, "finAccountAuthId", authTrans.get("referenceNum"));
             try {
                 dispatcher.runSync("expireFinAccountAuth", input);
             } catch (GenericServiceException e) {
@@ -126,7 +123,7 @@
 
         try {
             // fin the store requires a pin number; validate the PIN with the code
-            Map<String, Object> findProductStoreFinActSettingMap = UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", finAccountTypeId);
+            Map findProductStoreFinActSettingMap = UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", finAccountTypeId);
             GenericValue finAccountSettings = delegator.findByPrimaryKeyCache("ProductStoreFinActSetting", findProductStoreFinActSettingMap);
 
             if (finAccountSettings == null) {
@@ -147,7 +144,7 @@
                 // validate the PIN if the store requires it
                 if ("Y".equals(finAccountSettings.getString("requirePinCode"))) {
                     if (!FinAccountHelper.validatePin(delegator, finAccountCode, finAccountPin)) {
-                        Map<String, Object> result = ServiceUtil.returnSuccess();
+                        Map result = ServiceUtil.returnSuccess();
                         result.put("authMessage", "Financial account PIN/CODE combination not found");
                         result.put("authResult", Boolean.FALSE);
                         result.put("processAmount", amount);
@@ -162,7 +159,7 @@
 
             // check for expiration date
             if ((finAccount.getTimestamp("thruDate") != null) && (finAccount.getTimestamp("thruDate").before(UtilDateTime.nowTimestamp()))) {
-                Map<String, Object> result = ServiceUtil.returnSuccess();
+                Map result = ServiceUtil.returnSuccess();
                 result.put("authMessage", "Account has expired as of " + finAccount.getTimestamp("thruDate"));
                 result.put("authResult", Boolean.FALSE);
                 result.put("processAmount", amount);
@@ -180,7 +177,7 @@
                 statusId = finAccount.getString("statusId");
 
                 if ("FNACT_NEGPENDREPL".equals(statusId) || "FNACT_MANFROZEN".equals(statusId) || "FNACT_CANCELLED".equals(statusId)) {
-                    Map<String, Object> result = ServiceUtil.returnSuccess();
+                    Map result = ServiceUtil.returnSuccess();
                     if ("FNACT_NEGPENDREPL".equals(statusId)) {
                         result.put("authMessage", "Account is currently negative and pending replenishment");
                     } else if ("FNACT_MANFROZEN".equals(statusId)) {
@@ -211,7 +208,7 @@
             }
 
 
-            Map<String, Object> result = ServiceUtil.returnSuccess();
+            Map result = ServiceUtil.returnSuccess();
             String authMessage = null;
             Boolean processResult;
             String refNum;
@@ -231,14 +228,15 @@
                     thruDate = UtilDateTime.getDayEnd(UtilDateTime.nowTimestamp(), new Long(30)); // default 30 days for an auth
                 }
 
-                Map<String, Object> tmpResult = dispatcher.runSync("createFinAccountAuth", UtilMisc.<String, Object>toMap("finAccountId", finAccountId,
+                Map tmpResult = dispatcher.runSync("createFinAccountAuth", UtilMisc.<String, Object>toMap("finAccountId", finAccountId,
                         "amount", amount, "thruDate", thruDate, "userLogin", userLogin));
 
                 if (ServiceUtil.isError(tmpResult)) {
                     return tmpResult;
+                } else {
+                    refNum = (String) tmpResult.get("finAccountAuthId");
+                    processResult = Boolean.TRUE;
                 }
-                refNum = (String) tmpResult.get("finAccountAuthId");
-                processResult = Boolean.TRUE;
 
                 // refresh the account
                 finAccount.refresh();
@@ -268,7 +266,7 @@
         }
     }
 
-    public static Map<String, Object> finAccountReleaseAuth(DispatchContext dctx, Map<String, Object> context) {
+    public static Map finAccountReleaseAuth(DispatchContext dctx, Map context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericValue userLogin = (GenericValue) context.get("userLogin");
 
@@ -283,10 +281,10 @@
                 return ServiceUtil.returnError(err + " Could not find authorization transaction.");
             }
 
-            Map<String, Object> input = UtilMisc.toMap("userLogin", userLogin, "finAccountAuthId", authTransaction.get("referenceNum"));
-            Map<String, Object> serviceResults = dispatcher.runSync("expireFinAccountAuth", input);
+            Map input = UtilMisc.toMap("userLogin", userLogin, "finAccountAuthId", authTransaction.get("referenceNum"));
+            Map serviceResults = dispatcher.runSync("expireFinAccountAuth", input);
 
-            Map<String, Object> result = ServiceUtil.returnSuccess();
+            Map result = ServiceUtil.returnSuccess();
             result.put("releaseRefNum", authTransaction.getString("referenceNum"));
             result.put("releaseAmount", authTransaction.getBigDecimal("amount"));
             result.put("releaseResult", Boolean.TRUE);
@@ -303,7 +301,7 @@
         }
     }
 
-    public static Map<String, Object> finAccountCapture(DispatchContext dctx, Map<String, Object> context) {
+    public static Map finAccountCapture(DispatchContext dctx, Map context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
 
@@ -369,10 +367,10 @@
         }
 
         // BIG NOTE: make sure the expireFinAccountAuth and finAccountWithdraw services are done in the SAME TRANSACTION
-        //(i.e. no require-new-transaction in either of them AND no running async)
+        //(ie no require-new-transaction in either of them AND no running async)
 
         // cancel the authorization before doing the withdraw to avoid problems with way negative available amount on account; should happen in same transaction to avoid conflict problems
-        Map<String, Object> releaseResult;
+        Map releaseResult;
         try {
             releaseResult = dispatcher.runSync("expireFinAccountAuth", UtilMisc.<String, Object>toMap("userLogin", userLogin, "finAccountAuthId", finAccountAuthId));
         } catch (GenericServiceException e) {
@@ -384,7 +382,7 @@
         }
 
         // build the withdraw context
-        Map<String, Object> withdrawCtx = FastMap.newInstance();
+        Map withdrawCtx = FastMap.newInstance();
         withdrawCtx.put("finAccountId", finAccountId);
         withdrawCtx.put("productStoreId", productStoreId);
         withdrawCtx.put("currency", currency);
@@ -396,7 +394,7 @@
         withdrawCtx.put("userLogin", userLogin);
 
         // call the withdraw service
-        Map<String, Object> withdrawResp;
+        Map withdrawResp;
         try {
             withdrawResp = dispatcher.runSync("finAccountWithdraw", withdrawCtx);
         } catch (GenericServiceException e) {
@@ -408,7 +406,7 @@
         }
 
         // create the capture response
-        Map<String, Object> result = ServiceUtil.returnSuccess();
+        Map result = ServiceUtil.returnSuccess();
         Boolean processResult = (Boolean) withdrawResp.get("processResult");
         BigDecimal withdrawAmount = (BigDecimal) withdrawResp.get("amount");
         String referenceNum = (String) withdrawResp.get("referenceNum");
@@ -421,7 +419,7 @@
         return result;
     }
 
-    public static Map<String, Object> finAccountRefund(DispatchContext dctx, Map<String, Object> context) {
+    public static Map finAccountRefund(DispatchContext dctx, Map context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
 
@@ -456,7 +454,7 @@
         }
 
         // call the deposit service
-        Map<String, Object> depositCtx = FastMap.newInstance();
+        Map depositCtx = FastMap.newInstance();
         depositCtx.put("finAccountId", finAccountId);
         depositCtx.put("productStoreId", productStoreId);
         depositCtx.put("isRefund", Boolean.TRUE);
@@ -467,7 +465,7 @@
         depositCtx.put("reasonEnumId", "FATR_REFUND");
         depositCtx.put("userLogin", userLogin);
 
-        Map<String, Object> depositResp;
+        Map depositResp;
         try {
             depositResp = dispatcher.runSync("finAccountDeposit", depositCtx);
         } catch (GenericServiceException e) {
@@ -479,7 +477,7 @@
         }
 
         // create the refund response
-        Map<String, Object> result = ServiceUtil.returnSuccess();
+        Map result = ServiceUtil.returnSuccess();
         Boolean processResult = (Boolean) depositResp.get("processResult");
         BigDecimal depositAmount = (BigDecimal) depositResp.get("amount");
         String referenceNum = (String) depositResp.get("referenceNum");
@@ -493,7 +491,7 @@
     }
 
     // base account transaction services
-    public static Map<String, Object> finAccountWithdraw(DispatchContext dctx, Map<String, Object> context) {
+    public static Map finAccountWithdraw(DispatchContext dctx, Map context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
 
@@ -572,7 +570,7 @@
             balance = FinAccountHelper.ZERO;
         }
 
-        Map<String, Object> result = ServiceUtil.returnSuccess();
+        Map result = ServiceUtil.returnSuccess();
         result.put("previousBalance", previousBalance);
         result.put("balance", balance);
         result.put("amount", amount);
@@ -582,7 +580,7 @@
     }
 
     // base deposit service
-    public static Map<String, Object> finAccountDeposit(DispatchContext dctx, Map<String, Object> context) {
+    public static Map finAccountDeposit(DispatchContext dctx, Map context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
 
@@ -651,7 +649,7 @@
             if (actualBalance.compareTo(BigDecimal.ZERO) < 0) {
                 // balance went below zero, set negative pending replenishment status so that no more auths or captures will go through until it is replenished
                 try {
-                    Map<String, Object> rollbackCtx = UtilMisc.toMap("userLogin", userLogin, "finAccountId", finAccountId, "statusId", "FNACT_NEGPENDREPL");
+                    Map rollbackCtx = UtilMisc.toMap("userLogin", userLogin, "finAccountId", finAccountId, "statusId", "FNACT_NEGPENDREPL");
                     dispatcher.addRollbackService("updateFinAccount", rollbackCtx, true);
                 } catch (GenericServiceException e) {
                     Debug.logError(e, module);
@@ -660,7 +658,7 @@
             }
         }
 
-        Map<String, Object> result = ServiceUtil.returnSuccess();
+        Map result = ServiceUtil.returnSuccess();
         result.put("previousBalance", previousBalance);
         result.put("balance", actualBalance);
         result.put("amount", amount);
@@ -670,7 +668,7 @@
     }
 
     // auto-replenish service (deposit)
-    public static Map<String, Object> finAccountReplenish(DispatchContext dctx, Map<String, Object> context) {
+    public static Map finAccountReplenish(DispatchContext dctx, Map context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
 
@@ -716,7 +714,7 @@
 
         // get the product store settings
         GenericValue finAccountSettings;
-        Map<String, Object> psfasFindMap = UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", finAccount.getString("finAccountTypeId"));
+        Map psfasFindMap = UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", finAccount.getString("finAccountTypeId"));
         try {
             finAccountSettings = delegator.findByPrimaryKeyCache("ProductStoreFinActSetting", psfasFindMap);
         } catch (GenericEntityException e) {
@@ -755,7 +753,7 @@
         // configure rollback service to set status to Negative Pending Replenishment
         if ("FNACT_NEGPENDREPL".equals(statusId)) {
             try {
-                Map<String, Object> rollbackCtx = UtilMisc.toMap("userLogin", userLogin, "finAccountId", finAccountId, "statusId", "FNACT_NEGPENDREPL");
+                Map rollbackCtx = UtilMisc.toMap("userLogin", userLogin, "finAccountId", finAccountId, "statusId", "FNACT_NEGPENDREPL");
                 dispatcher.addRollbackService("updateFinAccount", rollbackCtx, true);
             } catch (GenericServiceException e) {
                 Debug.logError(e, module);
@@ -804,15 +802,15 @@
         }
 
         // hit the payment method for the amount to replenish
-        Map<String, Object> orderItemMap = UtilMisc.toMap("Auto-Replenishment FA #" + finAccountId, depositAmount);
-        Map<String, Object> replOrderCtx = FastMap.newInstance();
+        Map orderItemMap = UtilMisc.toMap("Auto-Replenishment FA #" + finAccountId, depositAmount);
+        Map replOrderCtx = FastMap.newInstance();
         replOrderCtx.put("productStoreId", productStoreId);
         replOrderCtx.put("paymentMethodId", paymentMethod.getString("paymentMethodId"));
         replOrderCtx.put("currency", currency);
         replOrderCtx.put("partyId", ownerPartyId);
         replOrderCtx.put("itemMap", orderItemMap);
         replOrderCtx.put("userLogin", userLogin);
-        Map<String, Object> replResp;
+        Map replResp;
         try {
             replResp = dispatcher.runSync("createSimpleNonProductSalesOrder", replOrderCtx);
         } catch (GenericServiceException e) {
@@ -825,7 +823,7 @@
         String orderId = (String) replResp.get("orderId");
 
         // create the deposit
-        Map<String, Object> depositCtx = FastMap.newInstance();
+        Map depositCtx = FastMap.newInstance();
         depositCtx.put("productStoreId", productStoreId);
         depositCtx.put("finAccountId", finAccountId);
         depositCtx.put("currency", currency);
@@ -836,7 +834,7 @@
         depositCtx.put("reasonEnumId", "FATR_REPLENISH");
         depositCtx.put("userLogin", userLogin);
         try {
-            Map<String, Object> depositResp = dispatcher.runSync("finAccountDeposit", depositCtx);
+            Map depositResp = dispatcher.runSync("finAccountDeposit", depositCtx);
             if (ServiceUtil.isError(depositResp)) {
                 return depositResp;
             }
@@ -848,7 +846,7 @@
         // say we are in good standing again
         if ("FNACT_NEGPENDREPL".equals(statusId)) {
             try {
-                Map<String, Object> ufaResp = dispatcher.runSync("updateFinAccount", UtilMisc.<String, Object>toMap("finAccountId", finAccountId, "statusId", "FNACT_ACTIVE", "userLogin", userLogin));
+                Map ufaResp = dispatcher.runSync("updateFinAccount", UtilMisc.<String, Object>toMap("finAccountId", finAccountId, "statusId", "FNACT_ACTIVE", "userLogin", userLogin));
                 if (ServiceUtil.isError(ufaResp)) {
                     return ufaResp;
                 }
@@ -866,13 +864,13 @@
         opts.setMaxRows(1);
         opts.setFetchSize(1);
 
-        List<EntityExpr> exprs = FastList.newInstance();
+        List exprs = FastList.newInstance();
         exprs.add(EntityCondition.makeCondition("finAccountTransTypeId", EntityOperator.EQUALS, "DEPOSIT"));
         exprs.add(EntityCondition.makeCondition("finAccountId", EntityOperator.EQUALS, finAccountId));
         exprs.add(EntityCondition.makeCondition("orderId", EntityOperator.NOT_EQUAL, null));
-        List<String> orderBy = UtilMisc.toList("-transactionDate");
+        List orderBy = UtilMisc.toList("-transactionDate");
 
-        List<GenericValue> transList = null;
+        List transList = null;
         try {
             transList = delegator.findList("FinAccountTrans", EntityCondition.makeCondition(exprs, EntityOperator.AND), null, orderBy, opts, false);
         } catch (GenericEntityException e) {
@@ -942,7 +940,7 @@
 
         // payment amount should always be positive; adjustments may
         // create the payment for the transaction
-        Map<String, Object> paymentCtx = UtilMisc.toMap("paymentTypeId", paymentType);
+        Map paymentCtx = UtilMisc.toMap("paymentTypeId", paymentType);
         paymentCtx.put("paymentMethodTypeId", paymentMethodType);
         paymentCtx.put("partyIdTo", partyIdTo);
         paymentCtx.put("partyIdFrom", partyIdFrom);
@@ -953,7 +951,7 @@
         paymentCtx.put("paymentRefNum", Long.toString(UtilDateTime.nowTimestamp().getTime()));
 
         String paymentId;
-        Map<String, Object> payResult;
+        Map payResult;
         try {
             payResult = dispatcher.runSync("createPayment", paymentCtx);
         } catch (GenericServiceException e) {
@@ -964,11 +962,12 @@
         }
         if (ServiceUtil.isError(payResult)) {
             throw new GeneralException(ServiceUtil.getErrorMessage(payResult));
+        } else {
+            paymentId = (String) payResult.get("paymentId");
         }
-        paymentId = (String) payResult.get("paymentId");
 
         // create the initial transaction
-        Map<String, Object> transCtx = UtilMisc.toMap("finAccountTransTypeId", txType);
+        Map transCtx = UtilMisc.toMap("finAccountTransTypeId", txType);
         transCtx.put("finAccountId", finAccountId);
         transCtx.put("partyId", partyId);
         transCtx.put("orderId", orderId);
@@ -978,7 +977,8 @@
         transCtx.put("userLogin", userLogin);
         transCtx.put("paymentId", paymentId);
 
-        Map<String, Object> transResult;
+        Map transResult;
+        String txId;
         try {
             transResult = dispatcher.runSync("createFinAccountTrans", transCtx);
         } catch (GenericServiceException e) {
@@ -989,8 +989,10 @@
         }
         if (ServiceUtil.isError(transResult)) {
             throw new GeneralException(ServiceUtil.getErrorMessage(transResult));
+        } else {
+            txId = (String) transResult.get("finAccountTransId");
         }
 
-        return (String) transResult.get("finAccountTransId");
+        return txId;
     }
 }

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java?rev=770642&r1=770641&r2=770642&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java Fri May  1 11:35:28 2009
@@ -44,7 +44,7 @@
 
     public static final String module = FinAccountProductServices.class.getName();
 
-    public static Map<String, Object> createPartyFinAccountFromPurchase(DispatchContext dctx, Map<String, Object> context) {
+    public static Map createPartyFinAccountFromPurchase(DispatchContext dctx, Map context) {
         // this service should always be called via FULFILLMENT_EXTASYNC
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
@@ -68,7 +68,7 @@
         String productId = orderItem.getString("productId");
         GenericValue featureAndAppl;
         try {
-            List<GenericValue> featureAndAppls = delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId,
+            List featureAndAppls = delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId,
                     "productFeatureTypeId", "TYPE", "productFeatureApplTypeId", "STANDARD_FEATURE"));
             featureAndAppls = EntityUtil.filterByDate(featureAndAppls);
             featureAndAppl = EntityUtil.getFirst(featureAndAppls);
@@ -129,11 +129,13 @@
         }
 
         // payment method info
-        List<GenericValue> payPrefs = orh.getPaymentPreferences();
+        List payPrefs = orh.getPaymentPreferences();
         String paymentMethodId = null;
         if (payPrefs != null) {
-            for (GenericValue pref : payPrefs) {
+            Iterator i = payPrefs.iterator();
+            while (i.hasNext()) {
                 // needs to be a CC or EFT account
+                GenericValue pref = (GenericValue) i.next();
                 String type = pref.getString("paymentMethodTypeId");
                 if ("CREDIT_CARD".equals(type) || "EFT_ACCOUNT".equals(type)) {
                     paymentMethodId = pref.getString("paymentMethodId");
@@ -162,14 +164,14 @@
         }
 
         // create the context for FSE
-        Map<String, Object> expContext = FastMap.newInstance();
+        Map expContext = FastMap.newInstance();
         expContext.put("orderHeader", orderHeader);
         expContext.put("orderItem", orderItem);
         expContext.put("party", party);
         expContext.put("person", person);
         expContext.put("partyGroup", partyGroup);
 
-        // expand the name field to dynamically add information
+        // expand the name field to dynamicly add information
         FlexibleStringExpander exp = FlexibleStringExpander.getInstance(finAccountName);
         finAccountName = exp.expandString(expContext);
 
@@ -179,7 +181,7 @@
         BigDecimal deposit = price.multiply(quantity).setScale(FinAccountHelper.decimals, FinAccountHelper.rounding);
 
         // create the financial account
-        Map<String, Object> createCtx = FastMap.newInstance();
+        Map createCtx = FastMap.newInstance();
         String finAccountId;
 
         createCtx.put("finAccountTypeId", finAccountTypeId);
@@ -196,7 +198,7 @@
             createCtx.put("replenishPaymentId", paymentMethodId);
         }
 
-        Map<String, Object> createResp;
+        Map createResp;
         try {
             createResp = dispatcher.runSync("createFinAccountForStore", createCtx);
         } catch (GenericServiceException e) {
@@ -206,18 +208,18 @@
         if (ServiceUtil.isError(createResp)) {
             Debug.logFatal(ServiceUtil.getErrorMessage(createResp), module);
             return createResp;
+        } else {
+            finAccountId = (String) createResp.get("finAccountId");
         }
-        
-        finAccountId = (String) createResp.get("finAccountId");
 
         // create the owner role
-        Map<String, Object> roleCtx = FastMap.newInstance();
+        Map roleCtx = FastMap.newInstance();
         roleCtx.put("partyId", partyId);
         roleCtx.put("roleTypeId", "OWNER");
         roleCtx.put("finAccountId", finAccountId);
         roleCtx.put("userLogin", userLogin);
         roleCtx.put("fromDate", UtilDateTime.nowTimestamp());
-        Map<String, Object> roleResp;
+        Map roleResp;
         try {
             roleResp = dispatcher.runSync("createFinAccountRole", roleCtx);
         } catch (GenericServiceException e) {
@@ -230,7 +232,7 @@
         }
 
         // create the initial deposit
-        Map<String, Object> depositCtx = FastMap.newInstance();
+        Map depositCtx = FastMap.newInstance();
         depositCtx.put("finAccountId", finAccountId);
         depositCtx.put("productStoreId", productStoreId);
         depositCtx.put("currency", currency);
@@ -241,7 +243,7 @@
         depositCtx.put("reasonEnumId", "FATR_IDEPOSIT");
         depositCtx.put("userLogin", userLogin);
 
-        Map<String, Object> depositResp;
+        Map depositResp;
         try {
             depositResp = dispatcher.runSync("finAccountDeposit", depositCtx);
         } catch (GenericServiceException e) {
@@ -253,7 +255,7 @@
             return depositResp;
         }
 
-        Map<String, Object> result = ServiceUtil.returnSuccess();
+        Map result = ServiceUtil.returnSuccess();
         result.put("finAccountId", finAccountId);
         return result;
     }

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java?rev=770642&r1=770641&r2=770642&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java Fri May  1 11:35:28 2009
@@ -24,34 +24,27 @@
 import java.util.List;
 import java.util.Map;
 
-import javolution.util.FastMap;
-
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.GeneralException;
-import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.*;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.condition.EntityConditionList;
 import org.ofbiz.entity.condition.EntityExpr;
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.util.EntityListIterator;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.order.finaccount.FinAccountHelper;
 import org.ofbiz.product.store.ProductStoreWorker;
-import org.ofbiz.service.DispatchContext;
-import org.ofbiz.service.GenericServiceException;
-import org.ofbiz.service.LocalDispatcher;
-import org.ofbiz.service.ModelService;
-import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.service.*;
+
+import javolution.util.FastMap;
 
 public class FinAccountServices {
 
     public static final String module = FinAccountServices.class.getName();
 
-    public static Map<String, Object> createAccountAndCredit(DispatchContext dctx, Map<String, Object> context) {
+    public static Map createAccountAndCredit(DispatchContext dctx, Map context) {
         GenericDelegator delegator = dctx.getDelegator();
         LocalDispatcher dispatcher = dctx.getDispatcher();
         String finAccountTypeId = (String) context.get("finAccountTypeId");
@@ -74,7 +67,7 @@
         try {
             // find the most recent (active) service credit account for the specified party
             String partyId = (String) context.get("partyId");
-            Map<String, Object> lookupMap = UtilMisc.toMap("finAccountTypeId", finAccountTypeId, "ownerPartyId", partyId);
+            Map lookupMap = UtilMisc.toMap("finAccountTypeId", finAccountTypeId, "ownerPartyId", partyId);
 
             // if a productStoreId is present, restrict the accounts returned using the store's payToPartyId
             String productStoreId = (String) context.get("productStoreId");
@@ -96,7 +89,7 @@
             if (finAccountId != null) {
                 creditAccount = delegator.findByPrimaryKey("FinAccount", UtilMisc.toMap("finAccountId", finAccountId));
             } else {
-                List<GenericValue> creditAccounts = delegator.findByAnd("FinAccount", lookupMap, UtilMisc.toList("-fromDate"));
+                List creditAccounts = delegator.findByAnd("FinAccount", lookupMap, UtilMisc.toList("-fromDate"));
                 creditAccount = EntityUtil.getFirst(EntityUtil.filterByDate(creditAccounts));
             }
 
@@ -108,13 +101,13 @@
                 }
                 // automatically set the parameters
                 ModelService createAccountService = dctx.getModelService(createAccountServiceName);
-                Map<String, Object> createAccountContext = createAccountService.makeValid(context, ModelService.IN_PARAM);
+                Map createAccountContext = createAccountService.makeValid(context, ModelService.IN_PARAM);
                 createAccountContext.put("finAccountTypeId", finAccountTypeId);
                 createAccountContext.put("finAccountName", accountName);
                 createAccountContext.put("ownerPartyId", partyId);
                 createAccountContext.put("userLogin", userLogin);
 
-                Map<String, Object> createAccountResult = dispatcher.runSync(createAccountServiceName, createAccountContext);
+                Map createAccountResult = dispatcher.runSync(createAccountServiceName, createAccountContext);
                 if (ServiceUtil.isError(createAccountResult) || ServiceUtil.isFailure(createAccountResult)) {
                     return createAccountResult;
                 }
@@ -125,13 +118,13 @@
                         creditAccount = delegator.findByPrimaryKey("FinAccount", UtilMisc.toMap("finAccountId", creditAccountId));
 
                         // create the owner role
-                        Map<String, Object> roleCtx = FastMap.newInstance();
+                        Map roleCtx = FastMap.newInstance();
                         roleCtx.put("partyId", partyId);
                         roleCtx.put("roleTypeId", "OWNER");
                         roleCtx.put("finAccountId", creditAccountId);
                         roleCtx.put("userLogin", userLogin);
                         roleCtx.put("fromDate", UtilDateTime.nowTimestamp());
-                        Map<String, Object> roleResp;
+                        Map roleResp;
                         try {
                             roleResp = dispatcher.runSync("createFinAccountRole", roleCtx);
                         } catch (GenericServiceException e) {
@@ -149,7 +142,7 @@
             }
 
             // create the credit transaction
-            Map<String, Object> transactionMap = FastMap.newInstance();
+            Map transactionMap = FastMap.newInstance();
             transactionMap.put("finAccountTransTypeId", "ADJUSTMENT");
             transactionMap.put("finAccountId", creditAccount.getString("finAccountId"));
             transactionMap.put("partyId", partyId);
@@ -158,7 +151,7 @@
             transactionMap.put("comments", context.get("comments"));
             transactionMap.put("userLogin", userLogin);
 
-            Map<String, Object> creditTransResult = dispatcher.runSync("createFinAccountTrans", transactionMap);
+            Map creditTransResult = dispatcher.runSync("createFinAccountTrans", transactionMap);
             if (ServiceUtil.isError(creditTransResult) || ServiceUtil.isFailure(creditTransResult)) {
                 return creditTransResult;
             }
@@ -168,12 +161,12 @@
             return ServiceUtil.returnError(gse.getMessage());
         }
 
-        Map<String, Object> result = ServiceUtil.returnSuccess();
+        Map result = ServiceUtil.returnSuccess();
         result.put("finAccountId", finAccountId);
         return result;
     }
 
-    public static Map<String, Object> createFinAccountForStore(DispatchContext dctx, Map<String, Object> context) {
+    public static Map createFinAccountForStore(DispatchContext dctx, Map context) {
         GenericDelegator delegator = dctx.getDelegator();
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -194,7 +187,7 @@
 
             // automatically set the parameters for the create fin account service
             ModelService createService = dctx.getModelService("createFinAccount");
-            Map<String, Object> inContext = createService.makeValid(context, ModelService.IN_PARAM);
+            Map inContext = createService.makeValid(context, ModelService.IN_PARAM);
             Timestamp now = UtilDateTime.nowTimestamp();
 
             // now use our values
@@ -216,15 +209,16 @@
             String payToPartyId = ProductStoreWorker.getProductStorePayToPartyId(productStoreId, delegator);
             inContext.put("organizationPartyId", payToPartyId);
 
-            Map<String, Object> createResult = dispatcher.runSync("createFinAccount", inContext);
+            Map createResult = dispatcher.runSync("createFinAccount", inContext);
 
             if (ServiceUtil.isError(createResult)) {
                 return createResult;
+            } else {
+                Map result = ServiceUtil.returnSuccess();
+                result.put("finAccountId", createResult.get("finAccountId"));
+                result.put("finAccountCode", finAccountCode);
+                return result;
             }
-            Map<String, Object> result = ServiceUtil.returnSuccess();
-            result.put("finAccountId", createResult.get("finAccountId"));
-            result.put("finAccountCode", finAccountCode);
-            return result;
         } catch (GenericEntityException ex) {
             return ServiceUtil.returnError(ex.getMessage());
         } catch (GenericServiceException ex) {
@@ -232,7 +226,7 @@
         }
     }
 
-    public static Map<String, Object> checkFinAccountBalance(DispatchContext dctx, Map<String, Object> context) {
+    public static Map checkFinAccountBalance(DispatchContext dctx, Map context) {
         GenericDelegator delegator = dctx.getDelegator();
         String finAccountId = (String) context.get("finAccountId");
         String finAccountCode = (String) context.get("finAccountCode");
@@ -270,14 +264,14 @@
         String statusId = finAccount.getString("statusId");
         Debug.log("FinAccount Balance [" + balance + "] Available [" + availableBalance + "] - Status: " + statusId, module);
 
-        Map<String, Object> result = ServiceUtil.returnSuccess();
+        Map result = ServiceUtil.returnSuccess();
         result.put("availableBalance", availableBalance);
         result.put("balance", balance);
         result.put("statusId", statusId);
         return result;
     }
 
-    public static Map<String, Object> checkFinAccountStatus(DispatchContext dctx, Map<String, Object> context) {
+    public static Map checkFinAccountStatus(DispatchContext dctx, Map context) {
         GenericDelegator delegator = dctx.getDelegator();
         String finAccountId = (String) context.get("finAccountId");
 
@@ -320,13 +314,13 @@
         return ServiceUtil.returnSuccess();
     }
 
-    public static Map<String, Object> refundFinAccount(DispatchContext dctx, Map<String, Object> context) {
+    public static Map refundFinAccount(DispatchContext dctx, Map context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
 
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         String finAccountId = (String) context.get("finAccountId");
-        Map<String, Object> result = null;
+        Map result = null;
 
         GenericValue finAccount;
         try {
@@ -355,7 +349,7 @@
                 BigDecimal remainingBalance = new BigDecimal(actualBalance.toString());
                 BigDecimal refundAmount = BigDecimal.ZERO;
 
-                List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("finAccountTransTypeId", EntityOperator.EQUALS, "DEPOSIT"),
+                List exprs = UtilMisc.toList(EntityCondition.makeCondition("finAccountTransTypeId", EntityOperator.EQUALS, "DEPOSIT"),
                         EntityCondition.makeCondition("finAccountId", EntityOperator.EQUALS, finAccountId));
                 EntityCondition condition = EntityCondition.makeCondition(exprs, EntityOperator.AND);
 
@@ -364,7 +358,7 @@
                     eli = delegator.find("FinAccountTrans", condition, null, null, UtilMisc.toList("-transactionDate"), null);
 
                     GenericValue trans;
-                    while (remainingBalance.compareTo(FinAccountHelper.ZERO) < 0 && (trans = eli.next()) != null) {
+                    while (remainingBalance.compareTo(FinAccountHelper.ZERO) == 1 && (trans = (GenericValue) eli.next()) != null) {
                         String orderId = trans.getString("orderId");
                         String orderItemSeqId = trans.getString("orderItemSeqId");
 
@@ -376,7 +370,7 @@
                             if (!"ITEM_CANCELLED".equals(orderItem.getString("statusId"))) {
 
                                 // make sure the item hasn't already been returned
-                                List<GenericValue> returnItems = orderItem.getRelated("ReturnItem");
+                                List returnItems = orderItem.getRelated("ReturnItem");
                                 if (returnItems == null || returnItems.size() == 0) {
                                     BigDecimal txAmt = trans.getBigDecimal("amount");
                                     BigDecimal refAmt = txAmt;
@@ -387,15 +381,15 @@
                                     refundAmount = refundAmount.add(refAmt);
 
                                     // create the return header
-                                    Map<String, Object> rhCtx = UtilMisc.toMap("returnHeaderTypeId", "CUSTOMER_RETURN", "fromPartyId", finAccount.getString("ownerPartyId"), "toPartyId", productStore.getString("payToPartyId"), "userLogin", userLogin);
-                                    Map<String, Object> rhResp = dispatcher.runSync("createReturnHeader", rhCtx);
+                                    Map rhCtx = UtilMisc.toMap("returnHeaderTypeId", "CUSTOMER_RETURN", "fromPartyId", finAccount.getString("ownerPartyId"), "toPartyId", productStore.getString("payToPartyId"), "userLogin", userLogin);
+                                    Map rhResp = dispatcher.runSync("createReturnHeader", rhCtx);
                                     if (ServiceUtil.isError(rhResp)) {
                                         throw new GeneralException(ServiceUtil.getErrorMessage(rhResp));
                                     }
                                     String returnId = (String) rhResp.get("returnId");
 
                                     // create the return item
-                                    Map<String, Object> returnItemCtx = FastMap.newInstance();
+                                    Map returnItemCtx = FastMap.newInstance();
                                     returnItemCtx.put("returnId", returnId);
                                     returnItemCtx.put("orderId", orderId);
                                     returnItemCtx.put("description", orderItem.getString("itemDescription"));
@@ -408,22 +402,22 @@
                                     returnItemCtx.put("returnItemTypeId", "RET_NPROD_ITEM");
                                     returnItemCtx.put("userLogin", userLogin);
 
-                                    Map<String, Object> retItResp = dispatcher.runSync("createReturnItem", returnItemCtx);
+                                    Map retItResp = dispatcher.runSync("createReturnItem", returnItemCtx);
                                     if (ServiceUtil.isError(retItResp)) {
                                         throw new GeneralException(ServiceUtil.getErrorMessage(retItResp));
                                     }
                                     String returnItemSeqId = (String) retItResp.get("returnItemSeqId");
 
                                     // approve the return
-                                    Map<String, Object> appRet = UtilMisc.toMap("statusId", "RETURN_ACCEPTED", "returnId", returnId, "userLogin", userLogin);
-                                    Map<String, Object> appResp = dispatcher.runSync("updateReturnHeader", appRet);
+                                    Map appRet = UtilMisc.toMap("statusId", "RETURN_ACCEPTED", "returnId", returnId, "userLogin", userLogin);
+                                    Map appResp = dispatcher.runSync("updateReturnHeader", appRet);
                                     if (ServiceUtil.isError(appResp)) {
                                         throw new GeneralException(ServiceUtil.getErrorMessage(appResp));
                                     }
 
                                     // "receive" the return - should trigger the refund
-                                    Map<String, Object> recRet = UtilMisc.toMap("statusId", "RETURN_RECEIVED", "returnId", returnId, "userLogin", userLogin);
-                                    Map<String, Object> recResp = dispatcher.runSync("updateReturnHeader", recRet);
+                                    Map recRet = UtilMisc.toMap("statusId", "RETURN_RECEIVED", "returnId", returnId, "userLogin", userLogin);
+                                    Map recResp = dispatcher.runSync("updateReturnHeader", recRet);
                                     if (ServiceUtil.isError(recResp)) {
                                         throw new GeneralException(ServiceUtil.getErrorMessage(recResp));
                                     }
@@ -438,7 +432,7 @@
                                     String paymentId = response.getString("paymentId");
 
                                     // create the adjustment transaction
-                                    Map<String, Object> txCtx = FastMap.newInstance();
+                                    Map txCtx = FastMap.newInstance();
                                     txCtx.put("finAccountTransTypeId", "ADJUSTMENT");
                                     txCtx.put("finAccountId", finAccountId);
                                     txCtx.put("orderId", orderId);
@@ -448,7 +442,7 @@
                                     txCtx.put("partyId", finAccount.getString("ownerPartyId"));
                                     txCtx.put("userLogin", userLogin);
 
-                                    Map<String, Object> txResp = dispatcher.runSync("createFinAccountTrans", txCtx);
+                                    Map txResp = dispatcher.runSync("createFinAccountTrans", txCtx);
                                     if (ServiceUtil.isError(txResp)) {
                                         throw new GeneralException(ServiceUtil.getErrorMessage(txResp));
                                     }

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=770642&r1=770641&r2=770642&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Fri May  1 11:35:28 2009
@@ -435,7 +435,7 @@
                     Map createInvoiceItemContext = FastMap.newInstance();
                     createInvoiceItemContext.put("invoiceId", invoiceId);
                     createInvoiceItemContext.put("invoiceItemSeqId", invoiceItemSeqId);
-                    createInvoiceItemContext.put("invoiceItemTypeId", getInvoiceItemType(delegator, (orderItem.getString("orderItemTypeId")), (product == null ? null : product.getString("productTypeId")), invoiceType, "INV_FPROD_ITEM"));
+                    createInvoiceItemContext.put("invoiceItemTypeId", getInvoiceItemType(delegator, (orderItem == null ? null : orderItem.getString("orderItemTypeId")), (product == null ? null : product.getString("productTypeId")), invoiceType, "INV_FPROD_ITEM"));
                     createInvoiceItemContext.put("description", orderItem.get("itemDescription"));
                     createInvoiceItemContext.put("quantity", billingQuantity);
                     createInvoiceItemContext.put("amount", billingAmount);

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java?rev=770642&r1=770641&r2=770642&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java Fri May  1 11:35:28 2009
@@ -287,7 +287,7 @@
 
     public static GenericValue getInvoiceAddressByType(GenericValue invoice, String contactMechPurposeTypeId) {
         GenericDelegator delegator = invoice.getDelegator();
-        List<GenericValue> locations = null;
+        List locations = null;
         // first try InvoiceContactMech to see if we can find the address needed
         try {
             locations = invoice.getRelated("InvoiceContactMech", UtilMisc.toMap("contactMechPurposeTypeId", contactMechPurposeTypeId), null);
@@ -324,12 +324,12 @@
         GenericValue contactMech = null;
         if (UtilValidate.isNotEmpty(locations)) {
             try {
-                contactMech = locations.get(0).getRelatedOne("ContactMech");
+                contactMech = ((GenericValue) locations.get(0)).getRelatedOne("ContactMech");
             } catch (GenericEntityException e) {
-                Debug.logError(e, "Trouble getting Contact for contactMechId: " + locations.get(0).getString("contactMechId"), module);
+                Debug.logError(e, "Trouble getting Contact for contactMechId: " + contactMech.getString("contactMechId"), module);
             }
 
-            if (contactMech != null && contactMech.getString("contactMechTypeId").equals("POSTAL_ADDRESS"))    {
+            if (contactMech.getString("contactMechTypeId").equals("POSTAL_ADDRESS"))    {
                 try {
                     postalAddress = contactMech.getRelatedOne("PostalAddress");
                     return postalAddress;
@@ -532,9 +532,9 @@
                 party  = delegator.findByPrimaryKey("PartyAcctgPreference", UtilMisc.toMap("partyId", invoice.getString("partyId")));
             }
             if (UtilValidate.isNotEmpty(party) && party.getString("baseCurrencyUomId") != null) {
-                otherCurrencyUomId = party.getString("baseCurrencyUomId");
+                otherCurrencyUomId = new String(party.getString("baseCurrencyUomId"));
             } else {
-                otherCurrencyUomId = UtilProperties.getPropertyValue("general", "currency.uom.id.default");
+                otherCurrencyUomId = new String(UtilProperties.getPropertyValue("general", "currency.uom.id.default"));
             }
             if (otherCurrencyUomId == null) {
                 otherCurrencyUomId = "USD"; // final default

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java?rev=770642&r1=770641&r2=770642&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java Fri May  1 11:35:28 2009
@@ -24,7 +24,7 @@
 public class AuthorizeResponse {
 
     private String rawResp = null;
-    private List<String> response = new ArrayList<String>();
+    private List response = new ArrayList();
     private String respCode = "";
     private String reasonCode = "";
     private String reasonText = "";
@@ -93,7 +93,7 @@
     }
 
     private void setApproval() {
-        String rc = response.get(RESPONSE_CODE);
+        String rc = (String)response.get(RESPONSE_CODE);
 
         if (rc.equals("1")) {
             this.respCode = APPROVED;
@@ -107,8 +107,8 @@
             this.respCode = ERROR;
         }
 
-        this.reasonCode = response.get(RESPONSE_REASON_CODE);
-        this.reasonText = response.get(RESPONSE_REASON_TEXT);
+        this.reasonCode = (String)response.get(RESPONSE_REASON_CODE);
+        this.reasonText = (String)response.get(RESPONSE_REASON_TEXT);
 
     }
 
@@ -144,16 +144,18 @@
         if (posNum < 1 || posNum > maxPos) {
             return "unknown_field";
         }
-        return response.get(posNum);
+        else {
+            return (String)response.get(posNum);
+        }
     }
 
     public String getRawResponse() {
         return this.rawResp;
     }
 
-    private List<String> splitResp(String r, String delim) {
+    private List splitResp(String r, String delim) {
         int s1=0, s2=-1;
-        List<String> out = new ArrayList<String>(40);
+        List out = new ArrayList(40);
         out.add("empty");
         while (true) {
             s2 = r.indexOf(delim, s1);
@@ -173,7 +175,6 @@
         return out;
     }
 
-    @Override
     public String toString() {
         return response.toString();
     }