Project

General

Profile

Download (15.2 KB) Statistics
| Branch: | Tag: | Revision:
1
package eu.etaxonomy.cdm.model;
2

    
3
import java.util.ArrayList;
4
import java.util.Collection;
5
import java.util.HashSet;
6
import java.util.List;
7
import java.util.Set;
8

    
9
import javax.xml.bind.annotation.XmlAccessType;
10
import javax.xml.bind.annotation.XmlAccessorType;
11
import javax.xml.bind.annotation.XmlElement;
12
import javax.xml.bind.annotation.XmlElementWrapper;
13
import javax.xml.bind.annotation.XmlElements;
14
import javax.xml.bind.annotation.XmlRootElement;
15
import javax.xml.bind.annotation.XmlType;
16

    
17
import eu.etaxonomy.cdm.model.agent.Address;
18
import eu.etaxonomy.cdm.model.agent.Agent;
19
import eu.etaxonomy.cdm.model.agent.Contact;
20
import eu.etaxonomy.cdm.model.agent.Institution;
21
import eu.etaxonomy.cdm.model.agent.InstitutionalMembership;
22
import eu.etaxonomy.cdm.model.agent.Person;
23
import eu.etaxonomy.cdm.model.agent.Team;
24
import eu.etaxonomy.cdm.model.common.Keyword;
25
import eu.etaxonomy.cdm.model.common.RelationshipBase;
26
import eu.etaxonomy.cdm.model.common.TermBase;
27
import eu.etaxonomy.cdm.model.common.VersionableEntity;
28
import eu.etaxonomy.cdm.model.name.BotanicalName;
29
import eu.etaxonomy.cdm.model.name.CultivarPlantName;
30
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
31
import eu.etaxonomy.cdm.model.name.HybridRelationship;
32
import eu.etaxonomy.cdm.model.name.NameRelationship;
33
import eu.etaxonomy.cdm.model.name.Rank;
34
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
35
import eu.etaxonomy.cdm.model.name.ZoologicalName;
36
import eu.etaxonomy.cdm.model.reference.Article;
37
import eu.etaxonomy.cdm.model.reference.Book;
38
import eu.etaxonomy.cdm.model.reference.BookSection;
39
import eu.etaxonomy.cdm.model.reference.CdDvd;
40
import eu.etaxonomy.cdm.model.reference.ConferenceProceedings;
41
import eu.etaxonomy.cdm.model.reference.Database;
42
import eu.etaxonomy.cdm.model.reference.Generic;
43
import eu.etaxonomy.cdm.model.reference.InProceedings;
44
import eu.etaxonomy.cdm.model.reference.Journal;
45
import eu.etaxonomy.cdm.model.reference.Map;
46
import eu.etaxonomy.cdm.model.reference.Patent;
47
import eu.etaxonomy.cdm.model.reference.PersonalCommunication;
48
import eu.etaxonomy.cdm.model.reference.PrintSeries;
49
import eu.etaxonomy.cdm.model.reference.Proceedings;
50
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
51
import eu.etaxonomy.cdm.model.reference.Report;
52
import eu.etaxonomy.cdm.model.reference.Thesis;
53
import eu.etaxonomy.cdm.model.reference.WebPage;
54
import eu.etaxonomy.cdm.model.taxon.Synonym;
55
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
56
import eu.etaxonomy.cdm.model.taxon.Taxon;
57
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
58
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
59

    
60
@XmlAccessorType(XmlAccessType.FIELD)
61
@XmlType(name = "", propOrder = {
62
		"agents",
63
		"agentData",
64
	    "terms",
65
	    "references",
66
	    "taxonomicNames",
67
	    "taxa",
68
	    "synonyms",
69
	    "relationships",
70
	    "homotypicalGroups"
71
})
72
@XmlRootElement(name = "DataSet", namespace = "http://etaxonomy.eu/cdm/model/1.0")
73
public class DataSet {
74

    
75
    // Some fields are of type List and some are of type Set. 
76
	// This is mainly because
77
	// the service classes return lists, i.e.
78
    // TaxonServiceImpl.getRootTaxa() returns List<Taxon>
79
	// and the Taxon methods return sets, i.e.
80
    // Taxon.getTaxonomicChildren() returns Set<Taxon>.
81

    
82
    @XmlElementWrapper(name = "Agents")
83
    @XmlElements({
84
        @XmlElement(name = "Team", namespace = "http://etaxonomy.eu/cdm/model/agent/1.0", type = Team.class),
85
        @XmlElement(name = "Institution", namespace = "http://etaxonomy.eu/cdm/model/agent/1.0", type = Institution.class),
86
        @XmlElement(name = "Person", namespace = "http://etaxonomy.eu/cdm/model/agent/1.0", type = Person.class)
87
    })
88
    protected List<Agent> agents;
89
    
90
    @XmlElementWrapper(name = "AgentData")
91
    @XmlElements({
92
    @XmlElement(name = "Address", namespace = "http://etaxonomy.eu/cdm/model/agent/1.0", type = Address.class),
93
    @XmlElement(name = "Contact", namespace = "http://etaxonomy.eu/cdm/model/agent/1.0", type = Contact.class),
94
    @XmlElement(name = "Membership", namespace = "http://etaxonomy.eu/cdm/model/agent/1.0", type = InstitutionalMembership.class)
95
    })
96
    protected List<VersionableEntity> agentData;
97

    
98
    @XmlElementWrapper(name = "Terms")
99
    @XmlElements({
100
        @XmlElement(name = "Keyword", namespace = "http://etaxonomy.eu/cdm/model/common/1.0", type = Keyword.class),
101
        @XmlElement(name = "Rank", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = Rank.class)
102
    })
103
    protected List<TermBase> terms;
104

    
105
    @XmlElementWrapper(name = "References")
106
    @XmlElements({
107
    	@XmlElement(name = "Article", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = Article.class),
108
    	@XmlElement(name = "ConferenceProceedings", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = ConferenceProceedings.class),
109
    	@XmlElement(name = "Generic", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = Generic.class),
110
    	@XmlElement(name = "Patent", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = Patent.class),
111
    	@XmlElement(name = "PersonalCommunication", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = PersonalCommunication.class),
112
    	@XmlElement(name = "CdDvd", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = CdDvd.class),
113
    	@XmlElement(name = "Database", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = Database.class),
114
    	@XmlElement(name = "Journal", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = Journal.class),
115
    	@XmlElement(name = "Map", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = Map.class),
116
    	@XmlElement(name = "Book", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = Book.class),
117
    	@XmlElement(name = "Proceedings", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = Proceedings.class),
118
    	@XmlElement(name = "PrintSeries", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = PrintSeries.class),
119
    	@XmlElement(name = "Report", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = Report.class),
120
    	@XmlElement(name = "Thesis", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = Thesis.class),
121
    	@XmlElement(name = "WebPage", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = WebPage.class),
122
    	@XmlElement(name = "BookSection", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = BookSection.class),
123
    	@XmlElement(name = "InProceedings", namespace = "http://etaxonomy.eu/cdm/model/reference/1.0", type = InProceedings.class)
124
    })
125
    protected List<ReferenceBase> references;
126

    
127
    @XmlElementWrapper(name = "TaxonomicNames")
128
    @XmlElements({
129
    	@XmlElement(name = "ZoologicalName", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = ZoologicalName.class),
130
    	@XmlElement(name = "CultivarPlantName", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = CultivarPlantName.class),
131
    	@XmlElement(name = "BotanicalName", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = BotanicalName.class)
132
    })
133
    protected List<TaxonNameBase> taxonomicNames;
134

    
135
    @XmlElementWrapper(name = "Taxa")
136
    @XmlElement(name = "Taxon", namespace = "http://etaxonomy.eu/cdm/model/taxon/1.0")
137
    protected List<Taxon> taxa;
138
	
139
    @XmlElementWrapper(name = "Synonyms")
140
    @XmlElement(name = "Synonym", namespace = "http://etaxonomy.eu/cdm/model/taxon/1.0")
141
    protected Set<Synonym> synonyms;
142

    
143
    @XmlElementWrapper(name = "Relationships")
144
    @XmlElements({
145
    	@XmlElement(name = "TaxonRelationship", namespace = "http://etaxonomy.eu/cdm/model/taxon/1.0", type = TaxonRelationship.class),
146
    	@XmlElement(name = "SynonymRelationship", namespace = "http://etaxonomy.eu/cdm/model/taxon/1.0", type = SynonymRelationship.class),
147
    	@XmlElement(name = "NameRelationship", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = NameRelationship.class),
148
    	@XmlElement(name = "HybridRelationship", namespace = "http://etaxonomy.eu/cdm/model/name/1.0", type = HybridRelationship.class)
149
    })
150
    protected Set<RelationshipBase> relationships;
151

    
152
    @XmlElementWrapper(name = "HomotypicalGroups")
153
    @XmlElement(name = "HomotypicalGroup", namespace = "http://etaxonomy.eu/cdm/model/name/1.0")
154
    protected Set<HomotypicalGroup> homotypicalGroups;
155

    
156
    public DataSet () {
157

    
158
//    	this.agents = new 
159
//    	this.agentData = new 
160
//      this.terms   	
161
//      this.references    	
162
//    	this.taxonomicNames
163
//    	this.taxa
164
        this.synonyms = new HashSet<Synonym>();
165
    	this.relationships = new HashSet<RelationshipBase>();
166
    	this.homotypicalGroups = new HashSet<HomotypicalGroup>();
167
    }
168

    
169
    /**
170
     * Gets the value of the agents property.
171
     * 
172
     * @return
173
     *     possible object is
174
     *     {@link List<Agent> }
175
     *     
176
     */
177
    public List<Agent> getAgents() {
178
        return agents;
179
    }
180

    
181
    /**
182
     * Sets the value of the agents property.
183
     * 
184
     * @param value
185
     *     allowed object is
186
     *     {@link List<Agent> }
187
     *     
188
     */
189
    public void setAgents(List<Agent> value) {
190
        this.agents = value;
191
    }
192

    
193
    /**
194
     * Gets the value of the agentData property.
195
     * 
196
     * @return
197
     *     possible object is
198
     *     {@link List<VersionableEntity> }
199
     *     
200
     */
201
    public List<VersionableEntity> getAgentData() {
202
        return agentData;
203
    }
204

    
205
    /**
206
     * Sets the value of the agentData property.
207
     * 
208
     * @param value
209
     *     allowed object is
210
     *     {@link List<VersionableEntity> }
211
     *     
212
     */
213
    public void setAgentData(List<VersionableEntity> value) {
214
        this.agentData = value;
215
    }
216

    
217
    /**
218
     * Gets the value of the terms property.
219
     * 
220
     * @return
221
     *     possible object is
222
     *     {@link List<TermBase> }
223
     *     
224
     */
225
    
226
    public List<TermBase> getTerms() {
227
        return terms;
228
    }
229

    
230
    /**
231
     * Sets the value of the terms property.
232
     * 
233
     * @param value
234
     *     allowed object is
235
     *     {@link List<TermBase> }
236
     *     
237
     */
238
    public void setTerms(List<TermBase> value) {
239
        this.terms = value;
240
    }
241

    
242
    /**
243
     * Gets the value of the taxonomicNames property.
244
     * 
245
     * @return
246
     *     possible object is
247
     *     {@link List<NonViralName> }
248
     *     
249
     */
250
    public List<TaxonNameBase> getTaxonomicNames() {
251
        return taxonomicNames;
252
    }
253

    
254
    /**
255
     * Sets the value of the taxonomicNames property.
256
     * 
257
     * @param value
258
     *     allowed object is
259
     *     {@link List<NonViralName> }
260
     *     
261
     */
262
    public void setTaxonomicNames(List<TaxonNameBase> value) {
263
        this.taxonomicNames = value;
264
    }
265

    
266
    /**
267
     * Gets the value of the taxonomicNames property.
268
     * 
269
     * @return
270
     *     possible object is
271
     *     {@link List<NonViralName> }
272
     *     
273
     */
274
    public List<ReferenceBase> getReferences() {
275
        return references;
276
    }
277

    
278
    /**
279
     * Sets the value of the taxonomicNames property.
280
     * 
281
     * @param value
282
     *     allowed object is
283
     *     {@link List<NonViralName> }
284
     *     
285
     */
286
    public void setReferences(List<ReferenceBase> value) {
287
        this.references = value;
288
    }
289

    
290
    /**
291
     * Gets the value of the taxa property.
292
     * 
293
     * @return
294
     *     possible object is
295
     *     {@link List<Taxon> }
296
     *     
297
     */
298
//    public List<Taxon> getTaxa() {
299
//        return taxa;
300
//    }
301

    
302
    /**
303
     * Gets the value of the taxa property as {@link Collection<TaxonBase> }
304
     * 
305
     * @return
306
     *     possible object is
307
     *     {@link Collection<TaxonBase> }
308
     *     
309
     */
310
    public Collection<TaxonBase> getTaxonBases() {
311
    	
312
        // FIXME: This is a dirty trick.
313
    	Object obj = (Object)taxa;
314
    	Collection<TaxonBase> taxonBases = (Collection<TaxonBase>)obj;
315
        return taxonBases;
316
    }
317

    
318
    public Collection<TaxonBase> getTaxonBases_() {
319
    	
320
    	Collection<TaxonBase> taxonBases = new HashSet<TaxonBase>();
321
    	
322
    	for (Taxon taxon: taxa) {
323
    		taxonBases.add(taxon);
324
    	}
325
    	for (Synonym synonym: synonyms) {
326
    		taxonBases.add(synonym);
327
    	}
328
        return taxonBases;
329
    }
330

    
331
    /**
332
     * Sets the value of the taxa property.
333
     * 
334
     * @param value
335
     *     allowed object is
336
     *     {@link List<Taxon> }
337
     *     
338
     */
339
    public void setTaxa(List<Taxon> value) {
340
        this.taxa = value;
341
    }
342

    
343
    /**
344
     * Adds the taxa in value to the taxa property list.
345
     * 
346
     * @param value
347
     *     allowed object is
348
     *     {@link Collection<Taxon> }
349
     *     
350
     */
351
    public void addTaxa(Collection<Taxon> value) {
352
    	for (Taxon taxon: value) {
353
    		this.taxa.add(taxon);
354
    	}
355
    }
356

    
357
    /**
358
     * Gets the value of the synonyms property.
359
     * 
360
     * @return
361
     *     possible object is
362
     *     {@link List<Synonym> }
363
     *     
364
     */
365
    public Set<Synonym> getSynonyms() {
366
        return synonyms;
367
    }
368

    
369
    /**
370
     * Sets the value of the synonyms property.
371
     * 
372
     * @param value
373
     *     allowed object is
374
     *     {@link List<Synonym> }
375
     *     
376
     */
377
    public void setSynonyms(Set<Synonym> value) {
378
        this.synonyms = value;
379
    }
380
    
381
    /**
382
     * Adds the synonym in value to the synonyms property list.
383
     * 
384
     * @param value
385
     *     allowed object is
386
     *     {@link Collection<Synonym> }
387
     *     
388
     */
389
    public void addSynonyms(Collection<Synonym> value) {
390
    	for (Synonym synonym: value) {
391
    		this.synonyms.add(synonym);
392
    	}
393
    }
394

    
395
    /**
396
     * Gets the value of the relationships property.
397
     * 
398
     * @return
399
     *     possible object is
400
     *     {@link Set<RelationshipBase> }
401
     *     
402
     */
403
    public Set<RelationshipBase> getRelationships() {
404
        return relationships;
405
    }
406

    
407
    /**
408
     * Sets the value of the relationships property.
409
     * 
410
     * @param value
411
     *     allowed object is
412
     *     {@link Set<RelationshipBase> }
413
     *     
414
     */
415
    public void setRelationships(Set<RelationshipBase> value) {
416
        this.relationships = value;
417
    }
418

    
419
    /**
420
     * Adds the relationship in value to the relationships property list.
421
     * 
422
     * @param value
423
     *     allowed object is
424
     *     {@link Collection<RelationshipBase> }
425
     *     
426
     */
427
    public void addRelationships(Collection<? extends RelationshipBase> value) {
428
    	for (RelationshipBase relationship: value) {
429
    		this.relationships.add(relationship);
430
    	}
431
    }
432

    
433
    /**
434
     * Gets the value of the synonyms property.
435
     * 
436
     * @return
437
     *     possible object is
438
     *     {@link List<Synonym> }
439
     *     
440
     */
441
    public Set<HomotypicalGroup> getHomotypicalGroups() {
442
        return homotypicalGroups;
443
    }
444

    
445
    /**
446
     * Sets the value of the synonyms property.
447
     * 
448
     * @param value
449
     *     allowed object is
450
     *     {@link List<Synonym> }
451
     *     
452
     */
453
    public void setHomotypicalGroups(Set<HomotypicalGroup> value) {
454
        this.homotypicalGroups = value;
455
    }
456
    
457
}
(1-1/2)