[view] audited tables eTag cannot be calculated from cache
authorAsier Lostalé <asier.lostale@openbravo.com>
Tue, 07 Aug 2018 08:44:00 +0200
changeset 35073 6b0da887fc26
parent 35072 a244cd3d71a7
child 35074 9e0c546f3a14
[view] audited tables eTag cannot be calculated from cache
modules/org.openbravo.client.application/src/org/openbravo/client/application/ViewComponent.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ViewComponent.java	Tue Aug 07 08:43:26 2018 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ViewComponent.java	Tue Aug 07 08:44:00 2018 +0200
@@ -18,6 +18,7 @@
  */
 package org.openbravo.client.application;
 
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
@@ -308,11 +309,9 @@
       }
 
       StringBuilder viewVersions = new StringBuilder();
-      for (Tab t : window.getADTabList()) {
-        viewVersions.append(t.getTable().isFullyAudited()).append("|");
-      }
-      viewVersions.append(getLastGridConfigurationChange(window)).append("|");
-      viewVersions.append(getLastSystemPreferenceChange(window)).append("|");
+      viewVersions.append(getAuditStatus(window)) //
+          .append(getLastGridConfigurationChange(window)).append("|") //
+          .append(getLastSystemPreferenceChange(window));
       return DigestUtils.md5Hex(viewVersions.toString());
     } finally {
       OBContext.restorePreviousMode();
@@ -368,4 +367,15 @@
 
     return lastUpdated;
   }
+
+  private String getAuditStatus(Window window) {
+    String where = "select t.table.isFullyAudited " //
+        + "  from ADTab t " //
+        + " where t.window = :window " //
+        + " order by t.sequenceNumber, t.id"; //
+    Query<Boolean> q = OBDal.getInstance().getSession().createQuery(where, Boolean.class);
+    q.setParameter("window", window);
+
+    return Arrays.asList(q.list()).toString();
+  }
 }