term creation with language (cont.)
authorAndreas Müller <a.mueller@bgbm.org>
Fri, 1 Apr 2022 12:30:46 +0000 (14:30 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Fri, 1 Apr 2022 12:30:46 +0000 (14:30 +0200)
- remove deprecated method and keep old factory methods
- remove unnessary second constructor

cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/geo/CondensedDistributionComposerFloraCubaTest.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/OrderedTermVocabulary.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/TermCollection.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/TermVocabulary.java
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/term/OrderedTermVocabularyTest.java
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/term/TermVocabularyTest.java

index d3ed91c19748fe0fcb88acbfc4a59542c653968f..8e6903718cea799f451956b4c05f99f640d7d406 100644 (file)
@@ -191,7 +191,7 @@ public class CondensedDistributionComposerFloraCubaTest extends TermTestBase {
         UUID cubaAreasVocabularyUuid = UUID.fromString("c81e3c7b-3c01-47d1-87cf-388de4b1908c");
         String label = "Cuba Areas";
         String abbrev = null;
-        cubaAreasVocabualary = OrderedTermVocabulary.NewInstance(TermType.NamedArea, label, label, abbrev, null);
+        cubaAreasVocabualary = OrderedTermVocabulary.NewOrderedInstance(TermType.NamedArea, NamedArea.class, label, label, abbrev, null);
         cubaAreasVocabualary.setUuid(cubaAreasVocabularyUuid);
 
         //Cuba
index 2b86ffa34183c61e031d5b43007b01646fb309e8..63c178e359fe169dd048a61a976051c7d5147291 100644 (file)
@@ -59,27 +59,20 @@ public class OrderedTermVocabulary<T extends OrderedTermBase>
                return new OrderedTermVocabulary(type);
        }
 
-
        /**
-        * @param type the {@link TermType term type}, must be the same as for all included terms
-        * @param description the description of this vocabulary
-        * @param label
-        * @param labelAbbrev
-        * @param termSourceUri
-        * @return
-        * @throws NullPointerException if type is <code>null</code>
-        * @deprecated use {@link #NewOrderedInstance(TermType, Class, String, String, String, URI)} instead
-        */
-       @Deprecated
-       public static OrderedTermVocabulary NewInstance(TermType type, String description, String label, String labelAbbrev, URI termSourceUri, Language lang){
-               return new OrderedTermVocabulary(type, description, label, labelAbbrev, termSourceUri, lang);
-       }
-
+     * @param type the {@link TermType term type}, must be the same as for all included terms
+     * @param class the parameter is only used for correct generics handling
+     * @param description the description of this vocabulary
+     * @param label
+     * @param labelAbbrev
+     * @param termSourceUri
+     * @return
+     * @throws NullPointerException if type is <code>null</code>
+     */
     public static <T extends OrderedTermBase<T>> OrderedTermVocabulary<T> NewOrderedInstance(TermType type, Class<T> clazz, String description, String label, String labelAbbrev, URI termSourceUri){
-        return new OrderedTermVocabulary<T>(type, description, label, labelAbbrev, termSourceUri);
+        return new OrderedTermVocabulary<T>(type, description, label, labelAbbrev, termSourceUri, null);
     }
 
-
 //************************ CONSTRUCTOR *****************************************************/
 
        //for hibernate use only
@@ -88,33 +81,13 @@ public class OrderedTermVocabulary<T extends OrderedTermBase>
                super();
        }
 
-       /**
-        * @param term
-        * @param label
-        * @param termSourceUri
-        */
        protected OrderedTermVocabulary(TermType type) {
                super(type);
        }
-       
 
