com.neoworks.jukex.sqlimpl
Class JukeXTrack

java.lang.Object
  |
  +--com.neoworks.jukex.sqlimpl.JukeXTrack
All Implemented Interfaces:
DatabaseObject, java.io.Serializable, Track

public class JukeXTrack
extends java.lang.Object
implements Track, DatabaseObject

This object represents a Track within the JukeX system.

Author:
Nick Vincent nick@neoworks.com
See Also:
Serialized Form

Constructor Summary
JukeXTrack(long id, java.net.URL url, java.util.Date updated)
          Creates a new instance of JukeXTrack
 
Method Summary
 void addAttributeValue(Attribute attribute, AttributeValue value)
          Adds an AttributeValue to an existing Attribute on this Track.
 void clearAttribute(Attribute attribute)
          Removes all of the values for this track from the passed Attribute
 AttributeValue getAttributeValue(Attribute attribute)
          Return the first AttributeValue object for a specified Attribute
 AttributeValue getAttributeValue(java.lang.String attributename)
          Get an AttributeValue on this Track by name
 java.util.Collection getAttributeValues(Attribute attribute)
          Retrieve all of the AttributeValue objects corresponding to the given Attribute.
 long getId()
          Return the database ID of this Track
 java.util.Collection getKnownAttributes()
          Retrieve a Collection of all Attribute objects which this track has.
 java.util.Date getUpdatedDate()
          Return the last time that this Track was updated in the database.
 java.net.URL getURL()
          Return the URL of the Track's location
 void replaceAttributeValues(Attribute attribute, AttributeValue value)
          Replace all of the current attribute values with the one passed
 void setUpdatedDate(java.util.Date newdate)
          Set the time that this Track was updated.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JukeXTrack

public JukeXTrack(long id,
                  java.net.URL url,
                  java.util.Date updated)
Creates a new instance of JukeXTrack

Method Detail

getAttributeValues

public java.util.Collection getAttributeValues(Attribute attribute)
Description copied from interface: Track
Retrieve all of the AttributeValue objects corresponding to the given Attribute. This, for instance, could allow you to get all of the artists who performed on a Track by passing an Attribute object representing the 'performer' attribute.

Specified by:
getAttributeValues in interface Track
Parameters:
attribute - The Attribute for which the values are to be retrieved
Returns:
A Collection of AttributeValue objects

replaceAttributeValues

public void replaceAttributeValues(Attribute attribute,
                                   AttributeValue value)
Description copied from interface: Track
Replace all of the current attribute values with the one passed

Specified by:
replaceAttributeValues in interface Track
Parameters:
attribute - The Attribute to have its values changed
value - The AttributeValue to become the new value

getKnownAttributes

public java.util.Collection getKnownAttributes()
Description copied from interface: Track
Retrieve a Collection of all Attribute objects which this track has.

Specified by:
getKnownAttributes in interface Track
Returns:
A Collection of all Attribute objects which this track has.

addAttributeValue

public void addAttributeValue(Attribute attribute,
                              AttributeValue value)
Description copied from interface: Track
Adds an AttributeValue to an existing Attribute on this Track.

Specified by:
addAttributeValue in interface Track
Parameters:
attribute - The Attribute to whom the value is to be added
value - The AttributeValue to add

clearAttribute

public void clearAttribute(Attribute attribute)
Description copied from interface: Track
Removes all of the values for this track from the passed Attribute

Specified by:
clearAttribute in interface Track
Parameters:
attribute - The Attribute to remove the values of

getURL

public java.net.URL getURL()
Description copied from interface: Track
Return the URL of the Track's location

Specified by:
getURL in interface Track
Returns:
The URL where the Track can be found

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getUpdatedDate

public java.util.Date getUpdatedDate()
Description copied from interface: Track
Return the last time that this Track was updated in the database. Note that this is only triggered by setUpdatedDate, and not by any alterations made to Attributes/AttributeValues.

Specified by:
getUpdatedDate in interface Track
Returns:
The last time the track was updated.

setUpdatedDate

public void setUpdatedDate(java.util.Date newdate)
Description copied from interface: Track
Set the time that this Track was updated. This takes a parameter to avoid time problems where the clocks on many systems maybe slightly out of sync and mean that suddenly all tracks are updated in the future.

Specified by:
setUpdatedDate in interface Track
Parameters:
newdate - The updated Date to attach to the track.

getId

public long getId()
Description copied from interface: Track
Return the database ID of this Track

Specified by:
getId in interface Track
Returns:
The database ID of this Track

getAttributeValue

public AttributeValue getAttributeValue(Attribute attribute)
Return the first AttributeValue object for a specified Attribute

Specified by:
getAttributeValue in interface Track
Parameters:
attribute - The Attribute to get the value of
Returns:
The AttributeValue corresponding to the specified Attribute

getAttributeValue

public AttributeValue getAttributeValue(java.lang.String attributename)
Get an AttributeValue on this Track by name

Specified by:
getAttributeValue in interface Track
Parameters:
attributename - The name of the Attribute to query for
Returns:
The AttributeValue corresponding to the named attribute