edu.northwestern.at.wordhoard.model.speakers
Class Speech

java.lang.Object
  extended by edu.northwestern.at.wordhoard.model.speakers.Speech
All Implemented Interfaces:
PersistentObject, SearchDefaults

public class Speech
extends java.lang.Object
implements PersistentObject, SearchDefaults

A speech.

Each speech has the following attributes:


Constructor Summary
Speech()
          Creates a new speech.
 
Method Summary
 void addSpeaker(Speaker speaker)
          Adds a speaker.
 boolean equals(java.lang.Object obj)
          Returns true if some other object is equal to this one.
 void export(TableExporterImporter exporterImporter)
          Exports the object to a MySQL table exporter/importer.
 Gender getGender()
          Gets the gender.
 void getGroupingObjects(java.lang.Class groupBy, java.util.List list)
          Gets grouping objects.
 java.lang.Long getId()
          Gets the unique id.
 Mortality getMortality()
          Gets the mortality.
 SearchCriterion getSearchDefault(java.lang.Class cls)
          Gets a search criterion default value.
 java.util.Set getSpeakers()
          Gets the speakers.
 WorkPart getWorkPart()
          Gets the work part.
 int hashCode()
          Returns a hash code for the object.
 void setGender(Gender gender)
          Sets the gender.
 void setId(java.lang.Long id)
          Sets the unique id.
 void setMortality(Mortality mortality)
          Sets the mortality.
 void setWorkPart(WorkPart workPart)
          Sets the work part.
 void updateCommonGenderAndMortality()
          Updates the common gender and mortality values when a speaker is added.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Speech

public Speech()
Creates a new speech.

Method Detail

getId

public java.lang.Long getId()
Gets the unique id.

Specified by:
getId in interface PersistentObject
Returns:
The unique id.

setId

public void setId(java.lang.Long id)
Sets the unique id.

Parameters:
id - The unique id.

getWorkPart

public WorkPart getWorkPart()
Gets the work part.

Returns:
The work part.

setWorkPart

public void setWorkPart(WorkPart workPart)
Sets the work part.

Parameters:
workPart - The work part.

getSpeakers

public java.util.Set getSpeakers()
Gets the speakers.

Returns:
The speakers as an unmodifiable set.

addSpeaker

public void addSpeaker(Speaker speaker)
Adds a speaker.

Parameters:
speaker - The new speaker.

getGender

public Gender getGender()
Gets the gender.

Returns:
The gender.

setGender

public void setGender(Gender gender)
Sets the gender.

Parameters:
gender - The gender.

Needed to make Hibernate happy.


getMortality

public Mortality getMortality()
Gets the mortality.

Returns:
The mortality.

setMortality

public void setMortality(Mortality mortality)
Sets the mortality.

Parameters:
mortality - The mortality.

updateCommonGenderAndMortality

public void updateCommonGenderAndMortality()
Updates the common gender and mortality values when a speaker is added.

If all speakers have the gender, the common gender is that gender. If the speaker genders are mixed, the common gender is set to uncertain, mixed, or unknown.

If all speakers have the mortality, the common gender is that mortality. If the speaker mortalities are mixed, the common mortality is set to unknown or other.

This method should only be used by the database build programs. It should be set protected at the earliest opportunity.


getSearchDefault

public SearchCriterion getSearchDefault(java.lang.Class cls)
Gets a search criterion default value.

Specified by:
getSearchDefault in interface SearchDefaults
Parameters:
cls - Model class of search criterion.
Returns:
Default value for search criterion.

getGroupingObjects

public void getGroupingObjects(java.lang.Class groupBy,
                               java.util.List list)
Gets grouping objects.

Parameters:
groupBy - Grouping class.
list - A list. The grouping objects are appended to this list.

export

public void export(TableExporterImporter exporterImporter)
Exports the object to a MySQL table exporter/importer.

Parameters:
exporterImporter - MySQL table exporter/importer.

equals

public boolean equals(java.lang.Object obj)
Returns true if some other object is equal to this one.

The two speeches are equal if their ids are equal.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The other object.
Returns:
True if this object equals the other object.

hashCode

public int hashCode()
Returns a hash code for the object.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code.