edu.northwestern.at.wordhoard.model
Class Author

java.lang.Object
  extended by edu.northwestern.at.wordhoard.model.Author
All Implemented Interfaces:
GroupingObject, PersistentObject, SearchCriterion, SearchDefaults, java.io.Serializable

public class Author
extends java.lang.Object
implements PersistentObject, SearchDefaults, SearchCriterion, GroupingObject, java.io.Serializable

An author.

Each author has the following attributes:

See Also:
Serialized Form

Constructor Summary
Author()
          Creates a new author.
 
Method Summary
 void addWork(Work work)
          Adds a work.
 void addWorks(java.util.Collection works)
          Adds a collection of works.
 void addWorks(Work[] works)
          Adds an array of works.
 void appendDescription(TextLine line, FontInfo romanFontInfo, FontInfo[] fontInfo)
          Appends a description to a text line.
 boolean equals(java.lang.Object obj)
          Returns true if some other object is equal to this one.
 java.lang.Integer getBirthYear()
          Gets the author's birth year.
 java.lang.Integer getDeathYear()
          Gets the author's death year.
 java.lang.Integer getEarliestWorkYear()
          Gets the author's earliest work year.
 Spelling getGroupingSpelling(int numHits)
          Gets the spelling of the grouping object.
 java.lang.Long getId()
          Gets the unique id.
 java.lang.Class getJoinClass()
          Gets the join class.
 java.lang.Integer getLatestWorkYear()
          Gets the author's latest work year.
 Spelling getName()
          Gets the author's name.
 int getNumWorks()
          Gets the number of works by the author.
 Spelling getOriginalName()
          Gets the author's name in the original language.
 java.lang.String getReportPhrase()
          Gets the report phrase.
 SearchCriterion getSearchDefault(java.lang.Class cls)
          Gets a search criterion default value.
 java.lang.String getWhereClause()
          Gets the Hibernate where clause.
 java.util.Set getWorks()
          Gets the works.
 int hashCode()
          Returns a hash code for the object.
 void removeWork(Work work)
          Removes a work.
 void setArg(org.hibernate.Query q, org.hibernate.Session session)
          Sets the Hibernate query argument.
 void setBirthYear(java.lang.Integer birthYear)
          Sets the author's birth year.
 void setDeathYear(java.lang.Integer deathYear)
          Sets the author's death year.
 void setEarliestWorkYear(java.lang.Integer earliestWorkYear)
          Sets the author's earliest work year.
 void setLatestWorkYear(java.lang.Integer latestWorkYear)
          Sets the author's latest work year.
 void setName(Spelling name)
          Sets the author's name.
 void setOriginalName(Spelling originalName)
          Sets the author's name in the original language.
 java.lang.String toString()
          Gets a string representation of the author.
 java.lang.String toStringDetailed()
          Gets a detailed string representation of the author.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Author

public Author()
Creates a new author.

Method Detail

getId

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

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

getName

public Spelling getName()
Gets the author's name.

Returns:
The name.

setName

public void setName(Spelling name)
Sets the author's name.

Parameters:
name - The author's name.

getOriginalName

public Spelling getOriginalName()
Gets the author's name in the original language.

Returns:
The name in the original language.

setOriginalName

public void setOriginalName(Spelling originalName)
Sets the author's name in the original language.

Parameters:
originalName - The author's name in the original language.

getBirthYear

public java.lang.Integer getBirthYear()
Gets the author's birth year.

Returns:
The birth year, or null if not available.

setBirthYear

public void setBirthYear(java.lang.Integer birthYear)
Sets the author's birth year.

Parameters:
birthYear - The birth year, or null if not available.

getDeathYear

public java.lang.Integer getDeathYear()
Gets the author's death year.

Returns:
The death year, or null if not available.

setDeathYear

public void setDeathYear(java.lang.Integer deathYear)
Sets the author's death year.

Parameters:
deathYear - The death year, or null if not available.

getEarliestWorkYear

public java.lang.Integer getEarliestWorkYear()
Gets the author's earliest work year.

Returns:
The earliest work year, or null if not available.

setEarliestWorkYear

public void setEarliestWorkYear(java.lang.Integer earliestWorkYear)
Sets the author's earliest work year.

Parameters:
earliestWorkYear - The earliest work year, or null if not available.

getLatestWorkYear

public java.lang.Integer getLatestWorkYear()
Gets the author's latest work year.

Returns:
The latest work year, or null if not available.

setLatestWorkYear

public void setLatestWorkYear(java.lang.Integer latestWorkYear)
Sets the author's latest work year.

Parameters:
latestWorkYear - The latest work year, or null if not available.

getWorks

public java.util.Set getWorks()
Gets the works.

Returns:
The works as an unmodifiable set.

addWork

public void addWork(Work work)
Adds a work.

Parameters:
work - The new work.

removeWork

public void removeWork(Work work)
Removes a work.

Parameters:
work - The work.

addWorks

public void addWorks(java.util.Collection works)
Adds a collection of works.

Parameters:
works - The new works.

addWorks

public void addWorks(Work[] works)
Adds an array of works.

Parameters:
works - The new works.

getNumWorks

public int getNumWorks()
Gets the number of works by the author.

Returns:
Number of works.

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.

getJoinClass

public java.lang.Class getJoinClass()
Gets the join class.

Specified by:
getJoinClass in interface SearchCriterion
Returns:
The join class, or null if none.

getWhereClause

public java.lang.String getWhereClause()
Gets the Hibernate where clause.

Specified by:
getWhereClause in interface SearchCriterion
Returns:
The Hibernate where clause.

setArg

public void setArg(org.hibernate.Query q,
                   org.hibernate.Session session)
Sets the Hibernate query argument.

Specified by:
setArg in interface SearchCriterion
Parameters:
q - Hibernate query.
session - Hibernate session.

appendDescription

public void appendDescription(TextLine line,
                              FontInfo romanFontInfo,
                              FontInfo[] fontInfo)
Appends a description to a text line.

Specified by:
appendDescription in interface SearchCriterion
Parameters:
line - Text line.
romanFontInfo - Roman font info.
fontInfo - Array of font info indexed by character set.

getReportPhrase

public java.lang.String getReportPhrase()
Gets the report phrase.

Specified by:
getReportPhrase in interface GroupingObject
Returns:
The report phrase "in".

getGroupingSpelling

public Spelling getGroupingSpelling(int numHits)
Gets the spelling of the grouping object.

Specified by:
getGroupingSpelling in interface GroupingObject
Parameters:
numHits - Number of hits.
Returns:
The spelling of the grouping object.

toString

public java.lang.String toString()
Gets a string representation of the author.

Overrides:
toString in class java.lang.Object
Returns:
The author's name.

toStringDetailed

public java.lang.String toStringDetailed()
Gets a detailed string representation of the author.

Returns:
Detailed string representation.

equals

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

The two authors are equal if their names are equal.

Specified by:
equals in interface GroupingObject
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.

Specified by:
hashCode in interface GroupingObject
Overrides:
hashCode in class java.lang.Object
Returns:
The hash code.