[view] more adcs use
authorAsier Lostalé <asier.lostale@openbravo.com>
Thu, 02 Aug 2018 15:43:55 +0200
changeset 35060 ad90890155ff
parent 35059 87e2392210d2
child 35061 901a7335da1a
[view] more adcs use
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponent.java
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java	Thu Aug 02 15:06:31 2018 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java	Thu Aug 02 15:43:55 2018 +0200
@@ -34,6 +34,8 @@
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
 import org.openbravo.base.structure.BaseOBObject;
+import org.openbravo.base.weld.WeldUtils;
+import org.openbravo.client.application.window.ApplicationDictionaryCachedStructures;
 import org.openbravo.dal.core.DalUtil;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
@@ -64,6 +66,8 @@
       "org.openbravo.userinterface.smartclient", "org.openbravo.service.datasource",
       "org.openbravo.client.application", "org.openbravo.userinterface.selector" };
 
+  private ApplicationDictionaryCachedStructures adcs;
+
   public static synchronized KernelUtils getInstance() {
     if (instance == null) {
       instance = new KernelUtils();
@@ -71,6 +75,10 @@
     return instance;
   }
 
+  public KernelUtils() {
+    adcs = WeldUtils.getInstanceFromStaticBeanManager(ApplicationDictionaryCachedStructures.class);
+  }
+
   public static synchronized void setInstance(KernelUtils instance) {
     KernelUtils.instance = instance;
   }
@@ -397,7 +405,7 @@
       tabId = KernelUtilsData.getParentTab(connection, tab.getWindow().getId(), tab.getTabLevel()
           .toString(), tab.getSequenceNumber().toString());
       if (tabId != null) {
-        targetTab = OBDal.getInstance().get(Tab.class, tabId);
+        targetTab = adcs != null ? adcs.getTab(tabId) : OBDal.getInstance().get(Tab.class, tabId);
       }
     } catch (ServletException e) {
       log.error(e.getMessage(), e);
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponent.java	Thu Aug 02 15:06:31 2018 +0200
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponent.java	Thu Aug 02 15:43:55 2018 +0200
@@ -474,7 +474,7 @@
    * fields
    */
   private List<Field> getOutFieldListForSelectorField(String tabId, String selectorFieldId) {
-    Tab tab = OBDal.getInstance().get(Tab.class, tabId);
+    Tab tab = adcs.getTab(tabId);
     List<Field> tabFields = tab.getADFieldList();
     List<Field> result = new ArrayList<Field>();
     for (Field f : tabFields) {