package eu.etaxonomy.taxeditor.model;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
/**
* @param name a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
* @return a {@link java.lang.String} object.
*/
- public static String getDisplayName(TaxonNameBase name){
+ public static String getDisplayName(TaxonName name){
return name.getTitleCache();
}
+ /**
+ * <p>getDisplayName</p>
+ *
+ * @param name a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
+ * @return a {@link java.lang.String} object.
+ */
+ public static String getDisplayNameCache(TaxonBase taxon){
+ return taxon.getName().getNameCache();
+ }
/**
* <p>getDisplayName</p>
*
* @return a {@link java.lang.String} object.
*/
public static String getDisplayNameWithRef(TaxonBase taxonBase) {
- TaxonNameBase name = (TaxonNameBase) HibernateProxyHelper.deproxy(taxonBase.getName());
+ TaxonName name = HibernateProxyHelper.deproxy(taxonBase.getName());
if (name != null) {
- return name.generateFullTitle();
+ String fullTitle = name.generateFullTitle();
+ if (fullTitle != null){ //should never be null
+ fullTitle = fullTitle.replaceAll("(\\r|\\n|\\r\\n)", ""); //replaces LineBreaks, maybe we should include U+000C, U+0085, U+2028, U+2029 which are also linebreaks according to UNICODE stardard.
+ }
+ return fullTitle;
}
return "";
}