Deprecate getCharacterData method in service layer
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / MicroFormatQuantitativeDescriptionBuilder.java
index 5c30795ba31391bb05c621dcc62ef0d004bbbd4d..83a68190c8a438cd6e9035932e6c8e14b6b2ba69 100644 (file)
@@ -3,7 +3,10 @@ package eu.etaxonomy.cdm.api.service;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.lang.StringUtils;
+
 import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.MeasurementUnit;
 import eu.etaxonomy.cdm.model.description.NaturalLanguageTerm;
 import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
@@ -110,12 +113,23 @@ public class MicroFormatQuantitativeDescriptionBuilder extends AbstractQuantitat
                        }
                }
                QuantitativeDescription.append(spanEnd);
-               textData.putText(QuantitativeDescription.toString(), languages.get(0)); // which language should be put here ?
+               textData.putText(languages.get(0), QuantitativeDescription.toString()); // which language should be put here ?
                textData.setFormat(TextFormat.NewInstance(null, "HTML",null )); // the data format is set (not yet real HTML)
                
                return textData;
        }
        
+       protected String buildFeature(Feature feature, boolean doItBetter){
+               if (feature==null || feature.getLabel()==null) return "";
+               else {
+                       if (doItBetter) {
+                               String betterString = StringUtils.substringBefore(feature.getLabel(), "<");
+                               return StringUtils.removeEnd(betterString, " ");
+                       }
+                       else    return feature.getLabel();
+               }
+       }
+       
        private String spanClass(String classString){
                return("<span class=\""+classString+"\">");
        }