public User getUserByFacebookId(String facebookId) { String query = "SELECT * FROM Users WHERE FacebookID = " + facebookId; ResultSet rs = DataService.getData(query); try { if (rs.next()) { return convertResultSetToUser(rs); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
/** * getAll Obtains all of the Users from the database. * * @return A Generic list of users from the database. */ @Override public List<User> getAll() { ResultSet rs = DataService.getData("SELECT * FROM Users"); List<User> users = new ArrayList<User>(); try { while (rs.next()) { users.add(convertResultSetToUser(rs)); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return users; }