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
|
import javax.xml.bind.annotation.XmlAccessType;
|
16
|
import javax.xml.bind.annotation.XmlAccessorType;
|
17
|
import javax.xml.bind.annotation.XmlElement;
|
18
|
import javax.xml.bind.annotation.XmlRootElement;
|
19
|
import javax.xml.bind.annotation.XmlTransient;
|
20
|
import javax.xml.bind.annotation.XmlType;
|
21
|
|
22
|
import org.apache.log4j.Logger;
|
23
|
|
24
|
import eu.etaxonomy.cdm.strategy.cache.reference.GenericDefaultCacheStrategy;
|
25
|
|
26
|
/**
|
27
|
* This class represents all references which cannot be clearly assigned to a
|
28
|
* particular {@link StrictReferenceBase reference} subclass. Therefore attributes which are
|
29
|
* characteristic for a unique reference subclass are not necessary here.
|
30
|
* <P>
|
31
|
* This class corresponds, according to the TDWG ontology, to the publication type
|
32
|
* terms (from PublicationTypeTerm): <ul>
|
33
|
* <li> "Generic"
|
34
|
* <li> "Artwork"
|
35
|
* <li> "AudiovisualMaterial"
|
36
|
* <li> "ComputerProgram"
|
37
|
* <li> "Determination"
|
38
|
* <li> "Commentary"
|
39
|
* <li> "SubReference"
|
40
|
* </ul>
|
41
|
*
|
42
|
* @author m.doering
|
43
|
* @version 1.0
|
44
|
* @created 08-Nov-2007 13:06:26
|
45
|
*/
|
46
|
@XmlAccessorType(XmlAccessType.FIELD)
|
47
|
@XmlType(name = "Generic", propOrder = {
|
48
|
"series",
|
49
|
"volume",
|
50
|
"pages",
|
51
|
"editor",
|
52
|
"publisher",
|
53
|
"placePublished"
|
54
|
// "nomRefBase"
|
55
|
})
|
56
|
@XmlRootElement(name = "Generic")
|
57
|
@Entity
|
58
|
public class Generic extends StrictReferenceBase implements INomenclaturalReference, Cloneable {
|
59
|
|
60
|
static Logger logger = Logger.getLogger(Generic.class);
|
61
|
|
62
|
@XmlElement(name = "Publisher")
|
63
|
private String publisher;
|
64
|
|
65
|
@XmlElement(name = "PlacePublished")
|
66
|
private String placePublished;
|
67
|
|
68
|
@XmlElement(name = "Editor")
|
69
|
private String editor;
|
70
|
|
71
|
@XmlElement(name = "series")
|
72
|
private String series;
|
73
|
|
74
|
@XmlElement(name = "Volume")
|
75
|
private String volume;
|
76
|
|
77
|
@XmlElement(name = "Pages")
|
78
|
private String pages;
|
79
|
|
80
|
@XmlTransient
|
81
|
//@XmlElement(name = "NomenclaturalReferenceBase")
|
82
|
private NomenclaturalReferenceHelper nomRefBase = NomenclaturalReferenceHelper.NewInstance(this);
|
83
|
|
84
|
|
85
|
/**
|
86
|
* Class constructor: creates a new empty generic reference instance
|
87
|
* only containing the {@link eu.etaxonomy.cdm.strategy.cache.reference.GenericDefaultCacheStrategy default cache strategy}.
|
88
|
*
|
89
|
* @see eu.etaxonomy.cdm.strategy.cache.reference.GenericDefaultCacheStrategy
|
90
|
*/
|
91
|
public Generic(){
|
92
|
super();
|
93
|
this.cacheStrategy = GenericDefaultCacheStrategy.NewInstance();
|
94
|
}
|
95
|
|
96
|
|
97
|
/**
|
98
|
* Creates a new empty generic reference instance
|
99
|
* only containing the {@link eu.etaxonomy.cdm.strategy.cache.reference.GenericDefaultCacheStrategy default cache strategy}.
|
100
|
*
|
101
|
* @see #Generic()
|
102
|
* @see eu.etaxonomy.cdm.strategy.cache.reference.GenericDefaultCacheStrategy
|
103
|
*/
|
104
|
public static Generic NewInstance(){
|
105
|
return new Generic();
|
106
|
}
|
107
|
|
108
|
/**
|
109
|
* Returns the string representing the name of the publisher of <i>this</i>
|
110
|
* generic reference. A publisher is mostly an institution or a private
|
111
|
* company which assumed the global responsibility for the publication
|
112
|
* process.<BR>
|
113
|
* If there is a publisher then the generic reference must be some kind of
|
114
|
* {@link PublicationBase publication}.
|
115
|
*
|
116
|
* @return the string identifying the publisher of <i>this</i>
|
117
|
* generic reference
|
118
|
* @see #getEditor()
|
119
|
*/
|
120
|
public String getPublisher(){
|
121
|
return this.publisher;
|
122
|
}
|
123
|
|
124
|
/**
|
125
|
* @see #getPublisher()
|
126
|
*/
|
127
|
public void setPublisher(String publisher){
|
128
|
this.publisher = publisher;
|
129
|
}
|
130
|
|
131
|
/**
|
132
|
* Returns the string representing the name of the place (mostly the city)
|
133
|
* where <i>this</i> generic reference has been published.<BR>
|
134
|
* If there is a published place then the generic reference must be some
|
135
|
* kind of {@link PublicationBase publication}.
|
136
|
*
|
137
|
* @return the string identifying the publication place of <i>this</i>
|
138
|
* generic reference
|
139
|
*/
|
140
|
public String getPlacePublished(){
|
141
|
return this.placePublished;
|
142
|
}
|
143
|
|
144
|
/**
|
145
|
* @see #getPlacePublished()
|
146
|
*/
|
147
|
public void setPlacePublished(String placePublished){
|
148
|
this.placePublished = placePublished;
|
149
|
}
|
150
|
|
151
|
/**
|
152
|
* Returns the string representing the name of the editor of <i>this</i>
|
153
|
* generic reference. An editor is mostly a person (team) who assumed the
|
154
|
* responsibility for the content of the publication as a whole without
|
155
|
* being the author of this content.<BR>
|
156
|
* If there is an editor then the generic reference must be some
|
157
|
* kind of {@link PrintedUnitBase physical printed unit}.
|
158
|
*
|
159
|
* @return the string identifying the editor of <i>this</i>
|
160
|
* generic reference
|
161
|
* @see #getPublisher()
|
162
|
*/
|
163
|
public String getEditor(){
|
164
|
return this.editor;
|
165
|
}
|
166
|
|
167
|
/**
|
168
|
* @see #getEditor()
|
169
|
*/
|
170
|
public void setEditor(String editor){
|
171
|
this.editor = editor;
|
172
|
}
|
173
|
|
174
|
/**
|
175
|
* Returns the string representing the series (for instance for books or
|
176
|
* within journals) - and series part - in which <i>this</i> generic reference
|
177
|
* was published.<BR>
|
178
|
* If there is a series then the generic reference must be some
|
179
|
* kind of {@link PrintedUnitBase physical printed unit} or an {@link Article article}.
|
180
|
*
|
181
|
* @return the string identifying the series for <i>this</i>
|
182
|
* generic reference
|
183
|
*/
|
184
|
public String getSeries(){
|
185
|
return this.series;
|
186
|
}
|
187
|
|
188
|
/**
|
189
|
* @see #getSeries()
|
190
|
*/
|
191
|
public void setSeries(String series){
|
192
|
this.series = series;
|
193
|
}
|
194
|
|
195
|
/**
|
196
|
* Returns the string representing the volume (for instance for books or
|
197
|
* within journals) in which <i>this</i> generic reference was published.<BR>
|
198
|
* If there is a volume then the generic reference must be some
|
199
|
* kind of {@link PrintedUnitBase physical printed unit} or an {@link Article article}.
|
200
|
*
|
201
|
* @return the string identifying the volume for <i>this</i>
|
202
|
* generic reference
|
203
|
*/
|
204
|
public String getVolume(){
|
205
|
return this.volume;
|
206
|
}
|
207
|
|
208
|
/**
|
209
|
* @see #getVolume()
|
210
|
*/
|
211
|
public void setVolume(String volume){
|
212
|
this.volume = volume;
|
213
|
}
|
214
|
|
215
|
/**
|
216
|
* Returns the string representing the page(s) where the content of
|
217
|
* <i>this</i> generic reference is located.<BR>
|
218
|
* If there is a pages information then the generic reference must be some
|
219
|
* kind of {@link PrintedUnitBase physical printed unit} or an {@link Article article}.
|
220
|
*
|
221
|
* @return the string containing the pages corresponding to <i>this</i>
|
222
|
* generic reference
|
223
|
*/
|
224
|
public String getPages(){
|
225
|
return this.pages;
|
226
|
}
|
227
|
|
228
|
/**
|
229
|
* @see #getPages()
|
230
|
*/
|
231
|
public void setPages(String pages){
|
232
|
this.pages = pages;
|
233
|
}
|
234
|
|
235
|
/**
|
236
|
* Returns a formatted string containing the entire reference citation,
|
237
|
* including authors, corresponding to <i>this</i> generic reference.<BR>
|
238
|
* This method overrides the generic and inherited getCitation method
|
239
|
* from {@link StrictReferenceBase StrictReferenceBase}.
|
240
|
*
|
241
|
* @see #getNomenclaturalCitation(String)
|
242
|
* @see StrictReferenceBase#getCitation()
|
243
|
*/
|
244
|
@Override
|
245
|
@Transient
|
246
|
public String getCitation(){
|
247
|
return nomRefBase.getCitation();
|
248
|
}
|
249
|
|
250
|
/**
|
251
|
* Returns a formatted string containing the entire citation used for
|
252
|
* nomenclatural purposes based on <i>this</i> generic reference - including
|
253
|
* (abbreviated) title but not authors - and on the given
|
254
|
* details.
|
255
|
*
|
256
|
* @param microReference the string with the details (generally pages)
|
257
|
* within <i>this</i> generic reference
|
258
|
* @return the formatted string representing the
|
259
|
* nomenclatural citation
|
260
|
* @see #getCitation()
|
261
|
*/
|
262
|
@Transient
|
263
|
public String getNomenclaturalCitation(String microReference) {
|
264
|
return nomRefBase.getNomenclaturalCitation(microReference);
|
265
|
}
|
266
|
|
267
|
|
268
|
/* (non-Javadoc)
|
269
|
* @see eu.etaxonomy.cdm.model.reference.ReferenceBase#generateTitle()
|
270
|
*/
|
271
|
/**
|
272
|
* Generates, according to the {@link strategy.cache.reference.GenericDefaultCacheStrategy default cache strategy}
|
273
|
* assigned to <i>this</i> generic reference, a string that identifies <i>this</i>
|
274
|
* reference and returns it. This string may be stored in the inherited
|
275
|
* {@link common.IdentifiableEntity#getTitleCache() titleCache} attribute.<BR>
|
276
|
* This method overrides the generic and inherited generateTitle method
|
277
|
* from {@link ReferenceBase ReferenceBase}.
|
278
|
*
|
279
|
* @return the string identifying <i>this</i> generic reference
|
280
|
* @see #getCitation()
|
281
|
* @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()
|
282
|
* @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#generateTitle()
|
283
|
*/
|
284
|
@Override
|
285
|
public String generateTitle(){
|
286
|
return nomRefBase.generateTitle();
|
287
|
}
|
288
|
|
289
|
//*********** CLONE **********************************/
|
290
|
|
291
|
|
292
|
/**
|
293
|
* Clones <i>this</i> generic reference. This is a shortcut that enables to
|
294
|
* create a new instance that differs only slightly from <i>this</i> generic
|
295
|
* reference by modifying only some of the attributes.<BR>
|
296
|
* This method overrides the clone method from {@link StrictReferenceBase StrictReferenceBase}.
|
297
|
*
|
298
|
* @see StrictReferenceBase#clone()
|
299
|
* @see eu.etaxonomy.cdm.model.media.IdentifyableMediaEntity#clone()
|
300
|
* @see java.lang.Object#clone()
|
301
|
*/
|
302
|
@Override
|
303
|
public Generic clone(){
|
304
|
Generic result = (Generic)super.clone();
|
305
|
//no changes to: editor, pages, placePublished,publisher, series, volume
|
306
|
return result;
|
307
|
}
|
308
|
|
309
|
}
|