details:   https://code.openbravo.com/erp/devel/pi/rev/927ab17c2352
changeset: 19429:927ab17c2352
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Thu Jan 24 16:25:59 2013 +0100
summary:   fixed issue 22886: StaticResources application dependencies

Now it is possible to declare dependencies among applications

diffstat:

 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/BaseComponentProvider.java
 |  24 +++++++++-
 1 files changed, 22 insertions(+), 2 deletions(-)

diffs (63 lines):

diff -r 339f82efc76c -r 927ab17c2352 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/BaseComponentProvider.java
--- 
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/BaseComponentProvider.java
    Thu Jan 24 12:53:13 2013 +0100
+++ 
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/BaseComponentProvider.java
    Thu Jan 24 16:25:59 2013 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2009-2012 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -21,7 +21,9 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.enterprise.inject.Any;
 import javax.enterprise.inject.Instance;
@@ -39,6 +41,8 @@
 
   private Module module;
 
+  private static Map<String, List<String>> appDependencies = new 
HashMap<String, List<String>>();
+
   @Inject
   @Any
   private Instance<Component> components;
@@ -62,6 +66,10 @@
     return module;
   }
 
+  public static void setAppDependencies(String app, List<String> dependencies) 
{
+    appDependencies.put(app, dependencies);
+  }
+
   /**
    * Computes parameters to add to a link of a resource. The parameters 
include the version and
    * language of the user.
@@ -284,7 +292,19 @@
     }
 
     public boolean isValidForApp(String app) {
-      return this.validForAppList.contains(app);
+      boolean valid = this.validForAppList.contains(app);
+      if (valid) {
+        return true;
+      }
+      if (appDependencies.containsKey(app)) {
+        for (String dep : appDependencies.get(app)) {
+          valid = isValidForApp(dep);
+          if (valid) {
+            return true;
+          }
+        }
+      }
+      return false;
     }
 
   }

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to