* [ 1644310 ] Rev. 1292 hangs on start

This commit is contained in:
Heng Sin Low 2007-01-25 14:26:32 +00:00
parent b348ec4bf7
commit 95bc31403e
1 changed files with 29 additions and 6 deletions

View File

@ -531,6 +531,8 @@ public final class MRole extends X_AD_Role
private HashMap<Integer,String> m_tableAccessLevel = null; private HashMap<Integer,String> m_tableAccessLevel = null;
/** Table Name */ /** Table Name */
private HashMap<String,Integer> m_tableName = null; private HashMap<String,Integer> m_tableName = null;
/** View Name */
private Set<String> m_viewName = null;
/** Window Access */ /** Window Access */
private HashMap<Integer,Boolean> m_windowAccess = null; private HashMap<Integer,Boolean> m_windowAccess = null;
@ -801,9 +803,10 @@ public final class MRole extends X_AD_Role
if (m_tableAccessLevel != null && m_tableName != null && !reload) if (m_tableAccessLevel != null && m_tableName != null && !reload)
return; return;
m_tableAccessLevel = new HashMap<Integer,String>(300); m_tableAccessLevel = new HashMap<Integer,String>(300);
m_tableName = new HashMap<String,Integer>(300); m_tableName = new HashMap<String,Integer>(300);
m_viewName = new HashSet<String>(300);
PreparedStatement pstmt = null; 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'"; + "FROM AD_Table WHERE IsActive='Y'";
try try
{ {
@ -812,8 +815,14 @@ public final class MRole extends X_AD_Role
while (rs.next()) while (rs.next())
{ {
Integer ii = new Integer(rs.getInt(1)); Integer ii = new Integer(rs.getInt(1));
m_tableAccessLevel.put(ii, rs.getString(2)); m_tableAccessLevel.put(ii, rs.getString(2));
m_tableName.put(rs.getString(3), ii); 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(); rs.close();
pstmt.close(); pstmt.close();
@ -835,7 +844,16 @@ public final class MRole extends X_AD_Role
} }
log.fine("#" + m_tableAccessLevel.size()); log.fine("#" + m_tableAccessLevel.size());
} // loadTableAccessLevel } // loadTableAccessLevel
/**
* Check if tableName is a view
* @param tableName
* @return boolean
*/
private boolean isView(String tableName)
{
return m_viewName.contains(tableName);
}
/** /**
* Load Column Access * Load Column Access
@ -1659,7 +1677,12 @@ public final class MRole extends X_AD_Role
// ** Data Access ** // ** Data Access **
for (int i = 0; i < ti.length; i++) 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); int AD_Table_ID = getAD_Table_ID (TableName);
// Data Table Access // Data Table Access
if (AD_Table_ID != 0 && !isTableAccess(AD_Table_ID, !rw)) if (AD_Table_ID != 0 && !isTableAccess(AD_Table_ID, !rw))