Revision 6b45c577
Added by Katja Luther almost 8 years ago
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/FloraCubaCondensedDistributionComposer.java | ||
---|---|---|
21 | 21 |
import org.apache.log4j.Logger; |
22 | 22 |
|
23 | 23 |
import eu.etaxonomy.cdm.api.service.dto.CondensedDistribution; |
24 |
import eu.etaxonomy.cdm.common.UTF8; |
|
24 | 25 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
25 | 26 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
26 | 27 |
import eu.etaxonomy.cdm.model.common.Language; |
... | ... | |
41 | 42 |
|
42 | 43 |
private static Set<UUID> foreignStatusUuids; |
43 | 44 |
|
45 |
private UUID uuidInternalArea = UUID.fromString("d0144a6e-0e17-4a1d-bce5-d464a2aa7229"); //Cuba |
|
46 |
|
|
47 |
private String internalAreaSeparator = UTF8.EN_DASH.toString() + " "; |
|
48 |
|
|
49 |
|
|
44 | 50 |
// these status uuids are special for EuroPlusMed and might also be used |
45 | 51 |
private final static UUID REPORTED_IN_ERROR_UUID = UUID.fromString("38604788-cf05-4607-b155-86db456f7680"); |
46 | 52 |
|
... | ... | |
78 | 84 |
areaList.add(0, (NamedArea)CdmBase.deproxy(dtb)); |
79 | 85 |
} |
80 | 86 |
|
87 |
|
|
88 |
boolean isFirstAfterInternalArea = false; |
|
81 | 89 |
for (NamedArea area : areaList){ |
82 | 90 |
|
83 | 91 |
if (area.getPartOf() != null){ |
84 | 92 |
continue; //subarea are handled later |
85 | 93 |
} |
94 |
|
|
86 | 95 |
StringBuilder areaStatusString = new StringBuilder(); |
96 |
|
|
97 |
|
|
98 |
|
|
87 | 99 |
Distribution distribution = getDistribution(area, filteredDistributions); |
88 | 100 |
if (distribution == null){ |
89 | 101 |
continue; |
90 | 102 |
} |
91 | 103 |
|
104 |
if (area.getUuid().equals(uuidInternalArea)){ |
|
105 |
isFirstAfterInternalArea = true; |
|
106 |
}else if(isFirstAfterInternalArea && !area.getUuid().equals(uuidInternalArea)){ |
|
107 |
areaStatusString.append(internalAreaSeparator); |
|
108 |
isFirstAfterInternalArea = false; |
|
109 |
} |
|
110 |
|
|
92 | 111 |
PresenceAbsenceTerm status = distribution.getStatus(); |
93 | 112 |
|
94 | 113 |
String statusSymbol = statusSymbol(status); |
... | ... | |
103 | 122 |
// areaStatusString.append(')'); |
104 | 123 |
} |
105 | 124 |
|
125 |
|
|
106 | 126 |
// if(isForeignStatus(status)) { |
107 | 127 |
// condensedDistribution.addForeignDistributionItem(status, areaStatusString.toString(), areaLabel); |
108 | 128 |
// } else { |
... | ... | |
199 | 219 |
* @return |
200 | 220 |
*/ |
201 | 221 |
private String makeAreaLabel(List<Language> langs, NamedArea area) { |
202 |
return area.getIdInVocabulary() != null ? area.getIdInVocabulary() :area.getPreferredRepresentation(langs).getAbbreviatedLabel(); |
|
222 |
String result = area.getIdInVocabulary() != null ? area.getIdInVocabulary() :area.getPreferredRepresentation(langs).getAbbreviatedLabel(); |
|
223 |
return areaPreTag + result + areaPostTag; |
|
224 |
} |
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
public String getInternalAreaSeparator() { |
|
229 |
return internalAreaSeparator; |
|
230 |
} |
|
231 |
|
|
232 |
public void setInternalAreaSeparator(String internalAreaSeparator) { |
|
233 |
this.internalAreaSeparator = internalAreaSeparator; |
|
203 | 234 |
} |
204 | 235 |
|
205 | 236 |
/** |
... | ... | |
257 | 288 |
} |
258 | 289 |
} |
259 | 290 |
|
291 |
|
|
292 |
|
|
260 | 293 |
} |
Also available in: Unified diff
fix CubaCondensedStringComposer