@Override public List<AbstractBean> getAllActiveRecords() { List<AbstractBean> retValue = new ArrayList<AbstractBean>(); String query = "select * from tbl_crm_company where status = ?;"; try { preparedStatement = DBUtility.connection.prepareStatement(query); preparedStatement.setBoolean(1, true); } catch (SQLException e) { ZLog.err("VNC CRM for Zimbra", "Error in getting all active records in CompanyHelper", e); } ResultSet rs = dbu.select(preparedStatement); CompanyBean companyBean = null; try { while (rs.next()) { companyBean = new CompanyBean(); companyBean.setCompanyId(rs.getInt("companyId")); companyBean.setCompanyName(rs.getString("companyName")); companyBean.setCompanyAddress(rs.getString("companyAddress")); companyBean.setCompanyPhone(rs.getString("companyPhone")); companyBean.setCompanyFax(rs.getString("companyFax")); companyBean.setCompanyEmail(rs.getString("companyEmail")); companyBean.setStatus(rs.getBoolean("status")); companyBean.setCreateBy(rs.getString("createBy")); companyBean.setCreateDate(rs.getString("createDate")); companyBean.setWriteBy(rs.getString("writeBy")); companyBean.setWriteDate(rs.getString("writeDate")); retValue.add(companyBean); } } catch (SQLException e) { ZLog.err("VNC CRM for Zimbra", "Error in Company Helper Class", e); } return retValue; }
private CompanyBean getRecordFromResultSet(ResultSet rs) { CompanyBean companyBean = new CompanyBean(); try { while (rs.next()) { companyBean.setCompanyId(rs.getInt("companyId")); companyBean.setCompanyName(rs.getString("companyName")); companyBean.setCompanyAddress(rs.getString("companyAddress")); companyBean.setCompanyPhone(rs.getString("companyPhone")); companyBean.setCompanyFax(rs.getString("companyFax")); companyBean.setCompanyEmail(rs.getString("companyEmail")); companyBean.setStatus(rs.getBoolean("status")); companyBean.setCreateBy(rs.getString("createBy")); companyBean.setCreateDate(rs.getString("createDate")); companyBean.setWriteBy(rs.getString("writeBy")); companyBean.setWriteDate(rs.getString("writeDate")); } } catch (SQLException e) { ZLog.err("VNC CRM for Zimbra", "Error in Company Helper Class", e); } return companyBean; }