-       /**
-        * @param term
-        * @param label
-        * @param termSourceUri
-        */
-       protected OrderedTermVocabulary(TermType type, String term, String label, String labelAbbrev, URI termSourceUri) {
-               super(type, term, label, labelAbbrev, termSourceUri);
+       protected OrderedTermVocabulary(TermType type, String term, String label, String labelAbbrev, URI termSourceUri, Language language) {
+               super(type, term, label, labelAbbrev, termSourceUri, language);
        }
-       /**
-        * @param term
-        * @param label
-        * @param termSourceUri
-        */
-       protected OrderedTermVocabulary(TermType type, String term, String label, String labelAbbrev, URI termSourceUri, Language lang) {
-               super(type, term, label, labelAbbrev, termSourceUri);
-       }
-
 
 //************************* METHODS **************************************/
 
index 231c4db2beab9ebf912ed28dfc168e2724f88119..afe7c83bd4728cd6e289c397fe10ef276f8e1281 100644 (file)
@@ -77,8 +77,6 @@ public abstract class TermCollection<TERM extends DefinedTermBase, REL extends T
     protected TermCollection(TermType type){
         super(type);
     }
-    
-    
 
     protected TermCollection(TermType type, String term, String label, String labelAbbrev, Language lang) {
         super(type, term, label, labelAbbrev, lang);
index 894c8264fc6b7b94f75bac86a3b1a9fe8cca5c6e..2873e8fe05efe4bc1fbd5d863d593df906400120 100644 (file)
@@ -95,8 +95,6 @@ public class TermVocabulary<T extends DefinedTermBase>
        public static TermVocabulary NewInstance(TermType type){
                return new TermVocabulary(type);
        }
-       
-       
 
        public static <T extends DefinedTermBase<T>> TermVocabulary<T> NewInstance(TermType type, Class<T> clazz){
                return new TermVocabulary<T>(type);
@@ -107,15 +105,17 @@ public class TermVocabulary<T extends DefinedTermBase>
         */
        @Deprecated
        public static TermVocabulary NewInstance(TermType type, String description, String label, String abbrev, URI termSourceUri){
-               return new TermVocabulary(type, description, label, abbrev, termSourceUri);
+               return new TermVocabulary(type, description, label, abbrev, termSourceUri, null);
        }
 
-    public static <T extends DefinedTermBase<T>> TermVocabulary<T> NewInstance(TermType type, Class<T> clazz, String description, String label, String abbrev, URI termSourceUri){
-        return new TermVocabulary<T>(type, description, label, abbrev, termSourceUri);
+    public static <T extends DefinedTermBase<T>> TermVocabulary<T> NewInstance(TermType type, Class<T> clazz,
+            String description, String label, String abbrev, URI termSourceUri){
+        return new TermVocabulary<T>(type, description, label, abbrev, termSourceUri, null);
     }
-    
-    public static <T extends DefinedTermBase<T>> TermVocabulary<T> NewInstance(TermType type, Class<T> clazz, String description, String label, String abbrev, URI termSourceUri, Language lang){
-        return new TermVocabulary<T>(type, description, label, abbrev, termSourceUri, lang);
+
+    public static <T extends DefinedTermBase<T>> TermVocabulary<T> NewInstance(TermType type, Class<T> clazz,
+            String description, String label, String abbrev, URI termSourceUri, Language language){
+        return new TermVocabulary<T>(type, description, label, abbrev, termSourceUri, language);
     }
 
 
@@ -130,18 +130,12 @@ public class TermVocabulary<T extends DefinedTermBase>
        protected TermVocabulary(TermType type) {
                super(type);
        }
-       
-       protected TermVocabulary(TermType type, String term, String label, String labelAbbrev, URI termSourceUri) {
-               super(type, term, label, labelAbbrev);
-               setTermSourceUri(termSourceUri);
-       }
 
-       protected TermVocabulary(TermType type, String term, String label, String labelAbbrev, URI termSourceUri, Language lang) {
-               super(type, term, label, labelAbbrev, lang);
+       protected TermVocabulary(TermType type, String term, String label, String labelAbbrev, URI termSourceUri, Language language) {
+               super(type, term, label, labelAbbrev, language);
                setTermSourceUri(termSourceUri);
        }
 
-
        protected Set<T> newTermSet(){
            return new HashSet<>();
        }
index bcfef48d4c969a9c11b9567a294b824362d04aec..b03ee27887fa87c7b8ba6f231ac0958b99090054 100644 (file)
@@ -121,7 +121,7 @@ public class OrderedTermVocabularyTest extends EntityTestBase {
 
        @Test
        public final void testOrderedTermVocabularyStringStringString() {
-               oVoc2 = new OrderedTermVocabulary<>(TermType.Unknown, "term", "label", null, URI.create("http://term.Source.Uri"));
+               oVoc2 = new OrderedTermVocabulary<>(TermType.Unknown, "term", "label", null, URI.create("http://term.Source.Uri"), null);
                assertEquals("label", oVoc2.getLabel());
        }
 
index 911785b368b8462a62e374c04206ed0fe6bf1cb9..bc3758758cead7636366017d861fc2e45c5e3d71 100644 (file)
@@ -101,7 +101,7 @@ public class TermVocabularyTest extends EntityTestBase {
 
        @Test
        public final void testTermVocabularyStringStringString() {
-               voc2 = new TermVocabulary<>(TermType.Unknown, "term", "label", null, URI.create("http://term.Source.Uri"));
+               voc2 = new TermVocabulary<>(TermType.Unknown, "term", "label", null, URI.create("http://term.Source.Uri"), null);
                assertEquals("label", voc2.getLabel());
        }
 
@@ -180,7 +180,7 @@ public class TermVocabularyTest extends EntityTestBase {
        @Test
        public final void testGetTermSourceUri() {
                assertEquals(null, voc1.getTermSourceUri());
-               voc2 = new TermVocabulary<>(TermType.Unknown,"term", "label", null, URI.create("http://term.Source.Uri"));
+               voc2 = new TermVocabulary<>(TermType.Unknown,"term", "label", null, URI.create("http://term.Source.Uri"), null);
                assertEquals("http://term.Source.Uri", voc2.getTermSourceUri().toString());
        }