org.norvelle.textcite.model
Class Author

java.lang.Object
  extended by org.norvelle.textcite.model.AbstractCitationContainer
      extended by org.norvelle.textcite.model.Author

public class Author
extends AbstractCitationContainer


Nested Class Summary
static class Author.AuthorConverter
          AuthorConverter is an inner class used for serializing Author objects via XStream.
 
Field Summary
 
Fields inherited from class org.norvelle.textcite.model.AbstractCitationContainer
citations, citationsIds
 
Constructor Summary
protected Author()
          A parameterless constructor, so that we can recreate a serialized Author from XML.
  Author(java.lang.String name)
          Construct the Author object using the name given.
 
Method Summary
 void destroy()
          Removes all Books that were associated with this Author (and therefore any of the Citations associated with the Author).
 java.util.HashMap<java.lang.Integer,Book> getBooks()
           
 java.util.HashMap<java.lang.Integer,Citation> getCitations()
           
 int getId()
           
 java.lang.String getLastName()
          Returns the last name of the author, if the author name is formatted in Last, First fashion; otherwise, returns the entire name.
 java.lang.String getName()
           
 void recreateObjectReferences()
          After loading a CiteBook, instead of having references to the Citations for this Author, we will have a list of IDs, which we need to turn into real object references.
 void registerBook(Book book)
          Marks the given Book object as being by the current Author
 void registerCitation(Citation citation)
          Registers the given Citation as being by the current Author.
 void setName(java.lang.String name)
          Changing the name of an Author involves resorting the AuthorCollection, so we remove the Author from the list, then re-add it to make it sort properly under its new name.
 java.lang.String toString()
           
 void unregisterBook(Book book)
          Dissasociates a Book object from this Author.
 void unregisterCitation(Citation citation)
          Dissasociates a Citation object from the current Author.
 
Methods inherited from class org.norvelle.textcite.model.AbstractCitationContainer
restoreCitationReferences, saveCitationReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Author

public Author(java.lang.String name)
       throws DuplicateRecordException
Construct the Author object using the name given. Assign a unique ID to this object. Also registers the Author with the global AuthorCollection.

Parameters:
name - The name of the author this object represents.
Throws:
DuplicateRecordException

Author

protected Author()
A parameterless constructor, so that we can recreate a serialized Author from XML. Visible only to the inner classes and derived classes.

Method Detail

registerCitation

public void registerCitation(Citation citation)
Registers the given Citation as being by the current Author.

Parameters:
citation - The Citation object to be associated with this Author.

unregisterCitation

public void unregisterCitation(Citation citation)
Dissasociates a Citation object from the current Author.

Parameters:
citation - The Citation that needs to be dissociated.

registerBook

public void registerBook(Book book)
Marks the given Book object as being by the current Author

Parameters:
book - The Book to be associated with this Author.

unregisterBook

public void unregisterBook(Book book)
Dissasociates a Book object from this Author.

Parameters:
book - The Book object to be dissasociated.

destroy

public void destroy()
Removes all Books that were associated with this Author (and therefore any of the Citations associated with the Author).


getName

public java.lang.String getName()

getLastName

public java.lang.String getLastName()
Returns the last name of the author, if the author name is formatted in Last, First fashion; otherwise, returns the entire name.


setName

public void setName(java.lang.String name)
             throws DuplicateRecordException
Changing the name of an Author involves resorting the AuthorCollection, so we remove the Author from the list, then re-add it to make it sort properly under its new name.

Parameters:
name - The new name of the Author.
Throws:
DuplicateRecordException

getBooks

public java.util.HashMap<java.lang.Integer,Book> getBooks()

getCitations

public java.util.HashMap<java.lang.Integer,Citation> getCitations()

getId

public int getId()

toString

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

recreateObjectReferences

public void recreateObjectReferences()
After loading a CiteBook, instead of having references to the Citations for this Author, we will have a list of IDs, which we need to turn into real object references.