|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectischool.info340.teamE.Database
public class Database
| Method Summary | |
|---|---|
java.util.Collection |
getAllMedia()
|
java.util.Collection |
getAllPlaces()
|
java.util.Collection |
getAllTags()
|
java.util.Collection |
getAllUsers()
Returns a collection of all users |
java.util.Collection |
getChildren(int tagId)
Gets all the children of this tag |
User |
getCreator(int userId)
Gets the user who uploaded this media from the storage medium |
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 favorites based on a userId |
static Database |
getInstance()
TO DO |
Media |
getMedia(int mediaId)
|
java.util.Collection |
getMediaForPlace(int placeId)
Gets all the media associated with a place |
Place |
getPlace(int placeId)
Gets the place from the storage medium |
java.util.Collection |
getPlacesWithTag(int tagId)
Returns all the places with a given tag |
java.util.Collection |
getPopularPlaces(int count)
Returns the top "X" places |
Tag |
getTag(int tagId)
|
java.util.Collection |
getTagsForPlace(int placeId)
Return all the tags that a given place has been tagged by |
User |
getUser(int userId)
Retrieves a user from the storage medium based on their unique id number. |
User |
getUser(java.lang.String user)
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 |
insertMedia(java.net.URL url,
java.lang.String desc,
int creatorId,
int placeId,
java.util.Date dateCaptured)
Inserts a new piece of media into the storage medium |
int |
insertPlace(int creatorId,
java.lang.String name,
java.lang.String descr)
Inserts a new place into the storage medium |
int |
insertTag(java.lang.String name,
java.lang.String desc,
int creatorId,
int parentId)
Inserts a new tag into the storage medium |
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 |
markPlaceWithTag(int placeId,
int tagId,
int taggedBy)
Updates the storage medium to reflect the association of a tag with a place |
boolean |
removeMedia(int mediaId)
Removes a piece of media from the storage medium |
boolean |
removePlace(int placeId)
Removes a place from the storage medium |
boolean |
removeTag(int tagId)
Removes a tag from the storage medium |
boolean |
removeUser(int userId)
Removes a user from the storage medium |
boolean |
updateMedia(int mediaId,
java.net.URL url,
java.lang.String desc,
int creatorId,
int placeId,
java.util.Date dateCaptured)
Updates the value of a piece of media in the storage medium |
boolean |
updatePlace(int id,
int creatorId,
java.lang.String name,
java.lang.String descr)
Updates the value of a piece of media in the storage medium |
boolean |
updateTag(int tagId,
java.lang.String name,
java.lang.String desc,
int creatorId,
int parentId)
Updates the value of a tag in 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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Database getInstance()
throws java.lang.Exception
java.lang.Exceptionpublic Media getMedia(int mediaId)
getMedia in interface MediaManagermediaId - A unique identifier of a media in the storage medium
public int insertMedia(java.net.URL url,
java.lang.String desc,
int creatorId,
int placeId,
java.util.Date dateCaptured)
insertMedia in interface MediaManagerurl - The location where this media is hosteddesc - The description of this mediacreatorId - The ID of the user who uploaded this mediaplaceId - The place that this media representsdateCaptured - The date that this media was captured at the place
public boolean updateMedia(int mediaId,
java.net.URL url,
java.lang.String desc,
int creatorId,
int placeId,
java.util.Date dateCaptured)
updateMedia in interface MediaManagermediaId - The media to be updatedurl - The new location where this media is hosteddesc - The new description of this mediacreatorId - The ID of the user who uploaded this mediaplaceId - The place that this media representsdateCaptured - The new date that this media was captured at the place
public boolean removeMedia(int mediaId)
removeMedia in interface MediaManagermediaId - The tag to remove
public User getCreator(int userId)
getCreator in interface MediaManagergetCreator in interface PlaceManagergetCreator in interface TagManageruserId - The id of the user to retrieve
public Place getPlace(int placeId)
getPlace in interface MediaManagergetPlace in interface PlaceManagerplaceId - The id of the place to retrieve
public int insertPlace(int creatorId,
java.lang.String name,
java.lang.String descr)
insertPlace in interface PlaceManagercreatorId - The unique id of the user who created this placename - The name of the placedescr - The description that describes this place, can be null
public boolean updatePlace(int id,
int creatorId,
java.lang.String name,
java.lang.String descr)
updatePlace in interface PlaceManagerid - The unique id for this place in the storage mediumcreatorId - The unique id of the user who created this placename - The name of the placedescr - The description that describes this place, can be null
public boolean removePlace(int placeId)
removePlace in interface PlaceManagerplaceId - The unique id for the place to be removed
public Tag getTag(int tagId)
getTag in interface TagManagertagId - A unique identifier of a tag in the storage medium
public int insertTag(java.lang.String name,
java.lang.String desc,
int creatorId,
int parentId)
insertTag in interface TagManagername - The name for this tagdesc - Optional description for this tag, null if ommitted.creatorId - Id of the user who created this tagparentId - Id of the parent of this tag, or -1 for no parent.
public boolean updateTag(int tagId,
java.lang.String name,
java.lang.String desc,
int creatorId,
int parentId)
updateTag in interface TagManagertagId - The tag to be updatedname - The new name for this tagdesc - The new description for this tag, null for no descriptioncreatorId - The new id for user that created this tagparentId - The new parent id for this tag (or -1 fo no parent)
public boolean removeTag(int tagId)
removeTag in interface TagManagertagId - The tag to remove
public java.util.Collection getChildren(int tagId)
getChildren in interface TagManagertagId - Id of the tag whose children should be retrieved or -1 for
root tags
public java.util.Collection getFavoritePlaces(int userId,
int offset,
int maxReturned)
getFavoritePlaces in interface UserManageruserId - the user to return favorites foroffset - The number of favorites to skip before returning favoritesmaxReturned - The maximum number of favorites to return from this query
public User getUser(int userId)
getUser in interface UserManageruserId - The id of the user to be retrieved
public boolean removeUser(int userId)
removeUser in interface UserManageruserId - The unique id for the user to remove
public int insertUser(java.lang.String username,
java.lang.String password,
java.lang.String name,
java.lang.String interests,
java.util.Date dateOfBirth)
insertUser in interface UserManagerusername - The login name for the new userpassword - The password for the new username - 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
public boolean updateUser(int id,
java.lang.String username,
java.lang.String password,
java.lang.String name,
java.lang.String interests,
java.util.Date dateOfBirth)
updateUser in interface UserManagerid - The id of the user to be updatedusername - The new login name for the userpassword - The new password for the username - 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
public java.util.Collection getFavoritePlaces(int userId)
getFavoritePlaces in interface UserManageruserId - The id of the user whose favorites should be retrieved
public User getUser(java.lang.String user)
UserManager
getUser in interface UserManageruser - The username of this user
public java.util.Collection getPopularPlaces(int count)
getPopularPlaces in interface UserManagercount - The number of results to be returned in the collection
public java.util.Collection getAllUsers()
getAllUsers in interface UserManagerpublic java.util.Collection getPlacesWithTag(int tagId)
getPlacesWithTag in interface TagManagertagId - the tagId to retrieve places for
public java.util.Collection getUsers(int offset,
int maxReturned)
getUsers in interface UserManageroffset - The number of users to skip before returning usersmaxReturned - The maximum number of users to return from this query
public int getUserCount()
getUserCount in interface UserManagerpublic java.util.Collection getMediaForPlace(int placeId)
getMediaForPlace in interface MediaManagerplaceId - The id of the place to get media for
public java.util.Collection getTagsForPlace(int placeId)
getTagsForPlace in interface TagManagerplaceId - the place to get tags for
public java.util.Collection getAllMedia()
getAllMedia in interface MediaManagerpublic java.util.Collection getAllPlaces()
getAllPlaces in interface PlaceManagerpublic java.util.Collection getAllTags()
getAllTags in interface TagManager
public boolean markPlaceWithTag(int placeId,
int tagId,
int taggedBy)
markPlaceWithTag in interface PlaceManagertagId - The tag to add to the placeplaceId - the place that was taggedtaggedBy - the id of the user to tagged this place
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||