cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Fri, 23 Mar 2018 14:38:25 +0000 (15:38 +0100)
committerAndreas Müller <a.mueller@bgbm.org>
Fri, 23 Mar 2018 14:38:25 +0000 (15:38 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java

index fff58b292e0ce8b31e6e2e17399f40243d5edd38..1c8ab34b08f4ca007966dc014ad048f906081c7c 100644 (file)
@@ -75,7 +75,6 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  *
  * @author p.ciardelli
  * @author n.hoffmann
- * @created 02.04.2009
  */
 public class DescriptionHelper {
 
@@ -147,7 +146,7 @@ public class DescriptionHelper {
                        }
                }
                String result = cache == null ? "" : cache;
-               if (StringUtils.isNotBlank(mainElementLabel)){
+               if (isNotBlank(mainElementLabel)){
                        result = CdmUtils.concat(" ", result, "(" + mainElementLabel + ")");
                }
                return result;
@@ -286,10 +285,10 @@ public class DescriptionHelper {
                if (taxonName != null){
                        taxonStr = taxonName.getTitleCache();
                }
-               if (StringUtils.isBlank(taxonStr) && taxon != null){
+               if (isBlank(taxonStr) && taxon != null){
                        taxonStr = taxon.getTitleCache();
                }
-               if (StringUtils.isBlank(taxonStr)){
+               if (isBlank(taxonStr)){
                        taxonStr = "no or unlabled taxon";
                }
 
@@ -299,7 +298,7 @@ public class DescriptionHelper {
                String unitStr;
                if (unit != null){
                        unitStr = unit.getTitleCache();
-                       if (StringUtils.isBlank(unitStr)){
+                       if (isBlank(unitStr)){
                                unitStr = "Unlabled unit";
                        }
                }else{
@@ -317,7 +316,7 @@ public class DescriptionHelper {
                if (classification != null){
                        String classificationStr = classification.getName() == null ? "" : classification.getName().getText();
                        result = CdmUtils.concat("" , result, classificationStr);
-                       if (StringUtils.isBlank(result)){
+                       if (isBlank(result)){
                                result = classification.toString();
                        }
                }
@@ -362,17 +361,17 @@ public class DescriptionHelper {
                        if (typeRepr != null){
                                typeLabel = typeRepr.getAbbreviatedLabel();
                        }
-                       if (StringUtils.isBlank(typeLabel) && typeRepr != null){
+                       if (isBlank(typeLabel) && typeRepr != null){
                                typeLabel = typeRepr.getLabel();
                        }
-                       if (StringUtils.isBlank(typeLabel) ){
+                       if (isBlank(typeLabel) ){
                                typeLabel = status.getSymbol();
                        }
-                       if (StringUtils.isBlank(typeLabel)){
+                       if (isBlank(typeLabel)){
                                typeLabel = status.getTitleCache();
                        }
                }
-               if (StringUtils.isBlank(typeLabel)){
+               if (isBlank(typeLabel)){
                        typeLabel = "->";
                }
                String fromString = "";
@@ -417,17 +416,17 @@ public class DescriptionHelper {
                        if (typeRepr != null){
                                typeLabel = typeRepr.getAbbreviatedLabel();
                        }
-                       if (StringUtils.isBlank(typeLabel) && typeRepr != null){
+                       if (isBlank(typeLabel) && typeRepr != null){
                                typeLabel = typeRepr.getLabel();
                        }
-                       if (StringUtils.isBlank(typeLabel) ){
+                       if (isBlank(typeLabel) ){
                                typeLabel = type.getSymbol();
                        }
-                       if (StringUtils.isBlank(typeLabel)){
+                       if (isBlank(typeLabel)){
                                typeLabel = type.getTitleCache();
                        }
                }
-               if (StringUtils.isBlank(typeLabel)){
+               if (isBlank(typeLabel)){
                        typeLabel = "->";
                }
                String result = CdmUtils.concat(" ", new String[]{from == null ? null : from.getTitleCache(),
@@ -441,7 +440,7 @@ public class DescriptionHelper {
                for (TaxonName tnb : hg.getTypifiedNames()){
                        result = CdmUtils.concat(", ", result, tnb.getTitleCache());
                }
-               if (StringUtils.isBlank(result)){
+               if (isBlank(result)){
                        result = "No typified names";
                }
                return result;
@@ -578,7 +577,7 @@ public class DescriptionHelper {
                                        text += " [ " + source.getNameUsedInSource().getTitleCache() + " ]";
                                }
                        }
-                       if(CdmUtils.isEmpty(text)){
+                       if(isBlank(text)){
                                text = "No sources provided";
                        }
                }else{
@@ -586,7 +585,7 @@ public class DescriptionHelper {
                        LanguageString languageString = element.getPreferredLanguageString(languages);
                        text = languageString != null ? languageString.getText() : null;
                }
-               return CdmUtils.isEmpty(text) ? "No text provided" : text;
+               return isBlank(text) ? "No text provided" : text;
        }
 
        /**
@@ -703,4 +702,12 @@ public class DescriptionHelper {
                        return element.toString();
                }
        }
+       
+       private static boolean isNotBlank(String str){
+               return StringUtils.isNotBlank(str);
+       }
+       
+       private static boolean isBlank(String str){
+               return StringUtils.isBlank(str);
+       }
 }