Improve [ 1712241 ] Delete hard code to set a Column, Tab , Window, PrintFormat

http://sourceforge.net/tracker/index.php?func=detail&aid=1712241&group_id=176962&atid=879335
This commit is contained in:
vpj-cd 2007-05-16 14:51:11 +00:00
parent 42a5381273
commit 7db210ec69
4 changed files with 115 additions and 0 deletions

View File

@ -458,4 +458,36 @@ public class MColumn extends X_AD_Column
return sb.toString ();
} // toString
//begin vpj-cd e-evolution
/**
* get Column ID
* @param String windowName
* @param String columnName
* @return int retValue
*/
public static int getColumn_ID(String TableName,String columnName) {
int m_table_id = MTable.getTable_ID(TableName);
if (m_table_id == 0)
return 0;
int retValue = 0;
String SQL = "SELECT AD_Column_ID FROM AD_Column WHERE AD_Table_ID = ? AND columnname = ?";
try
{
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
pstmt.setInt(1, m_table_id);
pstmt.setString(2, columnName);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
retValue = rs.getInt(1);
rs.close();
pstmt.close();
}
catch (SQLException e)
{
retValue = -1;
}
return retValue;
}
//end vpj-cd e-evolution
} // MColumn

View File

@ -156,4 +156,33 @@ public class MTab extends X_AD_Tab
return true;
}
// begin e-evolution vpj-cd
/**
* get Tab ID
* @param String AD_Window_ID
* @param String TabName
* @return int retValue
*/
public static int getTab_ID(int AD_Window_ID , String TabName) {
int retValue = 0;
String SQL = "SELECT AD_Tab_ID FROM AD_Tab WHERE AD_Window_ID= ? AND Name = ?";
try
{
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
pstmt.setInt(1, AD_Window_ID);
pstmt.setString(2, TabName);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
retValue = rs.getInt(1);
rs.close();
pstmt.close();
}
catch (SQLException e)
{
retValue = -1;
}
return retValue;
}
//end vpj-cd e-evolution
} // M_Tab

View File

@ -220,4 +220,31 @@ public class MWindow extends X_AD_Window
return retValue;
} // getWFNode
//vpj-cd begin e-evolution
/**
* get Window ID
* @param String windowName
* @return int retValue
*/
public static int getWindow_ID(String windowName) {
int retValue = 0;
String SQL = "SELECT AD_Window_ID FROM AD_Window WHERE Name = ?";
try
{
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
pstmt.setString(1, windowName);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
retValue = rs.getInt(1);
rs.close();
pstmt.close();
}
catch (SQLException e)
{
retValue = -1;
}
return retValue;
}
//end vpj-cd e-evolution
} // M_Window

View File

@ -837,6 +837,33 @@ public class MPrintFormat extends X_AD_PrintFormat
s_formats.put(key, null);
} // deleteFromCache
//begin vpj-cd e-evolution
/**
* Get ID of Print Format use Name
* @param String formatName
* @return int retValue
*/
public static int getPrintFormat_ID(String formatName) {
int retValue = 0;
String SQL = "SELECT AD_PrintFormat_ID FROM AD_PrintFormat WHERE Name = ?";
try
{
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
pstmt.setString(1, formatName);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
retValue = rs.getInt(1);
rs.close();
pstmt.close();
}
catch (SQLException e)
{
retValue = -1;
}
return retValue;
}
//end vpj-cd e-evolution
/**************************************************************************
* Test