MRefList:
* getListDescription should be static * javadoc fix * imporve error logging
This commit is contained in:
parent
592ee1be0a
commit
e2bbd1f0cf
|
@ -39,6 +39,9 @@ import org.compiere.util.ValueNamePair;
|
||||||
*/
|
*/
|
||||||
public class MRefList extends X_AD_Ref_List
|
public class MRefList extends X_AD_Ref_List
|
||||||
{
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Reference List
|
* Get Reference List
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
|
@ -59,7 +62,7 @@ public class MRefList extends X_AD_Ref_List
|
||||||
* @param ctx context
|
* @param ctx context
|
||||||
* @param AD_Reference_ID reference
|
* @param AD_Reference_ID reference
|
||||||
* @param Value value
|
* @param Value value
|
||||||
* @return List or null
|
* @return List or ""
|
||||||
*/
|
*/
|
||||||
public static String getListName (Properties ctx, int AD_Reference_ID, String Value)
|
public static String getListName (Properties ctx, int AD_Reference_ID, String Value)
|
||||||
{
|
{
|
||||||
|
@ -91,9 +94,10 @@ public class MRefList extends X_AD_Ref_List
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql + " - " + key, ex);
|
s_log.log(Level.SEVERE, sql + " -- " + key, ex);
|
||||||
}
|
}
|
||||||
finally {
|
finally
|
||||||
|
{
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +106,7 @@ public class MRefList extends X_AD_Ref_List
|
||||||
if (retValue == null)
|
if (retValue == null)
|
||||||
{
|
{
|
||||||
retValue = "";
|
retValue = "";
|
||||||
s_log.warning("getListName - Not found " + key);
|
s_log.warning("Not found " + key);
|
||||||
}
|
}
|
||||||
s_cache.put(key, retValue);
|
s_cache.put(key, retValue);
|
||||||
//
|
//
|
||||||
|
@ -116,7 +120,7 @@ public class MRefList extends X_AD_Ref_List
|
||||||
* @param Value value
|
* @param Value value
|
||||||
* @return List or null
|
* @return List or null
|
||||||
*/
|
*/
|
||||||
public String getListDescription (Properties ctx, String ListName, String Value)
|
public static String getListDescription (Properties ctx, String ListName, String Value)
|
||||||
{
|
{
|
||||||
String AD_Language = Env.getAD_Language(ctx);
|
String AD_Language = Env.getAD_Language(ctx);
|
||||||
String key = AD_Language + "_" + ListName + "_" + Value;
|
String key = AD_Language + "_" + ListName + "_" + Value;
|
||||||
|
@ -133,16 +137,14 @@ public class MRefList extends X_AD_Ref_List
|
||||||
+ " INNER JOIN AD_Ref_List r ON (r.AD_Ref_List_ID=t.AD_Ref_List_ID) "
|
+ " INNER JOIN AD_Ref_List r ON (r.AD_Ref_List_ID=t.AD_Ref_List_ID) "
|
||||||
+ " WHERE b.Name=? AND a.Value=?"
|
+ " WHERE b.Name=? AND a.Value=?"
|
||||||
+ " AND a.AD_Reference_ID = b.AD_Reference_ID AND t.AD_Language=?";
|
+ " AND a.AD_Reference_ID = b.AD_Reference_ID AND t.AD_Language=?";
|
||||||
|
|
||||||
log.info (sql);
|
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql,null);
|
pstmt = DB.prepareStatement (sql,null);
|
||||||
pstmt.setString (1, ListName);
|
pstmt.setString (1, ListName);
|
||||||
pstmt.setString(2, Value);
|
pstmt.setString(2, Value);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
retValue = rs.getString(1);
|
retValue = rs.getString(1);
|
||||||
rs.close ();
|
rs.close ();
|
||||||
|
@ -151,23 +153,19 @@ public class MRefList extends X_AD_Ref_List
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
log.info("getListDescription - " + sql + " - " + key+ ex);
|
s_log.log(Level.SEVERE, sql + " -- " + key, ex);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
|
|
||||||
// Save into Cache
|
// Save into Cache
|
||||||
if (retValue == null)
|
if (retValue == null)
|
||||||
{
|
{
|
||||||
retValue = "";
|
retValue = "";
|
||||||
log.info("getListDescription - Not found " + key);
|
s_log.info("getListDescription - Not found " + key);
|
||||||
}
|
}
|
||||||
s_cache.put(key, retValue);
|
s_cache.put(key, retValue);
|
||||||
//
|
//
|
||||||
|
@ -229,7 +227,7 @@ public class MRefList extends X_AD_Ref_List
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MRefList.class);
|
private static CLogger s_log = CLogger.getCLogger (MRefList.class);
|
||||||
/** Value Cache */
|
/** Value Cache */
|
||||||
private static CCache<String,String> s_cache = new CCache<String,String>("AD_Ref_List", 20);
|
private static CCache<String,String> s_cache = new CCache<String,String>(Table_Name, 20);
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue