From 95bc31403ed142597f64404ff61909f52574fa7a Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Thu, 25 Jan 2007 14:26:32 +0000 Subject: [PATCH] * [ 1644310 ] Rev. 1292 hangs on start --- dbPort/src/org/compiere/model/MRole.java | 35 ++++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/dbPort/src/org/compiere/model/MRole.java b/dbPort/src/org/compiere/model/MRole.java index 575eba9357..41702d8c43 100644 --- a/dbPort/src/org/compiere/model/MRole.java +++ b/dbPort/src/org/compiere/model/MRole.java @@ -531,6 +531,8 @@ public final class MRole extends X_AD_Role private HashMap m_tableAccessLevel = null; /** Table Name */ private HashMap m_tableName = null; + /** View Name */ + private Set m_viewName = null; /** Window Access */ private HashMap m_windowAccess = null; @@ -801,9 +803,10 @@ public final class MRole extends X_AD_Role if (m_tableAccessLevel != null && m_tableName != null && !reload) return; m_tableAccessLevel = new HashMap(300); - m_tableName = new HashMap(300); + m_tableName = new HashMap(300); + m_viewName = new HashSet(300); PreparedStatement pstmt = null; - String sql = "SELECT AD_Table_ID, AccessLevel, TableName " + String sql = "SELECT AD_Table_ID, AccessLevel, TableName, IsView " + "FROM AD_Table WHERE IsActive='Y'"; try { @@ -812,8 +815,14 @@ public final class MRole extends X_AD_Role while (rs.next()) { Integer ii = new Integer(rs.getInt(1)); - m_tableAccessLevel.put(ii, rs.getString(2)); - m_tableName.put(rs.getString(3), ii); + m_tableAccessLevel.put(ii, rs.getString(2)); + String tableName = rs.getString(3); + m_tableName.put(tableName, ii); + String isView = rs.getString(4); + if ("Y".equals(isView)) + { + m_viewName.add(tableName); + } } rs.close(); pstmt.close(); @@ -835,7 +844,16 @@ public final class MRole extends X_AD_Role } log.fine("#" + m_tableAccessLevel.size()); } // loadTableAccessLevel - + + /** + * Check if tableName is a view + * @param tableName + * @return boolean + */ + private boolean isView(String tableName) + { + return m_viewName.contains(tableName); + } /** * Load Column Access @@ -1659,7 +1677,12 @@ public final class MRole extends X_AD_Role // ** Data Access ** for (int i = 0; i < ti.length; i++) { - String TableName = ti[i].getTableName(); + String TableName = ti[i].getTableName(); + + //[ 1644310 ] Rev. 1292 hangs on start + if (TableName.toUpperCase().endsWith("_TRL")) continue; + if (isView(TableName)) continue; + int AD_Table_ID = getAD_Table_ID (TableName); // Data Table Access if (AD_Table_ID != 0 && !isTableAccess(AD_Table_ID, !rw))