fixes issue 30459: can execute modulescripts twice or more on install.source
authorCarlos Aristu <carlos.aristu@openbravo.com>
Thu, 30 Jul 2015 11:07:20 +0200
changeset 27155 142f0dbc4bc3
parent 27154 d10e8d819216
child 27156 5bdafea397d7
child 27264 e7cd2448512c
fixes issue 30459: can execute modulescripts twice or more on install.source

It was not possible to configure modulescripts to be executed more than once during install.source of different versions. Now we send an empty hash map during install.source to the ModuleScriptHandler. This way we identify that we are executing the install.source task. Thus, in this case we will execute the modulescript depending on the value returned by its executeOnInstall() method
src-core/src/org/openbravo/modulescript/ModuleScript.java
src-db/database/lib/dbsourcemanager.jar
--- a/src-core/src/org/openbravo/modulescript/ModuleScript.java	Thu Jul 30 10:50:41 2015 +0200
+++ b/src-core/src/org/openbravo/modulescript/ModuleScript.java	Thu Jul 30 11:07:20 2015 +0200
@@ -54,9 +54,16 @@
    *          A data structure that contains module versions mapped by module id
    */
   public final void preExecute(Map<String, OpenbravoVersion> modulesVersionMap) {
+    if (modulesVersionMap == null || modulesVersionMap.size() == 0) {
+      // if we do not have module versions to compare with (install.source) then execute depending
+      // on the value of the executeOnInstall() method
+      if (executeOnInstall()) {
+        doExecute();
+      }
+      return;
+    }
     ModuleScriptExecutionLimits executionLimits = getModuleScriptExecutionLimits();
-    if (executionLimits == null || executionLimits.getModuleId() == null
-        || modulesVersionMap == null || modulesVersionMap.size() == 0) {
+    if (executionLimits == null || executionLimits.getModuleId() == null) {
       doExecute();
       return;
     }
Binary file src-db/database/lib/dbsourcemanager.jar has changed