From: Andreas Müller Date: Fri, 1 Apr 2022 12:30:46 +0000 (+0200) Subject: term creation with language (cont.) X-Git-Tag: 5.31.0^2~9 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/commitdiff_plain/45f561f867bed3de4c352b79ead1a69e7ceeea42 term creation with language (cont.) - remove deprecated method and keep old factory methods - remove unnessary second constructor --- diff --git a/cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/geo/CondensedDistributionComposerFloraCubaTest.java b/cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/geo/CondensedDistributionComposerFloraCubaTest.java index d3ed91c197..8e6903718c 100644 --- a/cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/geo/CondensedDistributionComposerFloraCubaTest.java +++ b/cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/geo/CondensedDistributionComposerFloraCubaTest.java @@ -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 diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/OrderedTermVocabulary.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/OrderedTermVocabulary.java index 2b86ffa341..63c178e359 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/OrderedTermVocabulary.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/OrderedTermVocabulary.java @@ -59,27 +59,20 @@ public class OrderedTermVocabulary 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 null - * @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 null + */ public static > OrderedTermVocabulary NewOrderedInstance(TermType type, Class clazz, String description, String label, String labelAbbrev, URI termSourceUri){ - return new OrderedTermVocabulary(type, description, label, labelAbbrev, termSourceUri); + return new OrderedTermVocabulary(type, description, label, labelAbbrev, termSourceUri, null); } - //************************ CONSTRUCTOR *****************************************************/ //for hibernate use only @@ -88,33 +81,13 @@ public class OrderedTermVocabulary 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 **************************************/ diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/TermCollection.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/TermCollection.java index 231c4db2be..afe7c83bd4 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/TermCollection.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/term/TermCollection.java @@ -77,8 +77,6 @@ public abstract class TermCollection public static TermVocabulary NewInstance(TermType type){ return new TermVocabulary(type); } - - public static > TermVocabulary NewInstance(TermType type, Class clazz){ return new TermVocabulary(type); @@ -107,15 +105,17 @@ public class TermVocabulary */ @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 > TermVocabulary NewInstance(TermType type, Class clazz, String description, String label, String abbrev, URI termSourceUri){ - return new TermVocabulary(type, description, label, abbrev, termSourceUri); + public static > TermVocabulary NewInstance(TermType type, Class clazz, + String description, String label, String abbrev, URI termSourceUri){ + return new TermVocabulary(type, description, label, abbrev, termSourceUri, null); } - - public static > TermVocabulary NewInstance(TermType type, Class clazz, String description, String label, String abbrev, URI termSourceUri, Language lang){ - return new TermVocabulary(type, description, label, abbrev, termSourceUri, lang); + + public static > TermVocabulary NewInstance(TermType type, Class clazz, + String description, String label, String abbrev, URI termSourceUri, Language language){ + return new TermVocabulary(type, description, label, abbrev, termSourceUri, language); } @@ -130,18 +130,12 @@ public class TermVocabulary 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 newTermSet(){ return new HashSet<>(); } diff --git a/cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/term/OrderedTermVocabularyTest.java b/cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/term/OrderedTermVocabularyTest.java index bcfef48d4c..b03ee27887 100644 --- a/cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/term/OrderedTermVocabularyTest.java +++ b/cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/term/OrderedTermVocabularyTest.java @@ -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()); } diff --git a/cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/term/TermVocabularyTest.java b/cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/term/TermVocabularyTest.java index 911785b368..bc3758758c 100644 --- a/cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/term/TermVocabularyTest.java +++ b/cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/term/TermVocabularyTest.java @@ -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()); }