Revision c704fcae
Added by Andreas Müller over 8 years ago
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/EditGeoService.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.cdm.api.service.dto.DistributionInfoDTO; |
34 | 34 |
import eu.etaxonomy.cdm.api.service.dto.DistributionInfoDTO.InfoPart; |
35 | 35 |
import eu.etaxonomy.cdm.api.utility.DescriptionUtility; |
36 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
36 | 37 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
37 | 38 |
import eu.etaxonomy.cdm.model.common.Language; |
38 | 39 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
39 | 40 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
41 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
|
40 | 42 |
import eu.etaxonomy.cdm.model.description.Distribution; |
41 | 43 |
import eu.etaxonomy.cdm.model.description.Feature; |
42 | 44 |
import eu.etaxonomy.cdm.model.description.IndividualsAssociation; |
... | ... | |
98 | 100 |
* @return |
99 | 101 |
*/ |
100 | 102 |
private Set<Distribution> getDistributionsOf(List<TaxonDescription> taxonDescriptions) { |
101 |
Set<Distribution> distributions = new HashSet<Distribution>();
|
|
103 |
Set<Distribution> result = new HashSet<Distribution>();
|
|
102 | 104 |
|
105 |
Set<Feature> features = getDistributionFeatures(); |
|
103 | 106 |
for (TaxonDescription taxonDescription : taxonDescriptions) { |
104 |
List<Distribution> result = dao.getDescriptionElements( |
|
105 |
taxonDescription, |
|
106 |
null, |
|
107 |
getDistributionFeatures(), |
|
108 |
Distribution.class, |
|
109 |
null, |
|
110 |
null, |
|
111 |
null); |
|
112 |
distributions.addAll(result); |
|
107 |
List<Distribution> distributions; |
|
108 |
if (taxonDescription.getId() > 0){ |
|
109 |
distributions = dao.getDescriptionElements( |
|
110 |
taxonDescription, |
|
111 |
null, |
|
112 |
null /*features*/, |
|
113 |
Distribution.class, |
|
114 |
null, |
|
115 |
null, |
|
116 |
null); |
|
117 |
}else{ |
|
118 |
distributions = new ArrayList<Distribution>(); |
|
119 |
for (DescriptionElementBase deb : taxonDescription.getElements()){ |
|
120 |
if (deb.isInstanceOf(Distribution.class)){ |
|
121 |
if (features == null || features.isEmpty() |
|
122 |
|| features.contains(deb.getFeature())) { |
|
123 |
distributions.add(CdmBase.deproxy(deb, Distribution.class)); |
|
124 |
} |
|
125 |
} |
|
126 |
} |
|
127 |
} |
|
128 |
result.addAll(distributions); |
|
113 | 129 |
} |
114 |
return distributions;
|
|
130 |
return result;
|
|
115 | 131 |
} |
116 | 132 |
|
117 | 133 |
/** |
Also available in: Unified diff
Fix TransientObjectException for distribution map #5357
Test do not yet work fully and are commented