1 25 26 29 package net.killingar.forum.internal.caches; 30 31 import net.killingar.forum.internal.Group; 32 import net.killingar.forum.internal.IDItem; 33 34 import java.sql.Connection ; 35 import java.sql.PreparedStatement ; 36 import java.sql.ResultSet ; 37 import java.sql.SQLException ; 38 39 public class GroupsCache extends AbstractNamedItemCache 40 { 41 public synchronized Group getGroup(String groupname) throws SQLException 42 { 43 return (Group)get(groupname); 44 } 45 46 public synchronized Group getGroup(long groupID) throws SQLException 47 { 48 return (Group)get(groupID); 49 } 50 51 protected IDItem getObjectFromRow(ResultSet result) throws SQLException 52 { 53 return getGroupFromRow(result); 54 } 55 56 public static Group getGroupFromRow(ResultSet result) throws SQLException 57 { 58 return new Group( 59 result.getLong("ID"), 60 result.getLong("User"), 61 result.getLong("Access"), 62 result.getString("Name"), 63 result.getString("Type")); 64 } 65 66 protected PreparedStatement createStatement(Connection c) throws SQLException 67 { 68 PreparedStatement statement = c.prepareStatement("select * from Groups where LastChanged > ?"); 69 70 statement.setTimestamp(1, latestUpdate); 71 72 return statement; 73 } 74 } 75 | Popular Tags |