ref #7223 add in null case to ReferencePropertyDefinitions to provide all possible...
authorAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Tue, 24 Jul 2018 07:10:49 +0000 (09:10 +0200)
committerAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Tue, 24 Jul 2018 07:12:26 +0000 (09:12 +0200)
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/ReferencePropertyDefinitions.java

index 5e851894449980e86b631481b50a8ff7015505f9..4c46b5b00ebbf062cf0c40fe35a0caa70e1146f0 100644 (file)
@@ -38,6 +38,7 @@ public class ReferencePropertyDefinitions {
     private static Map<String, String> iJournal = new HashMap<>();
     private static Map<String, String> iPrintSeries = new HashMap<>();
     private static Map<String, String> iThesis = new HashMap<>();
+    private static Map<String, String> all = new HashMap<>();
 
     static {
 
@@ -110,6 +111,7 @@ public class ReferencePropertyDefinitions {
         map = iThesis;
         put(map, "school");
 
+        all = merge(iThesis, iPrintSeries, iInProceedings, iPrintedUnitBase, iVolumeReference);
 
     }
 
@@ -117,13 +119,15 @@ public class ReferencePropertyDefinitions {
      *
      * @param type
      * @return a map (Reference.fieldName -> propertyName) with the Reference class field name as key and the property name as
-     * defined in the most significant interface as value.
+     * defined in the most significant interface as value. The propertyName can be used as label in the UI
      *
      * @throws UnimplemetedCaseException
      */
     public static Map<String, String> fieldPropertyDefinition(ReferenceType type) throws UnimplemetedCaseException{
 
-
+        if(type == null){
+            return all;
+        }
         switch (type){
         case Article:
             return iArticle;
@@ -160,7 +164,7 @@ public class ReferencePropertyDefinitions {
         case WebPage:
             throw new UnimplemetedCaseException(type);
         default:
-            throw new UnimplemetedCaseException(type);
+            return all;
         }
 
     }