ischool.info340.teamE
Interface UserManager

All Known Implementing Classes:
Database

public interface UserManager

Manages the creation, retrieval, removal, and updating of users


Method Summary
 java.util.Collection getAllUsers()
          Returns a collection of all users
 java.util.Collection getFavoritePlaces(int userId)
          Gets a collection of places that a user has marked as some of his favorites.
 java.util.Collection getFavoritePlaces(int userId, int offset, int maxReturned)
          Returns a range of the favorite places
 java.util.Collection getPopularPlaces(int count)
          Returns the top "X" places
 User getUser(int userId)
          Retrieves a user from the storage medium based on their unique id number.
 User getUser(java.lang.String username)
          This doesn't relate to a user, a slightly hacky way to avoid a new manager interface for favorites.
 int getUserCount()
          Returns the number of users that exist in the database
 java.util.Collection getUsers(int offset, int maxReturned)
          Returns a range of the users
 int insertUser(java.lang.String username, java.lang.String password, java.lang.String name, java.lang.String interests, java.util.Date dateOfBirth)
          Inserts a new user into the storage medium
 boolean removeUser(int userId)
          Removes a user from the storage medium
 boolean updateUser(int id, java.lang.String username, java.lang.String password, java.lang.String name, java.lang.String interests, java.util.Date dateOfBirth)
          Updates a user in the storage medium
 

Method Detail

getUser

User getUser(int userId)
Retrieves a user from the storage medium based on their unique id number.

Parameters:
userId - The id of the user to be retrieved
Returns:
The user retrived from the storage medium

getUser

User getUser(java.lang.String username)
This doesn't relate to a user, a slightly hacky way to avoid a new manager interface for favorites. Returns a user object for the specified username

Parameters:
username - The username of this user
Returns:
The user obeject requested

removeUser

boolean removeUser(int userId)
Removes a user from the storage medium

Parameters:
userId - The unique id for the user to remove
Returns:
True if the operation is a success, false otherwise

insertUser

int insertUser(java.lang.String username,
               java.lang.String password,
               java.lang.String name,
               java.lang.String interests,
               java.util.Date dateOfBirth)
Inserts a new user into the storage medium

Parameters:
username - The login name for the new user
password - The password for the new user
name - The real name of the new user (optional)
interests - A list of the interests of the new user (optional)
dateOfBirth - the date that the new user was born
Returns:
the id of the newly inserted user or -1 if there was an error

updateUser

boolean updateUser(int id,
                   java.lang.String username,
                   java.lang.String password,
                   java.lang.String name,
                   java.lang.String interests,
                   java.util.Date dateOfBirth)
Updates a user in the storage medium

Parameters:
id - The id of the user to be updated
username - The new login name for the user
password - The new password for the user
name - The new real name of the user (optional)
interests - A new list of the interests of the user (optional)
dateOfBirth - The new date that the user was born
Returns:
true if the update was successful, false otherwise

getFavoritePlaces

java.util.Collection getFavoritePlaces(int userId)
Gets a collection of places that a user has marked as some of his favorites.

Parameters:
userId - The id of the user whose favorites should be retrieved
Returns:
a collection of the users favorites, or null if there was an error

getFavoritePlaces

java.util.Collection getFavoritePlaces(int userId,
                                       int offset,
                                       int maxReturned)
Returns a range of the favorite places

Parameters:
userId - the user to return favorites for
offset - The number of favorites to skip before returning favorites
maxReturned - The maximum number of favorites to return from this query
Returns:
a collection of place objects, null if there is an error

getPopularPlaces

java.util.Collection getPopularPlaces(int count)
Returns the top "X" places

Parameters:
count - The number of results to be returned in the collection
Returns:
The collection of popular places.

getAllUsers

java.util.Collection getAllUsers()
Returns a collection of all users

Returns:
a collection of User objects, null if there is an error

getUsers

java.util.Collection getUsers(int offset,
                              int maxReturned)
Returns a range of the users

Parameters:
offset - The number of users to skip before returning users
maxReturned - The maximum number of users to return from this query
Returns:
a collection of user objects, null if there is an error

getUserCount

int getUserCount()
Returns the number of users that exist in the database

Returns:
a positive integer or -1 if there is an error