1 |
9479da48
|
Andreas Müller
|
/**
|
2 |
|
|
* Copyright (C) 2007 EDIT
|
3 |
|
|
* European Distributed Institute of Taxonomy
|
4 |
|
|
* http://www.e-taxonomy.eu
|
5 |
|
|
*
|
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.
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
package eu.etaxonomy.cdm.model.reference;
|
11 |
|
|
|
12 |
|
|
|
13 |
788ff862
|
Andreas Müller
|
import javax.persistence.Entity;
|
14 |
|
|
import javax.persistence.ManyToOne;
|
15 |
|
|
import javax.persistence.Transient;
|
16 |
|
|
|
17 |
9479da48
|
Andreas Müller
|
import org.apache.log4j.Logger;
|
18 |
|
|
import org.hibernate.annotations.Cascade;
|
19 |
|
|
import org.hibernate.annotations.CascadeType;
|
20 |
|
|
|
21 |
788ff862
|
Andreas Müller
|
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
|
22 |
|
|
import eu.etaxonomy.cdm.model.common.TimePeriod;
|
23 |
|
|
import eu.etaxonomy.cdm.strategy.cache.reference.ArticleDefaultCacheStrategy;
|
24 |
9479da48
|
Andreas Müller
|
|
25 |
04c7a71a
|
m.geoffroy
|
|
26 |
9479da48
|
Andreas Müller
|
/**
|
27 |
33fe95bf
|
m.geoffroy
|
* 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.
|
30 |
04c7a71a
|
m.geoffroy
|
* <P>
|
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"
|
36 |
|
|
* </ul>
|
37 |
|
|
*
|
38 |
9479da48
|
Andreas Müller
|
* @author m.doering
|
39 |
|
|
* @version 1.0
|
40 |
|
|
* @created 08-Nov-2007 13:06:10
|
41 |
|
|
*/
|
42 |
|
|
@Entity
|
43 |
835c12dd
|
Andreas Müller
|
public class Article extends StrictReferenceBase implements INomenclaturalReference, Cloneable {
|
44 |
9479da48
|
Andreas Müller
|
static Logger logger = Logger.getLogger(Article.class);
|
45 |
|
|
private String series;
|
46 |
|
|
private String volume;
|
47 |
|
|
private String pages;
|
48 |
|
|
private Journal inJournal;
|
49 |
788ff862
|
Andreas Müller
|
private NomenclaturalReferenceHelper nomRefBase = NomenclaturalReferenceHelper.NewInstance(this);
|
50 |
|
|
|
51 |
|
|
|
52 |
04c7a71a
|
m.geoffroy
|
/**
|
53 |
|
|
* Class constructor: creates a new empty article instance
|
54 |
33fe95bf
|
m.geoffroy
|
* only containing the {@link strategy.cache.reference.ArticleDefaultCacheStrategy default cache strategy}.
|
55 |
04c7a71a
|
m.geoffroy
|
*
|
56 |
33fe95bf
|
m.geoffroy
|
* @see strategy.cache.reference.ArticleDefaultCacheStrategy
|
57 |
04c7a71a
|
m.geoffroy
|
*/
|
58 |
|
|
protected Article(){
|
59 |
|
|
super();
|
60 |
|
|
this.cacheStrategy = ArticleDefaultCacheStrategy.NewInstance();
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
/**
|
64 |
|
|
* Creates a new empty article instance
|
65 |
|
|
* only containing the {@link strategy.cache.reference.ArticleDefaultCacheStrategy default cache strategy}.
|
66 |
|
|
*
|
67 |
|
|
* @see #Article()
|
68 |
|
|
* @see #NewInstance(Journal, TeamOrPersonBase, String, String, String, String, TimePeriod)
|
69 |
|
|
* @see strategy.cache.reference.ArticleDefaultCacheStrategy
|
70 |
|
|
*/
|
71 |
788ff862
|
Andreas Müller
|
public static Article NewInstance(){
|
72 |
|
|
Article result = new Article();
|
73 |
|
|
return result;
|
74 |
|
|
}
|
75 |
|
|
|
76 |
04c7a71a
|
m.geoffroy
|
/**
|
77 |
|
|
* Creates a new article instance with the given values and with the
|
78 |
|
|
* {@link strategy.cache.reference.ArticleDefaultCacheStrategy default cache strategy}.
|
79 |
|
|
*
|
80 |
|
|
* @param inJournal the journal in which <i>this</i> article has
|
81 |
|
|
* been published
|
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>
|
84 |
|
|
* article
|
85 |
|
|
* @param pages the string representing the pages in the journal
|
86 |
33fe95bf
|
m.geoffroy
|
* issue where <i>this</i> article can be found
|
87 |
04c7a71a
|
m.geoffroy
|
* @param series the string representing the series (within the
|
88 |
|
|
* journal) in which <i>this</i> article has been
|
89 |
|
|
* published
|
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
|
94 |
|
|
* @see #NewInstance()
|
95 |
|
|
* @see Journal
|
96 |
|
|
* @see agent.TeamOrPersonBase
|
97 |
|
|
* @see common.TimePeriod
|
98 |
|
|
* @see strategy.cache.reference.ArticleDefaultCacheStrategy
|
99 |
|
|
*/
|
100 |
3a5aa8ca
|
Andreas Müller
|
public static Article NewInstance(Journal inJournal, TeamOrPersonBase authorTeam, String articleTitle, String pages, String series, String volume, TimePeriod datePublished ){
|
101 |
788ff862
|
Andreas Müller
|
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 |
3a5aa8ca
|
Andreas Müller
|
result.setVolume(volume);
|
109 |
788ff862
|
Andreas Müller
|
return result;
|
110 |
|
|
}
|
111 |
|
|
|
112 |
|
|
|
113 |
9479da48
|
Andreas Müller
|
|
114 |
04c7a71a
|
m.geoffroy
|
/**
|
115 |
|
|
* Returns the journal in which <i>this</i> article has been published.
|
116 |
|
|
*
|
117 |
|
|
* @return the journal
|
118 |
|
|
* @see Journal
|
119 |
|
|
*/
|
120 |
9479da48
|
Andreas Müller
|
@ManyToOne
|
121 |
|
|
@Cascade({CascadeType.SAVE_UPDATE})
|
122 |
|
|
public Journal getInJournal(){
|
123 |
|
|
return this.inJournal;
|
124 |
|
|
}
|
125 |
04c7a71a
|
m.geoffroy
|
/**
|
126 |
|
|
* @see #getInJournal()
|
127 |
|
|
*/
|
128 |
9479da48
|
Andreas Müller
|
public void setInJournal(Journal inJournal){
|
129 |
|
|
this.inJournal = inJournal;
|
130 |
|
|
}
|
131 |
|
|
|
132 |
04c7a71a
|
m.geoffroy
|
/**
|
133 |
|
|
* Returns the string representing the series (within the journal) in which
|
134 |
|
|
* <i>this</i> article was published.
|
135 |
|
|
*
|
136 |
|
|
* @return the string identifying the series
|
137 |
|
|
*/
|
138 |
9479da48
|
Andreas Müller
|
public String getSeries(){
|
139 |
|
|
return this.series;
|
140 |
|
|
}
|
141 |
|
|
|
142 |
|
|
/**
|
143 |
04c7a71a
|
m.geoffroy
|
* @see #getSeries()
|
144 |
9479da48
|
Andreas Müller
|
*/
|
145 |
|
|
public void setSeries(String series){
|
146 |
|
|
this.series = series;
|
147 |
|
|
}
|
148 |
|
|
|
149 |
04c7a71a
|
m.geoffroy
|
/**
|
150 |
|
|
* Returns the string representing the volume of the journal in which
|
151 |
|
|
* <i>this</i> article was published.
|
152 |
|
|
*
|
153 |
|
|
* @return the string identifying the series
|
154 |
|
|
*/
|
155 |
9479da48
|
Andreas Müller
|
public String getVolume(){
|
156 |
|
|
return this.volume;
|
157 |
|
|
}
|
158 |
|
|
|
159 |
|
|
/**
|
160 |
04c7a71a
|
m.geoffroy
|
* @see #getVolume()
|
161 |
9479da48
|
Andreas Müller
|
*/
|
162 |
|
|
public void setVolume(String volume){
|
163 |
|
|
this.volume = volume;
|
164 |
|
|
}
|
165 |
|
|
|
166 |
04c7a71a
|
m.geoffroy
|
/**
|
167 |
|
|
* Returns the string representing the page(s) where the content of
|
168 |
33fe95bf
|
m.geoffroy
|
* <i>this</i> article is located within the journal issue.
|
169 |
04c7a71a
|
m.geoffroy
|
*
|
170 |
|
|
* @return the string with the pages corresponding to <i>this</i> article
|
171 |
|
|
*/
|
172 |
9479da48
|
Andreas Müller
|
public String getPages(){
|
173 |
|
|
return this.pages;
|
174 |
|
|
}
|
175 |
|
|
|
176 |
|
|
/**
|
177 |
7ba2b731
|
m.geoffroy
|
* @see #getPages()
|
178 |
9479da48
|
Andreas Müller
|
*/
|
179 |
|
|
public void setPages(String pages){
|
180 |
|
|
this.pages = pages;
|
181 |
|
|
}
|
182 |
|
|
|
183 |
788ff862
|
Andreas Müller
|
|
184 |
04c7a71a
|
m.geoffroy
|
/**
|
185 |
|
|
* Returns a formatted string containing the entire reference citation,
|
186 |
|
|
* including authors, title, journal, pages, corresponding to <i>this</i>
|
187 |
7ba2b731
|
m.geoffroy
|
* article.<BR>
|
188 |
|
|
* This method overrides the generic and inherited
|
189 |
|
|
* StrictReferenceBase#getCitation() method.
|
190 |
04c7a71a
|
m.geoffroy
|
*
|
191 |
|
|
* @see NomenclaturalReferenceHelper#getCitation()
|
192 |
7ba2b731
|
m.geoffroy
|
* @see StrictReferenceBase#getCitation()
|
193 |
9479da48
|
Andreas Müller
|
*/
|
194 |
|
|
@Transient
|
195 |
|
|
public String getCitation(){
|
196 |
788ff862
|
Andreas Müller
|
return nomRefBase.getCitation();
|
197 |
9479da48
|
Andreas Müller
|
}
|
198 |
|
|
|
199 |
04c7a71a
|
m.geoffroy
|
/**
|
200 |
|
|
* Returns a formatted string containing the entire citation used for
|
201 |
|
|
* nomenclatural purposes based on <i>this</i> article - including
|
202 |
7ba2b731
|
m.geoffroy
|
* (abbreviated) title of the journal but not authors -
|
203 |
04c7a71a
|
m.geoffroy
|
* and on the given details.
|
204 |
|
|
*
|
205 |
|
|
* @param microReference the string with the details (generally pages)
|
206 |
|
|
* within t<i>this</i> generic reference
|
207 |
|
|
* @return the formatted string representing the
|
208 |
|
|
* nomenclatural citation
|
209 |
|
|
* @see NomenclaturalReferenceHelper#getNomenclaturalCitation(String)
|
210 |
7ba2b731
|
m.geoffroy
|
* @see INomenclaturalReference#getNomenclaturalCitation(String)
|
211 |
9479da48
|
Andreas Müller
|
*/
|
212 |
|
|
@Transient
|
213 |
bef42c31
|
Andreas Müller
|
public String getNomenclaturalCitation(String microReference) {
|
214 |
788ff862
|
Andreas Müller
|
return nomRefBase.getNomenclaturalCitation(microReference);
|
215 |
9479da48
|
Andreas Müller
|
}
|
216 |
|
|
|
217 |
788ff862
|
Andreas Müller
|
|
218 |
04c7a71a
|
m.geoffroy
|
/**
|
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.
|
225 |
|
|
*
|
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()
|
231 |
788ff862
|
Andreas Müller
|
*/
|
232 |
9479da48
|
Andreas Müller
|
@Override
|
233 |
|
|
public String generateTitle(){
|
234 |
788ff862
|
Andreas Müller
|
return nomRefBase.generateTitle();
|
235 |
bef42c31
|
Andreas Müller
|
}
|
236 |
835c12dd
|
Andreas Müller
|
|
237 |
|
|
//*********** CLONE **********************************/
|
238 |
|
|
|
239 |
|
|
|
240 |
04c7a71a
|
m.geoffroy
|
/**
|
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.
|
245 |
|
|
*
|
246 |
|
|
* @see StrictReferenceBase#clone()
|
247 |
|
|
* @see media.IdentifyableMediaEntity#clone()
|
248 |
|
|
* @see java.lang.Object#clone()
|
249 |
835c12dd
|
Andreas Müller
|
*/
|
250 |
|
|
public Article clone(){
|
251 |
|
|
Article result = (Article)super.clone();
|
252 |
04c7a71a
|
m.geoffroy
|
//no changes to: inJournal, pages, series, volume
|
253 |
835c12dd
|
Andreas Müller
|
return result;
|
254 |
|
|
}
|
255 |
|
|
|
256 |
9479da48
|
Andreas Müller
|
|
257 |
|
|
}
|