Issue 13749: Reverted changes
authorIván Perdomo <ivan.perdomo@openbravo.com>
Thu, 15 Jul 2010 10:47:36 +0200
changeset 7885 7a5cf7dc9844
parent 7884 161d540df8db
child 7886 69209bdbdd0d
Issue 13749: Reverted changes
src-test/org/openbravo/test/dal/IssuesTest.java
src/org/openbravo/service/db/CallProcess.java
--- a/src-test/org/openbravo/test/dal/IssuesTest.java	Thu Jul 15 08:14:47 2010 +0530
+++ b/src-test/org/openbravo/test/dal/IssuesTest.java	Thu Jul 15 10:47:36 2010 +0200
@@ -24,10 +24,7 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.log4j.Logger;
 import org.dom4j.Document;
@@ -47,7 +44,6 @@
 import org.openbravo.model.ad.access.Role;
 import org.openbravo.model.ad.access.User;
 import org.openbravo.model.ad.module.Module;
-import org.openbravo.model.ad.process.ProcessInstance;
 import org.openbravo.model.ad.system.Client;
 import org.openbravo.model.ad.system.Language;
 import org.openbravo.model.ad.ui.Form;
@@ -58,7 +54,6 @@
 import org.openbravo.model.common.invoice.InvoiceLine;
 import org.openbravo.model.common.order.Order;
 import org.openbravo.model.common.plm.Product;
-import org.openbravo.service.db.CallProcess;
 import org.openbravo.service.db.CallStoredProcedure;
 import org.openbravo.test.base.BaseTest;
 
@@ -117,24 +112,6 @@
   private static final Logger log = Logger.getLogger(IssuesTest.class);
 
   /**
-   * https://issues.openbravo.com/view.php?id=13749
-   */
-  public void test13749() {
-    setBigBazaarAdminContext();
-    try {
-      org.openbravo.model.ad.ui.Process process = OBDal.getInstance().get(
-          org.openbravo.model.ad.ui.Process.class, "1004400000"); // Has a Date parameter
-      Map<String, Date> params = new HashMap<String, Date>();
-      params.put("DateOrdered", new Date());
-      ProcessInstance pi = CallProcess.getInstance().callProcess(process, null, params);
-      log.info("Result: " + pi.getResult());
-      log.info("Error message: " + pi.getErrorMsg());
-    } catch (Exception e) {
-      log.error("Error testing CallProcess: " + e.getMessage(), e);
-    }
-  }
-
-  /**
    * https://issues.openbravo.com/view.php?id=12918
    */
   public void test12918() {
--- a/src/org/openbravo/service/db/CallProcess.java	Thu Jul 15 08:14:47 2010 +0530
+++ b/src/org/openbravo/service/db/CallProcess.java	Thu Jul 15 10:47:36 2010 +0200
@@ -19,10 +19,8 @@
 
 package org.openbravo.service.db;
 
-import java.math.BigDecimal;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
-import java.util.Date;
 import java.util.Map;
 import java.util.Properties;
 
@@ -87,26 +85,6 @@
     return call(processCriteria.list().get(0), recordID, parameters);
   }
 
-/**
-   * Calls a process. The recordID and parameters can be null. Parameters are translated into
-   * {@link Parameter} instances.
-   * 
-   * @param process
-   *          the process to execute
-   * @param recordID
-   *          the recordID will be set in the {@link ProcessInstance}, see
-   *          {@link ProcessInstance#getRecordID()}
-   * @param parameters
-   *          are translated into process parameters, supports only string parameters, for support
-   *          of other parameters see the next method: {@link #callProcess(org.openbravo.model.ad.ui.Process, String, Map)
-   * @return the created instance with the result ({@link ProcessInstance#getResult()}) or error (
-   *         {@link ProcessInstance#getErrorMsg()})
-   */
-  public ProcessInstance call(org.openbravo.model.ad.ui.Process process, String recordID,
-      Map<String, String> parameters) {
-    return callProcess(process, recordID, (Map<String, ?>) parameters);
-  }
-
   /**
    * Calls a process. The recordID and parameters can be null. Parameters are translated into
    * {@link Parameter} instances.
@@ -121,8 +99,9 @@
    * @return the created instance with the result ({@link ProcessInstance#getResult()}) or error (
    *         {@link ProcessInstance#getErrorMsg()})
    */
-  public ProcessInstance callProcess(org.openbravo.model.ad.ui.Process process, String recordID,
-      Map<String, ?> parameters) {
+  public ProcessInstance call(org.openbravo.model.ad.ui.Process process, String recordID,
+      Map<String, String> parameters) {
+
     OBContext.setAdminMode();
     try {
       // Create the pInstance
@@ -145,17 +124,11 @@
         int index = 0;
         for (String key : parameters.keySet()) {
           index++;
-          final Object value = parameters.get(key);
+          final String value = parameters.get(key);
           final Parameter parameter = OBProvider.getInstance().get(Parameter.class);
           parameter.setSequenceNumber(index + "");
           parameter.setParameterName(key);
-          if (value instanceof String) {
-            parameter.setString((String) value);
-          } else if (value instanceof Date) {
-            parameter.setProcessDate((Date) value);
-          } else if (value instanceof BigDecimal) {
-            parameter.setProcessNumber((BigDecimal) value);
-          }
+          parameter.setString(value);
 
           // set both sides of the bidirectional association
           pInstance.getADParameterList().add(parameter);