Merge branch 'develop' into termSearch
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / model / TaxonRelationshipTypeInverseContainer.java
index 08dc15b31bfcc51fbee66b146c4898f38b058de2..23e5c66665b098d825c6072de785d0c79b2bb5f2 100644 (file)
@@ -22,9 +22,14 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  */
 public class TaxonRelationshipTypeInverseContainer extends DefinedTermBase<DefinedTermBase> {
        
+       /**
+        * 
+        */
+       private static final long serialVersionUID = 7225140304186547675L;
        private boolean inverse;
        private TaxonRelationshipType type;
        
+       
        /**
         * 
         * @param sourceTaxon
@@ -69,11 +74,31 @@ public class TaxonRelationshipTypeInverseContainer extends DefinedTermBase<Defin
                return inverse;
        }
 
+       /**
+        * returns the representation for the given language, when there is no representation for this language available, the english version is returned.
+        * @param language
+        * @return representation
+        * 
+        */
        public Representation getRepresentation(Language language){
-               return inverse ? type.getInverseRepresentation(language) : type.getRepresentation(language);
+               Representation result;
+               result = inverse ? type.getInverseRepresentation(language) : type.getRepresentation(language);
+               if (result == null){
+                       result = inverse ? 
+                                       type.getInverseRepresentation(Language.getLanguageFromUuid(Language.uuidEnglish)) : 
+                                               type.getRepresentation(Language.getLanguageFromUuid(Language.uuidEnglish));
+               }
+               return result;
        }
        
+       
+       /**
+        * returns the label of the TaxonRelationshipType for a given language, if the representation of the language is not available the english representation is returned.
+        * @param language
+        * @return label
+        */
        public String getLabel(Language language){
+               
                return getRepresentation(language).getLabel();
        }
        
@@ -82,7 +107,7 @@ public class TaxonRelationshipTypeInverseContainer extends DefinedTermBase<Defin
        }
        
        public String getAbbreviatedLabel(){
-               return getRepresentation(Language.ENGLISH()).getAbbreviatedLabel();
+               return getRepresentation(Language.getLanguageFromUuid(Language.uuidEnglish)).getAbbreviatedLabel();
        }
        
        public void setInverse(boolean inverse) {