Project

General

Profile

Download (7.81 KB) Statistics
| Branch: | Tag: | Revision:
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 #getPages()
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.<BR>
188
	 * This method overrides the generic and inherited
189
	 * StrictReferenceBase#getCitation() method.
190
	 * 
191
	 * @see  NomenclaturalReferenceHelper#getCitation()
192
	 * @see  StrictReferenceBase#getCitation()
193
	 */
194
	@Transient
195
	public String getCitation(){
196
		return nomRefBase.getCitation();
197
	}
198

    
199
	/**
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 -
203
	 * 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
	 * @see  					INomenclaturalReference#getNomenclaturalCitation(String)
211
	 */
212
	@Transient
213
	public String getNomenclaturalCitation(String microReference) {
214
		return nomRefBase.getNomenclaturalCitation(microReference);
215
	}
216

    
217

    
218
	/**
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
	 */
232
	@Override
233
	public String generateTitle(){
234
		return nomRefBase.generateTitle();
235
	}
236
	
237
//*********** CLONE **********************************/	
238

    
239
	
240
	/** 
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
	 */
250
	public Article clone(){
251
		Article result = (Article)super.clone();
252
		//no changes to: inJournal, pages, series, volume
253
		return result;
254
	}
255
	
256

    
257
}
(1-1/26)