1 15 package org.apache.tapestry.contrib.table.model.sql; 16 17 import java.sql.ResultSet ; 18 import java.sql.SQLException ; 19 20 import org.apache.commons.logging.Log; 21 import org.apache.commons.logging.LogFactory; 22 import org.apache.tapestry.contrib.table.model.simple.SimpleTableColumn; 23 24 28 public class SqlTableColumn extends SimpleTableColumn 29 { 30 private static final long serialVersionUID = 1L; 31 private static final Log LOG = LogFactory.getLog(SqlTableColumn.class); 32 33 38 public SqlTableColumn(String strSqlField, String strDisplayName) 39 { 40 super(strSqlField, strDisplayName); 41 } 42 43 49 public SqlTableColumn( 50 String strSqlField, 51 String strDisplayName, 52 boolean bSortable) 53 { 54 super(strSqlField, strDisplayName, bSortable); 55 } 56 57 60 public Object getColumnValue(Object objRow) 61 { 62 try 63 { 64 ResultSet objRS = (ResultSet ) objRow; 65 String strColumnName = getColumnName(); 66 Object objValue = objRS.getObject(strColumnName); 67 if (objValue == null) 68 objValue = ""; 69 return objValue; 70 } 71 catch (SQLException e) 72 { 73 LOG.error("Cannot get the value for column: " + getColumnName(), e); 74 return ""; 75 } 76 } 77 78 } 79 | Popular Tags |