2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.model
.reference
;
13 import javax
.persistence
.Entity
;
14 import javax
.persistence
.ManyToOne
;
15 import javax
.persistence
.Transient
;
17 import org
.apache
.log4j
.Logger
;
18 import org
.hibernate
.annotations
.Cascade
;
19 import org
.hibernate
.annotations
.CascadeType
;
21 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
22 import eu
.etaxonomy
.cdm
.model
.common
.TimePeriod
;
23 import eu
.etaxonomy
.cdm
.strategy
.cache
.reference
.ArticleDefaultCacheStrategy
;
27 * This class represents articles in a {@link Journal journal}. An article is an independent
28 * piece of prose written by an {@link TeamOrPersonBase author (team)} which is published among
29 * other articles within a particular issue of a journal.
31 * This class corresponds, according to the TDWG ontology, to the publication type
32 * terms (from PublicationTypeTerm): <ul>
33 * <li> "JournalArticle"
34 * <li> "NewspaperArticle"
35 * <li> "MagazineArticle"
40 * @created 08-Nov-2007 13:06:10
43 public class Article
extends StrictReferenceBase
implements INomenclaturalReference
, Cloneable
{
44 static Logger logger
= Logger
.getLogger(Article
.class);
45 private String series
;
46 private String volume
;
48 private Journal inJournal
;
49 private NomenclaturalReferenceHelper nomRefBase
= NomenclaturalReferenceHelper
.NewInstance(this);
53 * Class constructor: creates a new empty article instance
54 * only containing the {@link strategy.cache.reference.ArticleDefaultCacheStrategy default cache strategy}.
56 * @see strategy.cache.reference.ArticleDefaultCacheStrategy
60 this.cacheStrategy
= ArticleDefaultCacheStrategy
.NewInstance();
64 * Creates a new empty article instance
65 * only containing the {@link strategy.cache.reference.ArticleDefaultCacheStrategy default cache strategy}.
68 * @see #NewInstance(Journal, TeamOrPersonBase, String, String, String, String, TimePeriod)
69 * @see strategy.cache.reference.ArticleDefaultCacheStrategy
71 public static Article
NewInstance(){
72 Article result
= new Article();
77 * Creates a new article instance with the given values and with the
78 * {@link strategy.cache.reference.ArticleDefaultCacheStrategy default cache strategy}.
80 * @param inJournal the journal in which <i>this</i> article has
82 * @param authorTeam the team or person who wrote <i>this</i> article
83 * @param articleTitle the string representing the title of <i>this</i>
85 * @param pages the string representing the pages in the journal
86 * issue where <i>this</i> article can be found
87 * @param series the string representing the series (within the
88 * journal) in which <i>this</i> article has been
90 * @param volume the string representing the volume of the journal
91 * in which <i>this</i> article has been published
92 * @param datePublished the date (time period) in which <i>this</i>
93 * article has been published
96 * @see agent.TeamOrPersonBase
97 * @see common.TimePeriod
98 * @see strategy.cache.reference.ArticleDefaultCacheStrategy
100 public static Article
NewInstance(Journal inJournal
, TeamOrPersonBase authorTeam
, String articleTitle
, String pages
, String series
, String volume
, TimePeriod datePublished
){
101 Article result
= new Article();
102 result
.setInJournal(inJournal
);
103 result
.setTitle(articleTitle
);
104 result
.setPages(pages
);
105 result
.setAuthorTeam(authorTeam
);
106 result
.setSeries(series
);
107 result
.setDatePublished(datePublished
);
108 result
.setVolume(volume
);
115 * Returns the {@link Journal journal} in which <i>this</i> article has been published.
117 * @return the journal
121 @Cascade({CascadeType
.SAVE_UPDATE
})
122 public Journal
getInJournal(){
123 return this.inJournal
;
126 * @see #getInJournal()
128 public void setInJournal(Journal inJournal
){
129 this.inJournal
= inJournal
;
133 * Returns the string representing the series (within the journal) in which
134 * <i>this</i> article was published.
136 * @return the string identifying the series
138 public String
getSeries(){
145 public void setSeries(String series
){
146 this.series
= series
;
150 * Returns the string representing the volume of the journal in which
151 * <i>this</i> article was published.
153 * @return the string identifying the series
155 public String
getVolume(){
162 public void setVolume(String volume
){
163 this.volume
= volume
;
167 * Returns the string representing the page(s) where the content of
168 * <i>this</i> article is located within the journal issue.
170 * @return the string with the pages corresponding to <i>this</i> article
172 public String
getPages(){
179 public void setPages(String pages
){
185 * Returns a formatted string containing the entire reference citation,
186 * including authors, title, journal, pages, corresponding to <i>this</i>
188 * This method overrides the generic and inherited
189 * StrictReferenceBase#getCitation() method.
191 * @see NomenclaturalReferenceHelper#getCitation()
192 * @see StrictReferenceBase#getCitation()
195 public String
getCitation(){
196 return nomRefBase
.getCitation();
200 * Returns a formatted string containing the entire citation used for
201 * nomenclatural purposes based on <i>this</i> article - including
202 * (abbreviated) title of the journal but not authors of the article -
203 * and on the given details.
205 * @param microReference the string with the details (generally pages)
207 * @return the formatted string representing the
208 * nomenclatural citation
209 * @see NomenclaturalReferenceHelper#getNomenclaturalCitation(String)
210 * @see INomenclaturalReference#getNomenclaturalCitation(String)
213 public String
getNomenclaturalCitation(String microReference
) {
214 return nomRefBase
.getNomenclaturalCitation(microReference
);
219 * Generates, according to the {@link strategy.cache.reference.ArticleDefaultCacheStrategy default cache strategy}
220 * assigned to <i>this</i> article, a string that identifies <i>this</i>
221 * article and returns it. This string may be stored in the inherited
222 * {@link common.IdentifiableEntity#getTitleCache() titleCache} attribute.<BR>
223 * This method overrides the generic and inherited
224 * ReferenceBase#generateTitle() method.
226 * @return the string identifying <i>this</i> article
227 * @see #getCitation()
228 * @see NomenclaturalReferenceHelper#generateTitle()
229 * @see common.IdentifiableEntity#getTitleCache()
230 * @see common.IdentifiableEntity#generateTitle()
233 public String
generateTitle(){
234 return nomRefBase
.generateTitle();
237 //*********** CLONE **********************************/
241 * Clones <i>this</i> article. This is a shortcut that enables to
242 * create a new instance that differs only slightly from <i>this</i> article
243 * by modifying only some of the attributes.<BR>
244 * This method overrides the {@link StrictReferenceBase#clone() method} from StrictReferenceBase.
246 * @see StrictReferenceBase#clone()
247 * @see media.IdentifyableMediaEntity#clone()
248 * @see java.lang.Object#clone()
250 public Article
clone(){
251 Article result
= (Article
)super.clone();
252 //no changes to: inJournal, pages, series, volume