2014年3月14日 星期五

IDempiere Table Identifier 變革

IDempiere Table Identifier 變革
不需要 // + "NVL(rt.IsUseTableIdentifier,'N')  AS IsUseTableIdentifier "         // 14
因為不需要 IsUseTableIdentifier 去轉向
  if (IsUseTableIdentifier) // 使用 Table 定義 的 Id 欄位
    DisplayColumn = getLookup_DisplayColumn(language, TableName);
  else if (DisplayColumn_Ref != null && DisplayColumn_Ref.length() > 0 )
   DisplayColumn.append(TableName).append(".").append(DisplayColumn_Ref);
=====>
目前是用 showID 自動轉向
  boolean showID = DisplayColumn.equals(TableName+"_ID");
 
  ArrayList<LookupDisplayColumn> list = null;
  if (showID) {
   list = getListIdentifiers(TableName);
   //  Do we have columns ?


static private MLookupInfo getLookup_Table (Properties ctx, Language language,
  int WindowNo, int AD_Reference_Value_ID)
 {
  String lang;
  if (language == null) {
   lang = Env.getAD_Language(Env.getCtx());
  } else {
   lang = language.getAD_Language();
  }
  StringBuilder key = new StringBuilder().append(Env.getAD_Client_ID(ctx)).append("|").append(lang).append("|").append(String.valueOf(AD_Reference_Value_ID));
  MLookupInfo retValue = (MLookupInfo)s_cacheRefTable.get(key.toString());
  if (retValue != null)
  {
   if (s_log.isLoggable(Level.FINEST)) s_log.finest("Cache: " + retValue);
   return retValue.cloneIt();
  }
  //
  String sql0 = "SELECT t.TableName,ck.ColumnName AS KeyColumn,"    // 1..2
   + "cd.ColumnName AS DisplayColumn,rt.IsValueDisplayed,cd.IsTranslated," // 3..5
   + "rt.WhereClause,rt.OrderByClause,t.AD_Window_ID,t.PO_Window_ID, "  // 6..9
   + "t.AD_Table_ID, cd.ColumnSQL as DisplayColumnSQL, "     // 10..11
   + "rt.AD_Window_ID as RT_AD_Window_ID, rt.AD_InfoWindow_ID as AD_InfoWindow_ID, " // 12..13

   + "FROM AD_Ref_Table rt"
   + " INNER JOIN AD_Table t ON (rt.AD_Table_ID=t.AD_Table_ID)"
   + " INNER JOIN AD_Column ck ON (rt.AD_Key=ck.AD_Column_ID)"
   + " INNER JOIN AD_Column cd ON (rt.AD_Display=cd.AD_Column_ID) "
   + "WHERE rt.AD_Reference_ID=?"
   + " AND rt.IsActive='Y' AND t.IsActive='Y'";

沒有留言:

張貼留言