Project

General

Profile

Download (8.55 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.Transient;
15

    
16
import org.apache.log4j.Logger;
17

    
18
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
19
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
20
import eu.etaxonomy.cdm.model.name.Rank;
21
import eu.etaxonomy.cdm.strategy.cache.reference.GenericDefaultCacheStrategy;
22

    
23
/**
24
 * This class represents all references which cannot be clearly assigned to a
25
 * particular {@link StrictReferenceBase reference} subclass. Therefore attributes which are
26
 * characteristic for a unique reference subclass are not necessary here.
27
 * <P>
28
 * This class corresponds, according to the TDWG ontology, to the publication type
29
 * terms (from PublicationTypeTerm): <ul>
30
 * <li> "Generic"
31
 * <li> "Artwork"
32
 * <li> "AudiovisualMaterial"
33
 * <li> "ComputerProgram"
34
 * <li> "Determination"
35
 * <li> "Commentary"
36
 * <li> "SubReference"
37
 * </ul>
38
 * 
39
 * @author m.doering
40
 * @version 1.0
41
 * @created 08-Nov-2007 13:06:26
42
 */
43
@Entity
44
public class Generic extends StrictReferenceBase implements INomenclaturalReference, Cloneable {
45
	static Logger logger = Logger.getLogger(Generic.class);
46
	private String publisher;
47
	private String placePublished;
48
	private String editor;
49
	private String series;
50
	private String volume;
51
	private String pages;
52
	private NomenclaturalReferenceHelper nomRefBase = NomenclaturalReferenceHelper.NewInstance(this);
53

    
54
	
55
	/** 
56
	 * Class constructor: creates a new empty generic reference instance
57
	 * only containing the {@link strategy.cache.reference.GenericDefaultCacheStrategy default cache strategy}.
58
	 * 
59
	 * @see strategy.cache.reference.GenericDefaultCacheStrategy
60
	 */
61
	public Generic(){
62
		super();
63
		this.cacheStrategy = GenericDefaultCacheStrategy.NewInstance();
64
	}
65
	
66
	
67
	/** 
68
	 * Creates a new empty generic reference instance
69
	 * only containing the {@link eu.etaxonomy.cdm.strategy.cache.reference.GenericDefaultCacheStrategy default cache strategy}.
70
	 * 
71
	 * @see #Generic()
72
	 * @see eu.etaxonomy.cdm.strategy.cache.reference.GenericDefaultCacheStrategy
73
	 */
74
	public static Generic NewInstance(){
75
		return new Generic();
76
	}
77
	
78
	/**
79
	 * Returns the string representing the name of the publisher of <i>this</i>
80
	 * generic reference. A publisher is mostly an institution or a private
81
	 * company which assumed the global responsibility for the publication
82
	 * process.<BR>
83
	 * If there is a publisher then the generic reference must be some kind of
84
	 * {@link PublicationBase publication}.
85
	 * 
86
	 * @return  the string identifying the publisher of <i>this</i>
87
	 * 			generic reference
88
	 * @see 	#getEditor()
89
	 */
90
	public String getPublisher(){
91
		return this.publisher;
92
	}
93

    
94
	/**
95
	 * @see #getPublisher()
96
	 */
97
	public void setPublisher(String publisher){
98
		this.publisher = publisher;
99
	}
100

    
101
	/**
102
	 * Returns the string representing the name of the place (mostly the city)
103
	 * where <i>this</i> generic reference has been published.<BR>
104
	 * If there is a published place then the generic reference must be some
105
	 * kind of {@link PublicationBase publication}.
106
	 * 
107
	 * @return  the string identifying the publication place of <i>this</i>
108
	 * 			generic reference
109
	 */
110
	public String getPlacePublished(){
111
		return this.placePublished;
112
	}
113

    
114
	/**
115
	 * @see #getPlacePublished()
116
	 */
117
	public void setPlacePublished(String placePublished){
118
		this.placePublished = placePublished;
119
	}
120

    
121
	/**
122
	 * Returns the string representing the name of the editor of <i>this</i>
123
	 * generic reference. An editor is mostly a person (team) who assumed the
124
	 * responsibility for the content of the publication as a whole without
125
	 * being the author of this content.<BR>
126
	 * If there is an editor then the generic reference must be some
127
	 * kind of {@link PrintedUnitBase physical printed unit}.
128
	 * 
129
	 * @return  the string identifying the editor of <i>this</i>
130
	 * 			generic reference
131
	 * @see 	#getPublisher()
132
	 */
133
	public String getEditor(){
134
		return this.editor;
135
	}
136

    
137
	/**
138
	 * @see #getEditor()
139
	 */
140
	public void setEditor(String editor){
141
		this.editor = editor;
142
	}
143

    
144
	/**
145
	 * Returns the string representing the series (for instance for books or
146
	 * within journals) - and series part - in which <i>this</i> generic reference
147
	 * was published.<BR>
148
	 * If there is a series then the generic reference must be some
149
	 * kind of {@link PrintedUnitBase physical printed unit} or an {@link Article article}.
150
	 * 
151
	 * @return  the string identifying the series for <i>this</i>
152
	 * 			generic reference
153
	 */
154
	public String getSeries(){
155
		return this.series;
156
	}
157

    
158
	/**
159
	 * @see #getSeries()
160
	 */
161
	public void setSeries(String series){
162
		this.series = series;
163
	}
164

    
165
	/**
166
	 * Returns the string representing the volume (for instance for books or
167
	 * within journals) in which <i>this</i> generic reference was published.<BR>
168
	 * If there is a volume then the generic reference must be some
169
	 * kind of {@link PrintedUnitBase physical printed unit} or an {@link Article article}.
170
	 * 
171
	 * @return  the string identifying the volume for <i>this</i>
172
	 * 			generic reference
173
	 */
174
	public String getVolume(){
175
		return this.volume;
176
	}
177

    
178
	/**
179
	 * @see #getVolume()
180
	 */
181
	public void setVolume(String volume){
182
		this.volume = volume;
183
	}
184

    
185
	/**
186
	 * Returns the string representing the page(s) where the content of
187
	 * <i>this</i> generic reference is located.<BR>
188
	 * If there is a pages information then the generic reference must be some
189
	 * kind of {@link PrintedUnitBase physical printed unit} or an {@link Article article}.
190
	 * 
191
	 * @return  the string containing the pages corresponding to <i>this</i>
192
	 * 			generic reference
193
	 */
194
	public String getPages(){
195
		return this.pages;
196
	}
197

    
198
	/**
199
	 * @see #getPages()
200
	 */
201
	public void setPages(String pages){
202
		this.pages = pages;
203
	}
204

    
205
	/**
206
	 * Returns a formatted string containing the entire reference citation,
207
	 * including authors, corresponding to <i>this</i> generic reference.<BR>
208
	 * This method overrides the generic and inherited
209
	 * StrictReferenceBase#getCitation() method.
210
	 * 
211
	 * @see  NomenclaturalReferenceHelper#getCitation()
212
	 * @see  StrictReferenceBase#getCitation()
213
	 */
214
	@Transient
215
	public String getCitation(){
216
		return nomRefBase.getCitation();
217
	}
218

    
219
	/**
220
	 * Returns a formatted string containing the entire citation used for
221
	 * nomenclatural purposes based on <i>this</i> generic reference - including
222
	 * (abbreviated) title but not authors - and on the given
223
	 * details.
224
	 * 
225
	 * @param  microReference	the string with the details (generally pages)
226
	 * 							within <i>this</i> generic reference
227
	 * @return					the formatted string representing the
228
	 * 							nomenclatural citation
229
	 * @see  					NomenclaturalReferenceHelper#getNomenclaturalCitation(String)
230
	 * @see  					INomenclaturalReference#getNomenclaturalCitation(String)
231
	 */
232
	@Transient
233
	public String getNomenclaturalCitation(String microReference) {
234
		return nomRefBase.getNomenclaturalCitation(microReference);
235
	}
236

    
237

    
238
	/* (non-Javadoc)
239
	 * @see eu.etaxonomy.cdm.model.reference.ReferenceBase#generateTitle()
240
	 */
241
	/**
242
	 * Generates, according to the {@link strategy.cache.reference.GenericDefaultCacheStrategy default cache strategy}
243
	 * assigned to <i>this</i> generic reference, a string that identifies <i>this</i>
244
	 * reference and returns it. This string may be stored in the inherited
245
	 * {@link common.IdentifiableEntity#getTitleCache() titleCache} attribute.<BR>
246
	 * This method overrides the generic and inherited
247
	 * ReferenceBase#generateTitle() method.
248
	 *
249
	 * @return  the string identifying <i>this</i> generic reference
250
	 * @see  	#getCitation()
251
	 * @see  	NomenclaturalReferenceHelper#generateTitle()
252
	 * @see  	common.IdentifiableEntity#getTitleCache()
253
	 * @see  	common.IdentifiableEntity#generateTitle()
254
	 */
255
	@Override
256
	public String generateTitle(){
257
		return nomRefBase.generateTitle();
258
	}
259
	
260
//*********** CLONE **********************************/	
261
	
262

    
263
	/** 
264
	 * Clones <i>this</i> generic reference. This is a shortcut that enables to
265
	 * create a new instance that differs only slightly from <i>this</i> generic
266
	 * reference by modifying only some of the attributes.<BR>
267
	 * This method overrides the {@link StrictReferenceBase#clone() method} from StrictReferenceBase.
268
	 * 
269
	 * @see StrictReferenceBase#clone()
270
	 * @see media.IdentifyableMediaEntity#clone()
271
	 * @see java.lang.Object#clone()
272
	 */
273
	public Generic clone(){
274
		Generic result = (Generic)super.clone();
275
		//no changes to: editor, pages, placePublished,publisher, series, volume
276
		return result;
277
	}
278

    
279
}
(8-8/26)