Revision 9691cba9
Added by Andreas Müller over 3 years ago
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/tdwg/voc/SpeciesProfileModel.java | ||
---|---|---|
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 |
*/ |
|
1 | 9 |
package eu.etaxonomy.cdm.remote.dto.tdwg.voc; |
2 | 10 |
|
3 | 11 |
import java.util.HashSet; |
... | ... | |
20 | 28 |
}) |
21 | 29 |
@XmlRootElement(name = "SpeciesProfileModel", namespace = "http://rs.tdwg.org/ontology/voc/SpeciesProfileModel#") |
22 | 30 |
public class SpeciesProfileModel extends Description implements CycleRecoverable { |
23 |
|
|
31 |
|
|
24 | 32 |
@XmlElement(name = "aboutTaxon", namespace = "http://rs.tdwg.org/ontology/voc/SpeciesProfileModel#") |
25 | 33 |
private AboutTaxon aboutTaxon; |
26 |
|
|
34 |
|
|
27 | 35 |
@XmlElement(name = "hasInformation", namespace = "http://rs.tdwg.org/ontology/voc/SpeciesProfileModel#") |
28 | 36 |
private Set<HasInformation> hasInformations = null; |
29 |
|
|
37 |
|
|
30 | 38 |
public TaxonConcept getAboutTaxon() { |
31 | 39 |
return aboutTaxon != null ? aboutTaxon.getTaxonConcept() : null; |
32 | 40 |
} |
... | ... | |
34 | 42 |
public void setAboutTaxon(TaxonConcept taxonConcept) { |
35 | 43 |
this.aboutTaxon = new AboutTaxon(taxonConcept, false); |
36 | 44 |
} |
37 |
|
|
45 |
|
|
38 | 46 |
public TaxonConcept getAboutTaxonRelation() { |
39 | 47 |
return aboutTaxon != null ? aboutTaxon.getTaxonConcept() : null; |
40 | 48 |
} |
... | ... | |
42 | 50 |
public void setAboutTaxonRelation(TaxonConcept taxonConcept) { |
43 | 51 |
this.aboutTaxon = new AboutTaxon(taxonConcept, true); |
44 | 52 |
} |
45 |
|
|
53 |
|
|
46 | 54 |
public Set<InfoItem> getHasInformation() { |
47 | 55 |
if(hasInformations != null) { |
48 |
Set<InfoItem> infoItems = new HashSet<InfoItem>();
|
|
56 |
Set<InfoItem> infoItems = new HashSet<>(); |
|
49 | 57 |
for(HasInformation hasInformation : hasInformations) { |
50 | 58 |
infoItems.add(hasInformation.getInfoItem()); |
51 | 59 |
} |
... | ... | |
57 | 65 |
|
58 | 66 |
public void setHasInformation(Set<InfoItem> infoItems) { |
59 | 67 |
if(infoItems != null) { |
60 |
this.hasInformations = new HashSet<HasInformation>();
|
|
68 |
this.hasInformations = new HashSet<>(); |
|
61 | 69 |
for(InfoItem infoItem : infoItems) { |
62 | 70 |
hasInformations.add( new HasInformation(infoItem)); |
63 | 71 |
} |
... | ... | |
65 | 73 |
hasInformations = null; |
66 | 74 |
} |
67 | 75 |
} |
68 |
|
|
76 |
|
|
69 | 77 |
@XmlAccessorType(XmlAccessType.FIELD) |
70 | 78 |
@XmlType(name = "AboutTaxon", propOrder = { |
71 | 79 |
"taxonConcept" |
... | ... | |
73 | 81 |
public static class AboutTaxon extends LinkType { |
74 | 82 |
@XmlElement(name = "TaxonConcept", namespace = "http://rs.tdwg.org/ontology/voc/TaxonConcept#") |
75 | 83 |
private TaxonConcept taxonConcept; |
76 |
|
|
84 |
|
|
77 | 85 |
protected AboutTaxon() {} |
78 |
|
|
86 |
|
|
79 | 87 |
protected AboutTaxon(TaxonConcept taxonConcept, boolean useRelation) { |
80 | 88 |
if(useRelation) { |
81 | 89 |
if(taxonConcept != null && taxonConcept.getIdentifier() != null) { |
... | ... | |
96 | 104 |
this.taxonConcept = taxonConcept; |
97 | 105 |
} |
98 | 106 |
} |
99 |
|
|
107 |
|
|
100 | 108 |
@XmlAccessorType(XmlAccessType.FIELD) |
101 | 109 |
@XmlType(name = "HasInformation", propOrder = { |
102 | 110 |
"infoItem" |
... | ... | |
105 | 113 |
|
106 | 114 |
@XmlElement(name = "InfoItem", namespace = "http://rs.tdwg.org/ontology/voc/SpeciesProfileModel#") |
107 | 115 |
private InfoItem infoItem; |
108 |
|
|
116 |
|
|
109 | 117 |
protected HasInformation() {} |
110 |
|
|
118 |
|
|
111 | 119 |
protected HasInformation(InfoItem infoItem) { |
112 | 120 |
this.infoItem = infoItem; |
113 | 121 |
} |
114 |
|
|
122 |
|
|
115 | 123 |
protected InfoItem getInfoItem() { |
116 | 124 |
return infoItem; |
117 | 125 |
} |
... | ... | |
121 | 129 |
} |
122 | 130 |
} |
123 | 131 |
|
124 |
public Object onCycleDetected(Context context) { |
|
132 |
@Override |
|
133 |
public Object onCycleDetected(Context context) { |
|
125 | 134 |
SpeciesProfileModel speciesProfileModel = new SpeciesProfileModel(); |
126 | 135 |
speciesProfileModel.setIdentifier(super.getIdentifier()); |
127 | 136 |
speciesProfileModel.setTitle(super.getTitle()); |
Also available in: Unified diff
cleanup