1 6 7 package com.quikj.application.communicator.applications.webtalk.model; 8 9 import java.sql.*; 10 import java.util.*; 11 12 16 17 public class VisitorBean extends Object implements java.io.Serializable 18 { 19 private ArrayList result; 20 21 private String orderBy; 22 private java.sql.Date startDate; 23 private java.sql.Date endDate; 24 25 26 public VisitorBean() 27 { 28 } 29 30 public void generate(Connection con) 31 { 32 ArrayList rowList = new ArrayList(); 33 34 String search = "Select cdr_unreg_login_tbl.name," 35 + "cdr_unreg_login_tbl.address," 36 + "left(cdr_unreg_login_tbl.time_stamp, 10)as login_date, " 37 + "right(cdr_unreg_login_tbl.time_stamp, 8)as login_time," 38 + "cdr_unreg_login_tbl.addnl_info " 39 + "from cdr_unreg_login_tbl where time_stamp between ? " 40 + "AND ? " 41 + "AND cdr_unreg_login_tbl.address IS not NULL order by ?"; 42 43 try 44 { 45 Statement statement = con.createStatement(); 46 statement.execute("use webtalk"); 47 48 PreparedStatement pstmt = con.prepareStatement(search); 49 pstmt.setDate(1, startDate); 50 pstmt.setDate(2, endDate); 51 pstmt.setString(3, orderBy); 52 ResultSet resultSet = pstmt.executeQuery(); 53 if (resultSet == null) 54 { 55 result = null; 56 } 57 else 58 { 59 while (resultSet.next()) 60 { 61 VisitorResultBean visitorResultBean = new VisitorResultBean(); 62 visitorResultBean.setName(resultSet.getString(1)); 63 visitorResultBean.setAddress(resultSet.getString(2)); 64 visitorResultBean.setLoginDate(resultSet.getString(3)); 65 visitorResultBean.setLoginTime(resultSet.getString(4)); 66 visitorResultBean.setAddnlInfo(resultSet.getString(5)); 67 68 rowList.add(visitorResultBean); 69 70 } 71 72 result = rowList; 73 } 74 } 75 catch (SQLException sqle) 76 { 77 result = null; 78 } 79 } 80 81 public ArrayList getResult() 82 { 83 return result; 84 } 85 86 90 public java.lang.String getOrderBy() 91 { 92 return orderBy; 93 } 94 95 99 public void setOrderBy(java.lang.String orderBy) 100 { 101 this.orderBy = orderBy; 103 104 } 105 106 110 public java.sql.Date getEndDate() 111 { 112 return endDate; 113 } 114 115 119 public void setEndDate(java.sql.Date endDate) 120 { 121 this.endDate = endDate; 122 } 123 124 128 public java.sql.Date getStartDate() 129 { 130 return startDate; 131 } 132 133 137 public void setStartDate(java.sql.Date startDate) 138 { 139 this.startDate = startDate; 141 } 142 } 143 | Popular Tags |