From: <rv...@us...> - 2009-12-10 13:27:58
|
Revision: 347 http://treebase.svn.sourceforge.net/treebase/?rev=347&view=rev Author: rvos Date: 2009-12-10 12:13:13 +0000 (Thu, 10 Dec 2009) Log Message: ----------- Added a getTitle() override. We always want getTitle() to return something. For ArticleCitations, this field would normally be set with the name of the article. For InBookCitation, this field is populated with the section title, so InBookCitation.getSectionTitle() calls the getTitle() method defined here, from whence we need to go up the inheritance tree to the parent Citation class. For BookCitations, the title field is unset, so we return the BookTitle field instead. This should resolve issue #2903172. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/BookCitation.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/BookCitation.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/BookCitation.java 2009-12-09 17:23:37 UTC (rev 346) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/BookCitation.java 2009-12-10 12:13:13 UTC (rev 347) @@ -130,6 +130,32 @@ public String getBookTitle() { return mBookTitle; } + + /** + * Return the BookTitle + * + * @see org.cipres.treebase.domain.study.Citation#getTitle() + * @return String + */ + @Override + @Transient + public String getTitle () { + /* + * We always want getTitle() to return something. + * For ArticleCitations, this field would normally + * be set with the name of the article. For InBookCitation, + * this field is populated with the section title, so + * InBookCitation.getSectionTitle() calls the getTitle() + * method defined here, from whence we need to go up + * the inheritance tree to the parent Citation class. For + * BookCitations, the title field is unset, so we return + * the BookTitle field instead. + */ + if ( this instanceof InBookCitation ) { + return super.getTitle(); + } + return getBookTitle(); + } /** * Set the BookTitle field. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |