cleanup
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / VocabularyServiceImpl.java
index 3a278b20804529e6c385e7af0e8d0a93252e7c7e..4e077885745c61ab5924d5b7f47fa2999f6e27ad 100644 (file)
@@ -6,7 +6,6 @@
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
-
 package eu.etaxonomy.cdm.api.service;
 
 import java.util.ArrayList;
@@ -23,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
 import eu.etaxonomy.cdm.api.service.pager.Pager;
 import eu.etaxonomy.cdm.api.service.pager.impl.DefaultPagerImpl;
 import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
+import eu.etaxonomy.cdm.model.common.CdmClass;
 import eu.etaxonomy.cdm.model.common.Language;
 import eu.etaxonomy.cdm.model.term.DefinedTermBase;
 import eu.etaxonomy.cdm.model.term.TermType;
@@ -47,7 +47,6 @@ public class VocabularyServiceImpl extends IdentifiableServiceBase<TermVocabular
                this.dao = dao;
        }
 
-
        @Override
        @Transactional(readOnly = false)
     public UpdateResult updateCaches(Class<? extends TermVocabulary> clazz, Integer stepSize, IIdentifiableEntityCacheStrategy<TermVocabulary> cacheStrategy, IProgressMonitor monitor) {
@@ -57,7 +56,6 @@ public class VocabularyServiceImpl extends IdentifiableServiceBase<TermVocabular
                return super.updateCachesImpl(clazz, stepSize, cacheStrategy, monitor);
        }
 
-
     @Override
     public List<TermVocabulary> listByTermType(TermType termType, boolean includeSubTypes,
             Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
@@ -116,13 +114,14 @@ public class VocabularyServiceImpl extends IdentifiableServiceBase<TermVocabular
     }
 
     @Override
-    public Collection<TermDto> getCompleteTermHierarchy(TermVocabularyDto vocabularyDto) {
-        Collection<TermDto> topLevelTerms = dao.getTopLevelTerms(vocabularyDto.getUuid(), vocabularyDto.getTermType());
+    public List<TermDto> getCompleteTermHierarchy(TermVocabularyDto vocabularyDto) {
+        List<TermDto> topLevelTerms = dao.getTopLevelTerms(vocabularyDto.getUuid(), vocabularyDto.getTermType());
         for (TermDto termDto : topLevelTerms) {
             termDto.setVocabularyDto(vocabularyDto);
             initializeIncludes(termDto);
             initializeGeneralizationOf(termDto);
         }
+
         return topLevelTerms;
     }
 
@@ -171,6 +170,11 @@ public class VocabularyServiceImpl extends IdentifiableServiceBase<TermVocabular
         return dao.findVocabularyDtoByTermTypes(termTypes, includeSubtypes);
     }
 
+    @Override
+    public List<TermVocabularyDto> findFeatureVocabularyDtoByTermTypes(Set<CdmClass> availableFor) {
+        return dao.findVocabularyDtoByAvailableFor(availableFor);
+    }
+
     @Override
     public TermVocabularyDto findVocabularyDtoByVocabularyUuid(UUID vocUuid) {
         return dao.findVocabularyDtoByUuid(vocUuid);
@@ -179,7 +183,7 @@ public class VocabularyServiceImpl extends IdentifiableServiceBase<TermVocabular
     @Transactional(readOnly = false)
     @Override
     public TermDto addNewTerm(TermType termType, UUID vocabularyUUID) {
-        DefinedTermBase term = termType.getEmptyDefinedTermBase();
+        DefinedTermBase<?> term = termType.getEmptyDefinedTermBase();
         termService.save(term);
         TermVocabulary vocabulary = dao.load(vocabularyUUID);
         vocabulary.addTerm(term);
@@ -193,7 +197,6 @@ public class VocabularyServiceImpl extends IdentifiableServiceBase<TermVocabular
         return dao.getUuidAndTitleCache(clazz, termType, limit, pattern);
     }
 
-
     @Override
     public List<TermVocabularyDto> findVocabularyDtoByVocabularyUuids(List<UUID> vocUuids) {
         return dao.findVocabularyDtoByUuids(vocUuids);