protected static Map<UUID, String> statusSymbols;
+
+
+ protected String areaPreTag = "<b>";
+
+ protected String areaPostTag = "</b>";
+
+
+
/**
* @param status
* @return
return symbol;
}
+
+ public String getAreaPreTag() {
+ return areaPreTag;
+ }
+
+ public void setAreaPreTag(String areaPreTag) {
+ this.areaPreTag = areaPreTag;
+ }
+
+ public String getAreaPostTag() {
+ return areaPostTag;
+ }
+
+ public void setAreaPostTag(String areaPostTag) {
+ this.areaPostTag = areaPostTag;
+ }
+
+
+
}
import org.apache.log4j.Logger;
import eu.etaxonomy.cdm.api.service.dto.CondensedDistribution;
+import eu.etaxonomy.cdm.common.UTF8;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.Language;
private static Set<UUID> foreignStatusUuids;
+ private UUID uuidInternalArea = UUID.fromString("d0144a6e-0e17-4a1d-bce5-d464a2aa7229"); //Cuba
+
+ private String internalAreaSeparator = UTF8.EN_DASH.toString() + " ";
+
+
// these status uuids are special for EuroPlusMed and might also be used
private final static UUID REPORTED_IN_ERROR_UUID = UUID.fromString("38604788-cf05-4607-b155-86db456f7680");
areaList.add(0, (NamedArea)CdmBase.deproxy(dtb));
}
+
+ boolean isFirstAfterInternalArea = false;
for (NamedArea area : areaList){
if (area.getPartOf() != null){
continue; //subarea are handled later
}
+
StringBuilder areaStatusString = new StringBuilder();
+
+
+
Distribution distribution = getDistribution(area, filteredDistributions);
if (distribution == null){
continue;
}
+ if (area.getUuid().equals(uuidInternalArea)){
+ isFirstAfterInternalArea = true;
+ }else if(isFirstAfterInternalArea && !area.getUuid().equals(uuidInternalArea)){
+ areaStatusString.append(internalAreaSeparator);
+ isFirstAfterInternalArea = false;
+ }
+
PresenceAbsenceTerm status = distribution.getStatus();
String statusSymbol = statusSymbol(status);
// areaStatusString.append(')');
}
+
// if(isForeignStatus(status)) {
// condensedDistribution.addForeignDistributionItem(status, areaStatusString.toString(), areaLabel);
// } else {
* @return
*/
private String makeAreaLabel(List<Language> langs, NamedArea area) {
- return area.getIdInVocabulary() != null ? area.getIdInVocabulary() :area.getPreferredRepresentation(langs).getAbbreviatedLabel();
+ String result = area.getIdInVocabulary() != null ? area.getIdInVocabulary() :area.getPreferredRepresentation(langs).getAbbreviatedLabel();
+ return areaPreTag + result + areaPostTag;
+ }
+
+
+
+ public String getInternalAreaSeparator() {
+ return internalAreaSeparator;
+ }
+
+ public void setInternalAreaSeparator(String internalAreaSeparator) {
+ this.internalAreaSeparator = internalAreaSeparator;
}
/**
}
}
+
+
}
@Test
public void testCreateCondensedDistribution() {
FloraCubaCondensedDistributionComposer composer = new FloraCubaCondensedDistributionComposer();
+ composer.setAreaPreTag("");
+ composer.setAreaPostTag("");
Set<Distribution> filteredDistributions = new HashSet<Distribution>();
filteredDistributions.add(Distribution.NewInstance(cuba, PresenceAbsenceTerm.NATURALISED()));
CondensedDistribution condensedDistribution = composer.createCondensedDistribution(filteredDistributions, null);
String condensedString = condensedDistribution.toString();
- Assert.assertEquals("Condensed string for Cuba differs", "nCu((c)CuE(nHo)) Bah ?VM ", condensedString);
+ Assert.assertEquals("Condensed string for Cuba differs", "nCu((c)CuE(nHo)) "+composer.getInternalAreaSeparator() +"Bah ?VM ", condensedString);
//TODO work in progress
//Cuba
label = "Cuba";
abbrev = "Cu";
- UUID uuid = UUID.randomUUID();
+ UUID uuid = UUID.fromString("d0144a6e-0e17-4a1d-bce5-d464a2aa7229");
cuba = getNamedArea(uuid, label, abbrev, cubaAreasVocabualary);
//Western Cuba