ischool.info340.teamE
Interface MediaManager

All Known Implementing Classes:
Database

public interface MediaManager


Method Summary
 java.util.Collection getAllMedia()
           
 User getCreator(int userId)
          Gets the user who uploaded this media from the storage medium
 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
 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
 boolean removeMedia(int mediaId)
          Removes a piece of media 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
 

Method Detail

getMedia

Media getMedia(int mediaId)
Parameters:
mediaId - A unique identifier of a media in the storage medium
Returns:
A media from the storage medium coorisponding to mediaId, null if no matching media can be found.

getAllMedia

java.util.Collection getAllMedia()
Returns:
A collection of all media objects from the storage medium, or null if there was an error

insertMedia

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

Parameters:
url - The new location where this media is hosted
desc - The new description of this media
creatorId - The ID of the user who uploaded this media
placeId - The place that this media represents
dateCaptured - The new date that this media was captured at the place
Returns:
The id of the newly inserted media or -1 if there was an error

updateMedia

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

Parameters:
mediaId - The media to be updated
url - The new location where this media is hosted
desc - The new description of this media
creatorId - The ID of the user who uploaded this media
placeId - The place that this media represents
dateCaptured - The new date that this media was captured at the place
Returns:
true if this operation succedes, false otherwise

removeMedia

boolean removeMedia(int mediaId)
Removes a piece of media from the storage medium

Parameters:
mediaId - The tag to remove
Returns:
True if the tag was successfully removed, false otherwise.

getCreator

User getCreator(int userId)
Gets the user who uploaded this media from the storage medium

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

getPlace

Place getPlace(int placeId)
Gets the place from the storage medium

Parameters:
placeId - The id of the place to retrieve
Returns:
The place retrieved or null if there was a error

getMediaForPlace

java.util.Collection getMediaForPlace(int placeId)
Gets all the media associated with a place

Parameters:
placeId - The id of the place to get media for
Returns:
A collection of media objects or null if there was an error