Revision da9240c3
Added by Andreas Müller almost 8 years ago
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/FloraCubaCondensedDistributionComposer.java | ||
---|---|---|
14 | 14 |
import java.util.HashMap; |
15 | 15 |
import java.util.HashSet; |
16 | 16 |
import java.util.List; |
17 |
import java.util.Map; |
|
18 | 17 |
import java.util.Set; |
19 | 18 |
import java.util.UUID; |
20 | 19 |
|
... | ... | |
26 | 25 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
27 | 26 |
import eu.etaxonomy.cdm.model.common.Language; |
28 | 27 |
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary; |
29 |
import eu.etaxonomy.cdm.model.common.Representation; |
|
30 | 28 |
import eu.etaxonomy.cdm.model.description.Distribution; |
31 | 29 |
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm; |
32 | 30 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
... | ... | |
36 | 34 |
* @date Apr 05, 2016 |
37 | 35 |
* |
38 | 36 |
*/ |
39 |
public class FloraCubaCondensedDistributionComposer implements ICondensedDistributionComposer {
|
|
37 |
public class FloraCubaCondensedDistributionComposer extends CondensedDistributionComposerBase {
|
|
40 | 38 |
|
41 | 39 |
@SuppressWarnings("unused") |
42 | 40 |
private static final Logger logger = Logger.getLogger(FloraCubaCondensedDistributionComposer.class); |
43 | 41 |
|
44 |
private static Map<UUID, String> statusSymbols; |
|
45 |
|
|
46 | 42 |
private static Set<UUID> foreignStatusUuids; |
47 | 43 |
|
48 | 44 |
// these status uuids are special for EuroPlusMed and might also be used |
... | ... | |
66 | 62 |
@Override |
67 | 63 |
public CondensedDistribution createCondensedDistribution(Collection<Distribution> filteredDistributions, |
68 | 64 |
List<Language> langs) { |
65 |
|
|
69 | 66 |
CondensedDistribution condensedDistribution = new CondensedDistribution(); |
70 | 67 |
|
71 | 68 |
//empty |
... | ... | |
137 | 134 |
return null; |
138 | 135 |
} |
139 | 136 |
|
140 |
/** |
|
141 |
* @param status |
|
142 |
* @return |
|
143 |
*/ |
|
144 |
private String statusSymbol(PresenceAbsenceTerm status) { |
|
145 |
if(status == null) { |
|
146 |
return ""; |
|
147 |
} |
|
148 |
String symbol = statusSymbols.get(status.getUuid()); |
|
149 |
if(symbol != null) { |
|
150 |
return symbol; |
|
151 |
}else if (status.getSymbol() != null){ |
|
152 |
return status.getSymbol(); |
|
153 |
}else if (status.getIdInVocabulary() != null){ |
|
154 |
return status.getIdInVocabulary(); |
|
155 |
}else { |
|
156 |
Representation r = status.getPreferredRepresentation((Language)null); |
|
157 |
if (r != null){ |
|
158 |
String abbrevLabel = r.getAbbreviatedLabel(); |
|
159 |
if (abbrevLabel != null){ |
|
160 |
return abbrevLabel; |
|
161 |
} |
|
162 |
} |
|
163 |
} |
|
164 |
|
|
165 |
return "n.a."; |
|
166 |
} |
|
167 | 137 |
|
168 | 138 |
// private boolean isForeignStatus(PresenceAbsenceTerm status) { |
169 | 139 |
// return foreignStatusUuids.contains(status.getUuid()); |
Also available in: Unified diff
First step to combine Distribution Composers