1
|
/**
|
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
|
import javax.persistence.Entity;
|
14
|
import javax.persistence.ManyToOne;
|
15
|
import javax.persistence.Transient;
|
16
|
|
17
|
import org.apache.log4j.Logger;
|
18
|
import org.hibernate.annotations.Cascade;
|
19
|
import org.hibernate.annotations.CascadeType;
|
20
|
|
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;
|
24
|
|
25
|
|
26
|
/**
|
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.
|
30
|
* <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
|
* @author m.doering
|
39
|
* @version 1.0
|
40
|
* @created 08-Nov-2007 13:06:10
|
41
|
*/
|
42
|
@Entity
|
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;
|
47
|
private String pages;
|
48
|
private Journal inJournal;
|
49
|
private NomenclaturalReferenceHelper nomRefBase = NomenclaturalReferenceHelper.NewInstance(this);
|
50
|
|
51
|
|
52
|
/**
|
53
|
* Class constructor: creates a new empty article instance
|
54
|
* only containing the {@link strategy.cache.reference.ArticleDefaultCacheStrategy default cache strategy}.
|
55
|
*
|
56
|
* @see strategy.cache.reference.ArticleDefaultCacheStrategy
|
57
|
*/
|
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
|
public static Article NewInstance(){
|
72
|
Article result = new Article();
|
73
|
return result;
|
74
|
}
|
75
|
|
76
|
/**
|
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
|
* 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
|
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
|
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);
|
109
|
return result;
|
110
|
}
|
111
|
|
112
|
|
113
|
|
114
|
/**
|
115
|
* Returns the journal in which <i>this</i> article has been published.
|
116
|
*
|
117
|
* @return the journal
|
118
|
* @see Journal
|
119
|
*/
|
120
|
@ManyToOne
|
121
|
@Cascade({CascadeType.SAVE_UPDATE})
|
122
|
public Journal getInJournal(){
|
123
|
return this.inJournal;
|
124
|
}
|
125
|
/**
|
126
|
* @see #getInJournal()
|
127
|
*/
|
128
|
public void setInJournal(Journal inJournal){
|
129
|
this.inJournal = inJournal;
|
130
|
}
|
131
|
|
132
|
/**
|
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
|
public String getSeries(){
|
139
|
return this.series;
|
140
|
}
|
141
|
|
142
|
/**
|
143
|
* @see #getSeries()
|
144
|
*/
|
145
|
public void setSeries(String series){
|
146
|
this.series = series;
|
147
|
}
|
148
|
|
149
|
/**
|
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
|
public String getVolume(){
|
156
|
return this.volume;
|
157
|
}
|
158
|
|
159
|
/**
|
160
|
* @see #getVolume()
|
161
|
*/
|
162
|
public void setVolume(String volume){
|
163
|
this.volume = volume;
|
164
|
}
|
165
|
|
166
|
/**
|
167
|
* Returns the string representing the page(s) where the content of
|
168
|
* <i>this</i> article is located within the journal issue.
|
169
|
*
|
170
|
* @return the string with the pages corresponding to <i>this</i> article
|
171
|
*/
|
172
|
public String getPages(){
|
173
|
return this.pages;
|
174
|
}
|
175
|
|
176
|
/**
|
177
|
* @see #getVolume()
|
178
|
*/
|
179
|
public void setPages(String pages){
|
180
|
this.pages = pages;
|
181
|
}
|
182
|
|
183
|
|
184
|
/**
|
185
|
* Returns a formatted string containing the entire reference citation,
|
186
|
* including authors, title, journal, pages, corresponding to <i>this</i>
|
187
|
* article.
|
188
|
*
|
189
|
* @see NomenclaturalReferenceHelper#getCitation()
|
190
|
*/
|
191
|
@Transient
|
192
|
public String getCitation(){
|
193
|
return nomRefBase.getCitation();
|
194
|
}
|
195
|
|
196
|
/**
|
197
|
* Returns a formatted string containing the entire citation used for
|
198
|
* nomenclatural purposes based on <i>this</i> article - including
|
199
|
* (abbreviated) title of the journal and (abbreviated) author string -
|
200
|
* and on the given details.
|
201
|
*
|
202
|
* @param microReference the string with the details (generally pages)
|
203
|
* within t<i>this</i> generic reference
|
204
|
* @return the formatted string representing the
|
205
|
* nomenclatural citation
|
206
|
* @see NomenclaturalReferenceHelper#getNomenclaturalCitation(String)
|
207
|
*/
|
208
|
@Transient
|
209
|
public String getNomenclaturalCitation(String microReference) {
|
210
|
return nomRefBase.getNomenclaturalCitation(microReference);
|
211
|
}
|
212
|
|
213
|
|
214
|
/**
|
215
|
* Generates, according to the {@link strategy.cache.reference.ArticleDefaultCacheStrategy default cache strategy}
|
216
|
* assigned to <i>this</i> article, a string that identifies <i>this</i>
|
217
|
* article and returns it. This string may be stored in the inherited
|
218
|
* {@link common.IdentifiableEntity#getTitleCache() titleCache} attribute.<BR>
|
219
|
* This method overrides the generic and inherited
|
220
|
* ReferenceBase#generateTitle() method.
|
221
|
*
|
222
|
* @return the string identifying <i>this</i> article
|
223
|
* @see #getCitation()
|
224
|
* @see NomenclaturalReferenceHelper#generateTitle()
|
225
|
* @see common.IdentifiableEntity#getTitleCache()
|
226
|
* @see common.IdentifiableEntity#generateTitle()
|
227
|
*/
|
228
|
@Override
|
229
|
public String generateTitle(){
|
230
|
return nomRefBase.generateTitle();
|
231
|
}
|
232
|
|
233
|
//*********** CLONE **********************************/
|
234
|
|
235
|
|
236
|
/**
|
237
|
* Clones <i>this</i> article. This is a shortcut that enables to
|
238
|
* create a new instance that differs only slightly from <i>this</i> article
|
239
|
* by modifying only some of the attributes.<BR>
|
240
|
* This method overrides the {@link StrictReferenceBase#clone() method} from StrictReferenceBase.
|
241
|
*
|
242
|
* @see StrictReferenceBase#clone()
|
243
|
* @see media.IdentifyableMediaEntity#clone()
|
244
|
* @see java.lang.Object#clone()
|
245
|
*/
|
246
|
public Article clone(){
|
247
|
Article result = (Article)super.clone();
|
248
|
//no changes to: inJournal, pages, series, volume
|
249
|
return result;
|
250
|
}
|
251
|
|
252
|
|
253
|
}
|