ref #10377: adapt saveCharacterNodeDtoList to the possibility that
authorKatja Luther <k.luther@bgbm.org>
Fri, 11 Aug 2023 14:06:58 +0000 (16:06 +0200)
committerKatja Luther <k.luther@bgbm.org>
Fri, 11 Aug 2023 14:06:58 +0000 (16:06 +0200)
recommendedstates can come from trees or vocabularies

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TermNodeServiceImpl.java

index 7b88561c7d160b159821ecdd644bb24a86f09c36..cf4cdb57f428e77db26577404ec68b5070919bf4 100644 (file)
@@ -43,6 +43,7 @@ import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
 import eu.etaxonomy.cdm.model.term.DefinedTerm;
 import eu.etaxonomy.cdm.model.term.DefinedTermBase;
 import eu.etaxonomy.cdm.model.term.Representation;
+import eu.etaxonomy.cdm.model.term.TermCollection;
 import eu.etaxonomy.cdm.model.term.TermNode;
 import eu.etaxonomy.cdm.model.term.TermTree;
 import eu.etaxonomy.cdm.model.term.TermType;
@@ -84,6 +85,9 @@ public class TermNodeServiceImpl
        @Autowired
        private IVocabularyService vocabularyService;
 
+       @Autowired
+    private ITermCollectionService termCollService;
+
        @Override
     public List<TermNode> list(TermType termType, Integer limit, Integer start,
                List<OrderHint> orderHints, List<String> propertyPaths){
@@ -529,13 +533,15 @@ public class TermNodeServiceImpl
 //                  recommended mod. vocabularies
                     character.getRecommendedModifierEnumeration().clear();
                     uuids = new ArrayList<>();
+                    List<UUID> termCollUuids = new ArrayList<>();
                     for (TermCollectionDto termDto: characterDto.getRecommendedModifierEnumeration()){
-                        uuids.add(termDto.getUuid());
+                        termCollUuids.add(termDto.getUuid());
                     }
-                    List<TermVocabulary> termVocs;
+                    List<TermCollection> termVocs;
                     if (!uuids.isEmpty()){
-                        termVocs = vocabularyService.load(uuids, null);
-                        for (TermVocabulary<DefinedTerm> voc: termVocs){
+                        termVocs = termCollService.load(uuids, null);
+
+                        for (TermCollection voc: termVocs){
                             character.addRecommendedModifierEnumeration(voc);
                         }
                     }
@@ -543,13 +549,15 @@ public class TermNodeServiceImpl
 //                  supported state vocabularies
                     character.getSupportedCategoricalEnumerations().clear();
                     uuids = new ArrayList<>();
+
                     for (TermCollectionDto termDto: characterDto.getSupportedCategoricalEnumerations()){
                         uuids.add(termDto.getUuid());
                     }
                     if (!uuids.isEmpty()){
-                        termVocs = vocabularyService.load(uuids, null);
 
-                        for (TermVocabulary voc: termVocs){
+                        termVocs = termCollService.load(uuids, null);
+
+                        for (TermCollection voc: termVocs){
                             character.addSupportedCategoricalEnumeration(voc);
                         }
                     }