details:   /erp/devel/pi/rev/f55f3f6f2385
changeset: 12439:f55f3f6f2385
user:      Iván Perdomo <ivan.perdomo <at> openbravo.com>
date:      Wed May 25 18:27:45 2011 +0200
summary:   Backout rev 4ca58960e91f

diffstat:

 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java
 |  68 +++------
 1 files changed, 26 insertions(+), 42 deletions(-)

diffs (118 lines):

diff -r ba368757d420 -r f55f3f6f2385 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java
--- 
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java
      Wed May 25 18:06:38 2011 +0200
+++ 
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java
      Wed May 25 18:27:45 2011 +0200
@@ -4,14 +4,14 @@
  * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
  * Version 1.1  with a permitted attribution clause; you may not  use this
  * file except in compliance with the License. You  may  obtain  a copy of
- * the License at http://www.openbravo.com/legal/license.html
+ * the License at http://www.openbravo.com/legal/license.html 
  * Software distributed under the License  is  distributed  on  an "AS IS"
  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  * License for the specific  language  governing  rights  and  limitations
- * under the License.
- * The Original Code is Openbravo ERP.
- * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2011 Openbravo SLU
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SLU 
+ * All portions are Copyright (C) 2010 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -19,7 +19,6 @@
 package org.openbravo.client.kernel;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -55,7 +54,7 @@
 
   // the static dependency list is used when a cycle is detected
   // in the modules
-  private static final String[] STATICDEPENDENCYLIST = new String[] { 
"org.openbravo",
+  private static String[] STATICDEPENDENCYLIST = new String[] { 
"org.openbravo",
       "org.openbravo.base.weld", "org.openbravo.service.json", 
"org.openbravo.client.kernel",
       "org.openbravo.userinterface.smartclient", 
"org.openbravo.service.datasource",
       "org.openbravo.client.application", 
"org.openbravo.userinterface.selector" };
@@ -201,13 +200,7 @@
       final OBCriteria<Module> modules = 
OBDal.getInstance().createCriteria(Module.class);
       modules.setFetchMode(Module.PROPERTY_MODULEDEPENDENCYLIST, 
FetchMode.JOIN);
       final List<Module> handledModules = new ArrayList<Module>();
-
       try {
-        // Core has a non declared dependency on client.kernel, 
client.application
-        // Build the known dependency list and then check the rest of modules
-        // https://issues.openbravo.com/view.php?id=17249
-        buildKnownDependencies(modules, moduleLowLevelCodes, handledModules);
-
         for (Module module : modules.list()) {
           if (handledModules.contains(module)) {
             continue;
@@ -220,9 +213,27 @@
         }
       } catch (ModuleDependencyCycleException e) {
         // use static list...
-        buildKnownDependencies(modules, moduleLowLevelCodes, handledModules);
+        moduleLowLevelCodes.clear();
+        handledModules.clear();
+        for (Module module : modules.list()) {
+          if (handledModules.contains(module)) {
+            continue;
+          }
+          handledModules.add(module);
+          final ModuleWithLowLevelCode moduleLowLevelCode = new 
ModuleWithLowLevelCode();
+          moduleLowLevelCode.setModule(module);
+          int index = 0;
+          for (String pkg : STATICDEPENDENCYLIST) {
+            if (pkg.equals(module.getJavaPackage())) {
+              break;
+            }
+
+            index++;
+          }
+          moduleLowLevelCode.setLowLevelCode(index);
+          moduleLowLevelCodes.add(moduleLowLevelCode);
+        }
       }
-
       Collections.sort(moduleLowLevelCodes);
       final List<Module> result = new ArrayList<Module>();
       for (ModuleWithLowLevelCode moduleLowLevelCode : moduleLowLevelCodes) {
@@ -235,33 +246,6 @@
     }
   }
 
-  private void buildKnownDependencies(OBCriteria<Module> modules,
-      List<ModuleWithLowLevelCode> moduleLowLevelCodes, List<Module> 
handledModules) {
-    final List<String> knownDependencies = Arrays.asList(STATICDEPENDENCYLIST);
-
-    moduleLowLevelCodes.clear();
-    handledModules.clear();
-
-    for (Module module : modules.list()) {
-      if (handledModules.contains(module) || 
!knownDependencies.contains(module.getJavaPackage())) {
-        continue;
-      }
-      handledModules.add(module);
-      final ModuleWithLowLevelCode moduleLowLevelCode = new 
ModuleWithLowLevelCode();
-      moduleLowLevelCode.setModule(module);
-      int index = 0;
-      for (String pkg : STATICDEPENDENCYLIST) {
-        if (pkg.equals(module.getJavaPackage())) {
-          break;
-        }
-
-        index++;
-      }
-      moduleLowLevelCode.setLowLevelCode(index);
-      moduleLowLevelCodes.add(moduleLowLevelCode);
-    }
-  }
-
   private int computeLowLevelCode(Module module, List<Module> modules) {
     if (module.getId().equals("0")) {
       return 0;

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to