cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Mon, 3 May 2021 07:07:17 +0000 (09:07 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Mon, 3 May 2021 07:07:17 +0000 (09:07 +0200)
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/metadata/NamedAreaSearchField.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/metadata/NodeOrderEnum.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/metadata/PublishEnum.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/metadata/SecReferenceHandlingEnum.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/metadata/TermComboEnum.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/metadata/TermDisplayEnum.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/metadata/TermOrder.java
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/hibernate/term/DefinedTermDaoImplTest.java

index 6fe95c86a4de0aef033458ada369708ee7718edb..032b88de2dbd55d95268a8fc81833afbba6cfbc7 100755 (executable)
@@ -13,6 +13,7 @@ package eu.etaxonomy.cdm.model.metadata;
  * @since 12.09.2019
  */
 public enum NamedAreaSearchField implements IKeyLabel{
+
     IDInVocabulary("idInVocabulary", "ID in vocabulary"),
     Symbol1("symbol1", "First symbol"),
     Symbol2("symbol2", "Second symbol"),
@@ -26,7 +27,6 @@ public enum NamedAreaSearchField implements IKeyLabel{
         this.key = key;
     }
 
-
     @Override
     public String getLabel() {
        return label;
@@ -45,5 +45,4 @@ public enum NamedAreaSearchField implements IKeyLabel{
         }
         throw new IllegalArgumentException();
     }
-
-}
+}
\ No newline at end of file
index eed64d650a151cda9263461d1209a404eba11c23..7c7f174d79c942e03b810789f588c5d2cee5f326 100755 (executable)
@@ -15,13 +15,13 @@ package eu.etaxonomy.cdm.model.metadata;
  *
  */
 public enum NodeOrderEnum implements IKeyLabel{
+
     AlphabeticalOrder("AlphabeticalOrder", "Alphabetical"), //$NON-NLS-1$
     NaturalOrder("NaturalOrder", "Natural"), //$NON-NLS-1$
     RankAndNameOrder("RankAndNameOrder", "Rank and Name"); //$NON-NLS-1$
 
-
-    String label;
-    String key;
+    private String label;
+    private String key;
 
     private NodeOrderEnum(String key, String label){
         this.label = label;
@@ -42,4 +42,4 @@ public enum NodeOrderEnum implements IKeyLabel{
     public String toString(){
         return key;
     }
-}
+}
\ No newline at end of file
index b821c1ee45f4038e3b70e5afd6700f49c8d6355b..0caf78de19bee65646d5082f6fa42dfa42875697 100755 (executable)
@@ -19,9 +19,8 @@ public enum PublishEnum implements IKeyLabel{
     NotPublish("NotPublish", "Don't publish"),
     InheritFromParent("InheritFromParent", "Inherit from parent");
 
-
-    String label;
-    String key;
+    private String label;
+    private String key;
 
     private PublishEnum(String key, String label){
         this.label = label;
index 1a63b63a5d1b20daca8d7a5ed718aaf7de694113..37d9a29132dbf22dfd0c57454e80ad0f969928f2 100755 (executable)
@@ -21,15 +21,14 @@ public enum SecReferenceHandlingEnum implements IKeyLabel {
     UseNewParentSec("UseNewParentSec", "Always use new parent sec");
 //    UseOldParentSec("UseOldParentSec", "Always use old parent sec");
 
-    String label;
-    String key;
+    private String label;
+    private String key;
 
     private SecReferenceHandlingEnum(String key, String label){
         this.label = label;
         this.key = key;
     }
 
-
     @Override
     public String getLabel() {
         return label;
@@ -39,5 +38,4 @@ public enum SecReferenceHandlingEnum implements IKeyLabel {
     public String getKey() {
         return key;
     }
-
-}
+}
\ No newline at end of file
index f17fa3e715eca0fdf8dbbd60b63ea1e667edeabb..2f8df6e8884e4150e56ede5dca04556aefcc26de 100755 (executable)
@@ -11,7 +11,6 @@ package eu.etaxonomy.cdm.model.metadata;
 /**
  * @author k.luther
  * @since 03.06.2019
- *
  */
 public enum TermComboEnum implements IKeyLabel{
 
@@ -21,8 +20,8 @@ public enum TermComboEnum implements IKeyLabel{
     Title("Label", "Label"),
     TermDisplayPlusTitle("TermDisplay+Label", "[Term Display] Label");
 
-    String label;
-    String key;
+    private String label;
+    private String key;
 
     private TermComboEnum(String key, String label){
         this.label = label;
index 2eed3ce5be8f290e9c8c4f86195d1bf291702fff..9fb26f6a2e6a9270b51f955b2142052b37416dbc 100755 (executable)
@@ -19,8 +19,8 @@ public enum TermDisplayEnum implements IKeyLabel{
     Symbol2("Symbol2", "Symbol 2"),
     Title("Label", "Label");
 
-    String label;
-    String key;
+    private String label;
+    private String key;
 
     private TermDisplayEnum(String key, String label){
         this.label = label;
index 889a9a16dc214c39077da3620104ba9d86c56c4f..858f9e5f8a57b68fa003e250620bb60861440903 100755 (executable)
@@ -19,9 +19,8 @@ public enum TermOrder implements IKeyLabel{
     Label("Label", "Label"),
     Natural("Natural", "Natural");
 
-
-    String label;
-    String key;
+    private String label;
+    private String key;
 
     private TermOrder(String key, String label){
         this.label = label;
index a528fe3174088f7dfbafea6497023e1bf07f652e..75b1bca2be770194d8db7e8fc2d6398657d21009 100644 (file)
@@ -271,54 +271,52 @@ public class DefinedTermDaoImplTest extends CdmTransactionalIntegrationTest {
          Assert.assertEquals("German Label should be the new title cache again as English representation is not there anymore", "Deutscher Modifier", newModifier.getTitleCache());
     }
 
-        @Test
-        @DataSets({
+       @Test
+       @DataSets({
                @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="/eu/etaxonomy/cdm/database/ClearDB_with_Terms_DataSet.xml"),
                @DataSet("/eu/etaxonomy/cdm/database/TermsDataSet-with_auditing_info.xml")}
-           )
-        public void testListByTermType(){
-
-            TermType termType = TermType.Modifier;
-
-            List<DefinedTermBase> existingList = this.dao.listByTermType(termType, null, null, null, null);
-            int nExisting = existingList.size();
-            int nExistingTerms = this.dao.list(DefinedTerm.class, null, null, null, null).size();
-
-
-            //prepare
-         @SuppressWarnings("unchecked")
-         TermVocabulary<DefinedTerm> newVoc = TermVocabulary.NewInstance(termType);
-         UUID vocUuid = UUID.fromString("6ced4c45-9c1b-4053-9dc3-6b8c51d286ed");
-         newVoc.setUuid(vocUuid);
-         UUID termUuid = UUID.fromString("2ab69720-c06c-4cfc-8928-d2ae6f1e4a48");
-         DefinedTerm newModifier = DefinedTerm.NewModifierInstance("Test Modifier Description", "English Modifier", "TM");
-         newModifier.setUuid(termUuid);
-         newVoc.addTerm(newModifier);
-         vocabularyDao.save(newVoc);
-         this.commitAndStartNewTransaction(null);
-
-         //assert 1 more
-         int nNow = this.dao.listByTermType(termType, null, null, null, null).size();
-         Assert.assertEquals("There should be exactly 1 more term now", nExisting + 1 , nNow);
-         int nTermsNow = this.dao.list(DefinedTerm.class, null, null, null, null).size();
-         Assert.assertEquals("There should be exactly 1 more term now", nExistingTerms + 1 , nTermsNow);
-         this.commitAndStartNewTransaction(null);
-
-         //Add German representation
-         Representation newRepresentation = Representation.NewInstance("Beschreibung", "Deutscher Modifier", "Abk.", Language.GERMAN());
-         newModifier.addRepresentation(newRepresentation);
-         dao.saveOrUpdate(newModifier);
-         this.commitAndStartNewTransaction(null);
-
-         nNow = this.dao.listByTermType(termType, null, null, null, null).size();
-         Assert.assertEquals("There should still be only one more term (but with 2 representations)", nExisting + 1 , nNow);
-         nTermsNow = this.dao.list(DefinedTerm.class, null, null, null, null).size();
-         Assert.assertEquals("There should be exactly 1 more term now", nExistingTerms + 1 , nTermsNow);
-
-
-         List<DefinedTerm> languages = this.dao.listByTermType(TermType.Language, null, null, null, null);
-         Assert.assertNotNull(languages);
-         Assert.assertEquals(485, languages.size());
+       )
+       public void testListByTermType(){
+
+           TermType termType = TermType.Modifier;
+
+           List<DefinedTermBase> existingList = this.dao.listByTermType(termType, null, null, null, null);
+           int nExisting = existingList.size();
+           int nExistingTerms = this.dao.list(DefinedTerm.class, null, null, null, null).size();
+
+           //prepare
+        @SuppressWarnings("unchecked")
+        TermVocabulary<DefinedTerm> newVoc = TermVocabulary.NewInstance(termType);
+        UUID vocUuid = UUID.fromString("6ced4c45-9c1b-4053-9dc3-6b8c51d286ed");
+        newVoc.setUuid(vocUuid);
+        UUID termUuid = UUID.fromString("2ab69720-c06c-4cfc-8928-d2ae6f1e4a48");
+        DefinedTerm newModifier = DefinedTerm.NewModifierInstance("Test Modifier Description", "English Modifier", "TM");
+        newModifier.setUuid(termUuid);
+        newVoc.addTerm(newModifier);
+        vocabularyDao.save(newVoc);
+        this.commitAndStartNewTransaction(null);
+
+        //assert 1 more
+        int nNow = this.dao.listByTermType(termType, null, null, null, null).size();
+        Assert.assertEquals("There should be exactly 1 more term now", nExisting + 1 , nNow);
+        int nTermsNow = this.dao.list(DefinedTerm.class, null, null, null, null).size();
+        Assert.assertEquals("There should be exactly 1 more term now", nExistingTerms + 1 , nTermsNow);
+        this.commitAndStartNewTransaction(null);
+
+        //Add German representation
+        Representation newRepresentation = Representation.NewInstance("Beschreibung", "Deutscher Modifier", "Abk.", Language.GERMAN());
+        newModifier.addRepresentation(newRepresentation);
+        dao.saveOrUpdate(newModifier);
+        this.commitAndStartNewTransaction(null);
+
+        nNow = this.dao.listByTermType(termType, null, null, null, null).size();
+        Assert.assertEquals("There should still be only one more term (but with 2 representations)", nExisting + 1 , nNow);
+        nTermsNow = this.dao.list(DefinedTerm.class, null, null, null, null).size();
+        Assert.assertEquals("There should be exactly 1 more term now", nExistingTerms + 1 , nTermsNow);
+
+        List<DefinedTerm> languages = this.dao.listByTermType(TermType.Language, null, null, null, null);
+        Assert.assertNotNull(languages);
+        Assert.assertEquals(485, languages.size());
         }
 
      @Test