ischool.info340.teamE
Class Media

java.lang.Object
  extended by ischool.info340.teamE.Media

public class Media
extends java.lang.Object

Represents media in the storage medium


Constructor Summary
Media(int id, int creatorId, int placeId, java.net.URL location, java.lang.String descr, java.util.Date dateCaptured, MediaManager manager)
          Creates a new instance of media
Media(int creatorId, int placeId, java.net.URL location, java.lang.String descr, java.util.Date dateCaptured, MediaManager manager)
          Creates a new instance of media, and adds it to the storage media
 
Method Summary
 boolean exists()
           
 int getCreatorId()
           
 java.util.Date getDateCaptured()
           
 java.lang.String getDescr()
           
 int getId()
           
 MediaManager getManager()
           
 int getPlaceId()
           
 java.net.URL getURL()
           
 boolean remove()
          Removes this media from the storage medium and marks it as unusable so future use of this media will generate exceptions.
 boolean restore()
          Inserts this previously removed media back into the storage medium and marks it as usable again.
 boolean update(int creatorId, int placeId, java.net.URL location, java.lang.String descr, java.util.Date dateCaptured)
          Updates this media object and its representation in the storage medium to have a new set of properties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Media

public Media(int id,
             int creatorId,
             int placeId,
             java.net.URL location,
             java.lang.String descr,
             java.util.Date dateCaptured,
             MediaManager manager)
Creates a new instance of media

Parameters:
id - The unique identifier in the storage medium for this media
creatorId - The user who created this media
placeId - The id of the place to which this media belongs
location - The URL for accessing the media
descr - The description of this media
dateCaptured - The date on which this media was captured or created
manager - The manager for the storage medium in which this user exists

Media

public Media(int creatorId,
             int placeId,
             java.net.URL location,
             java.lang.String descr,
             java.util.Date dateCaptured,
             MediaManager manager)
Creates a new instance of media, and adds it to the storage media

Parameters:
creatorId - The user who created this media
placeId - The id of the place to which this media belongs
location - The URL for accessing the media
descr - The description of this media
dateCaptured - The date on which this media was captured or created
manager - The manager for the storage medium in which this place exists
Method Detail

getId

public int getId()

getCreatorId

public int getCreatorId()

getPlaceId

public int getPlaceId()

getURL

public java.net.URL getURL()

getDescr

public java.lang.String getDescr()

getDateCaptured

public java.util.Date getDateCaptured()

getManager

public MediaManager getManager()

update

public boolean update(int creatorId,
                      int placeId,
                      java.net.URL location,
                      java.lang.String descr,
                      java.util.Date dateCaptured)
Updates this media object and its representation in the storage medium to have a new set of properties

Parameters:
creatorId - The user who created this media
placeId - The id of the place to which this media belongs
location - The URL for accessing the media
descr - The description of this media
dateCaptured - The date on which this media was captured or created
Returns:
True if the update is successful or false if there was an error

exists

public boolean exists()

remove

public boolean remove()
Removes this media from the storage medium and marks it as unusable so future use of this media will generate exceptions.

Returns:
True if this operation is successful or false if there is an error

restore

public boolean restore()
Inserts this previously removed media back into the storage medium and marks it as usable again.

Returns:
True if this operation is successful or false if there is an error
Throws:
java.lang.IllegalStateException - if this user has not yet been deleted