}
@Override
- public List<TermCollectionDto> listTermTreeDtosByTermType(TermType termType) {
+ public List<TermTreeDto> listTermTreeDtosByTermType(TermType termType) {
String queryString = TermCollectionDto.getTermCollectionDtoSelect("TermTree")
+ " WHERE a.termType = :termType"
+ " ORDER BY a.titleCache";
List<Object[]> result = query.list();
List<TermCollectionDto> list = TermTreeDto.termTreeDtoListFrom(result);
- return list;
+ List<TermTreeDto> treeList = new ArrayList<>();
+ for (TermCollectionDto coll: list) {
+ treeList.add((TermTreeDto)coll);
+ }
+ return treeList;
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByUuids(List<UUID> termType) {
+ public List<TermTreeDto> findTermTreeDtoByUuids(List<UUID> termType) {
String queryString = TermTreeDto.getTermTreeDtoSelect()
+ " WHERE a.termType = :termType"
+ " ORDER BY a.titleCache";
query.setParameter("termType", termType);
List<Object[]> result = query.list();
-
- List<TermCollectionDto> list = TermTreeDto.termTreeDtoListFrom(result);
+ List<TermCollectionDto> collDtos = TermTreeDto.termTreeDtoListFrom(result);
+ List<TermTreeDto> list = new ArrayList<>();
+ for (TermCollectionDto coll: collDtos) {
+ list.add((TermTreeDto)coll);
+ }
return list;
}
@Override
- public TermCollectionDto getTermTreeDtosByUuid(UUID uuid) {
- String queryString = TermTreeDto.getTermCollectionDtoSelect()
+ public TermTreeDto getTermTreeDtosByUuid(UUID uuid) {
+ String queryString = TermTreeDto.getTermTreeDtoSelect()
+ " WHERE a.uuid = :uuid"
+ " ORDER BY a.titleCache";
Query<Object[]> query = getSession().createQuery(queryString, Object[].class);
List<Object[]> result = query.list();
List<TermCollectionDto> list = TermTreeDto.termTreeDtoListFrom(result);
- return !list.isEmpty()? list.get(0): null;
+
+ return !list.isEmpty()? (TermTreeDto)list.get(0): null;
}
}
\ No newline at end of file
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes) {
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes) {
return findVocabularyDtoByTermTypes(termTypes, true);
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes, boolean includeSubtypes) {
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes, boolean includeSubtypes) {
return findVocabularyDtoByTermTypes(termTypes, null, includeSubtypes);
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByAvailableFor(Set<CdmClass> availableForSet) {
+ public List<TermVocabularyDto> findVocabularyDtoByAvailableFor(Set<CdmClass> availableForSet) {
String queryVocWithFittingTerms = "SELECT DISTINCT(v.uuid) FROM DefinedTermBase term JOIN term.vocabulary as v WHERE " ;
for (CdmClass availableFor: availableForSet){
query.setParameter("feature", TermType.Feature);
List<Object[]> result = query.list();
- List<TermCollectionDto> dtos = TermVocabularyDto.termVocabularyDtoListFrom(result);
+ List<TermCollectionDto> collDtos = TermVocabularyDto.termVocabularyDtoListFrom(result);
+ List<TermVocabularyDto> dtos = new ArrayList<>();
+ for (TermCollectionDto coll: collDtos) {
+ dtos.add((TermVocabularyDto)coll);
+ }
return dtos;
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes, String pattern, boolean includeSubtypes) {
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes, String pattern, boolean includeSubtypes) {
Set<TermType> termTypeWithSubType = new HashSet<>();
if (! (termTypes.isEmpty() || (termTypes.size() == 1 && termTypes.iterator().next() == null))){
termTypeWithSubType = new HashSet<>(termTypes);
}
List<Object[]> result = query.list();
- List<TermCollectionDto> dtos = TermVocabularyDto.termVocabularyDtoListFrom(result);
+ List<TermVocabularyDto> dtos = new ArrayList<>();
+ List<TermCollectionDto> collDtos = TermVocabularyDto.termVocabularyDtoListFrom(result);
+ for (TermCollectionDto coll:collDtos) {
+ dtos.add((TermVocabularyDto)coll);
+ }
return dtos;
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByTermType(TermType termType) {
+ public List<TermVocabularyDto> findVocabularyDtoByTermType(TermType termType) {
return findVocabularyDtoByTermTypes(Collections.singleton(termType));
}
}
@Override
- public TermCollectionDto findVocabularyDtoByUuid(UUID vocUuid) {
+ public TermVocabularyDto findVocabularyDtoByUuid(UUID vocUuid) {
if (vocUuid == null ){
return null;
}
List<Object[]> result = query.list();
if (result.size() == 1){
- return TermVocabularyDto.termVocabularyDtoListFrom(result).get(0);
+ return (TermVocabularyDto) TermVocabularyDto.termVocabularyDtoListFrom(result).get(0);
}
return null;
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByUuids(List<UUID> vocUuids) {
+ public List<TermVocabularyDto> findVocabularyDtoByUuids(List<UUID> vocUuids) {
if (vocUuids == null || vocUuids.isEmpty()){
return null;
}
- List<TermCollectionDto> list = new ArrayList<>();
+ List<TermVocabularyDto> list = new ArrayList<>();
String queryString = TermCollectionDto.getTermCollectionDtoSelect()
+ " WHERE a.uuid IN :uuidList ";
query.setParameterList("uuidList", vocUuids);
List<Object[]> result = query.list();
- list = TermCollectionDto.termCollectionDtoListFrom(result);
+ List<TermCollectionDto> collDtos = TermVocabularyDto.termVocabularyDtoListFrom(result);
+ for (TermCollectionDto coll: collDtos) {
+ list.add((TermVocabularyDto)coll);
+ }
return list;
}
import eu.etaxonomy.cdm.model.term.TermTree;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
-import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
+import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
/**
public <S extends TermTree> List<UuidAndTitleCache<S>> getUuidAndTitleCacheByTermType(Class<S> clazz, TermType termType, Integer limit,
String pattern);
- public <S extends TermTree> List<TermCollectionDto> listTermTreeDtosByTermType(TermType termType);
+ public <S extends TermTree> List<TermTreeDto> listTermTreeDtosByTermType(TermType termType);
- public TermCollectionDto getTermTreeDtosByUuid(UUID uuid);
+ public TermTreeDto getTermTreeDtosByUuid(UUID uuid);
/**
* Returns list of term trees for list of UUIDs
* @param vocUuids the {@link UUID} of the trees
* @return term trees
*/
- public List<TermCollectionDto> findVocabularyDtoByUuids(List<UUID> vocUuids);
+ public List<TermTreeDto> findTermTreeDtoByUuids(List<UUID> vocUuids);
}
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
-import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
* @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
* @return a list of term vocabularies
*/
- public List<TermCollectionDto> findVocabularyDtoByTermType(TermType termType);
+ public List<TermVocabularyDto> findVocabularyDtoByTermType(TermType termType);
/**
* Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State. containing pattern
* @param includeSubTypes
* @return a list of term vocabularies
*/
- public List<TermCollectionDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes, String pattern, boolean includeSubtypes);
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes, String pattern, boolean includeSubtypes);
/**
* Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
* @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
* @return a list of term vocabularies
*/
- public List<TermCollectionDto> findVocabularyDtoByTermTypes(Set<TermType> termType);
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termType);
/**
* Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
* will be considered
* @return a list of term vocabularies
*/
- public List<TermCollectionDto> findVocabularyDtoByTermTypes(Set<TermType> termType, boolean includeSubtypes);
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termType, boolean includeSubtypes);
/**
* Returns term vocabulary for UUID
* @param UUID the {@link UUID} of the vocabulary
* @return term vocabularies
*/
- public TermCollectionDto findVocabularyDtoByUuid(UUID vocUuid);
+ public TermVocabularyDto findVocabularyDtoByUuid(UUID vocUuid);
/**
* Returns list of term vocabularies for list of UUIDs
* @param vocUuids the {@link UUID} of the vocabularies
* @return term vocabularies
*/
- public List<TermCollectionDto> findVocabularyDtoByUuids(List<UUID> vocUuids);
+ public List<TermVocabularyDto> findVocabularyDtoByUuids(List<UUID> vocUuids);
/**
*
* @param availableFor
* @return
*/
- public List<TermCollectionDto> findVocabularyDtoByAvailableFor(Set<CdmClass> availableFor);
+ public List<TermVocabularyDto> findVocabularyDtoByAvailableFor(Set<CdmClass> availableFor);
}
} else {
if (elements[9]== null) {
- TermVocabularyDto.extractedVocabularies(dtos, dtoMap, elements);
+ TermVocabularyDto.extractedVocabularies(dtos, dtoMap, elements);
+
}else {
TermTreeDto.extracted(dtos, dtoMap, elements);
}
}
public static List<TermCollectionDto> termVocabularyDtoListFrom(List<Object[]> queryResult) {
- List<TermCollectionDto> dtos = new ArrayList<>(); // list to ensure order
+ List<TermCollectionDto> dtos = new ArrayList<>();// list to ensure order
// map to handle multiple representations because of LEFT JOIN
Map<UUID, TermCollectionDto> dtoMap = new HashMap<>(queryResult.size());
for (Object[] elements : queryResult) {
*/
protected static void extractedVocabularies(List<TermCollectionDto> dtos, Map<UUID, TermCollectionDto> dtoMap, Object[] elements) {
UUID uuid = (UUID)elements[0];
+
if(dtoMap.containsKey(uuid)){
// multiple results for one voc -> multiple (voc) representation
if(elements[1]!=null){
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.persistence.dao.term.ITermVocabularyDao;
-import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
+import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
import eu.etaxonomy.cdm.test.unitils.CleanSweepInsertLoadStrategy;
public void testFindVocabularyDtoByTermTypes(){
Set<TermType> termTypes = new HashSet<>();
termTypes.add(TermType.NamedArea);
- List<TermCollectionDto> vocDtos = dao.findVocabularyDtoByTermTypes(termTypes, true);
+ List<TermVocabularyDto> vocDtos = dao.findVocabularyDtoByTermTypes(termTypes, true);
Assert.assertEquals(4, vocDtos.size());
//#9825 test deduplication
import eu.etaxonomy.cdm.model.term.TermTree;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
-import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
public List<Restriction<?>> buildTermTypeFilterRestrictions(TermType termType);
- public List<TermCollectionDto> listTermTreeDtosByTermType(TermType termType);
+ public List<TermTreeDto> listTermTreeDtosByTermType(TermType termType);
- public TermCollectionDto getTermTreeDtoByUuid(UUID uuid);
+ public TermTreeDto getTermTreeDtoByUuid(UUID uuid);
public UpdateResult saveOrUpdateTermTreeDtoList(List<TermTreeDto> dtos);
- List<TermCollectionDto> getTermTreeDtosByUuids(List<UUID> uuid);
+ List<TermTreeDto> getTermTreeDtosByUuids(List<UUID> uuid);
}
import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
* @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary
* @return a list of term vocabulary DTOs
*/
- public List<TermCollectionDto> findVocabularyDtoByTermType(TermType termType);
+ public List<TermVocabularyDto> findVocabularyDtoByTermType(TermType termType);
/**
* Returns term vocabularies that contain terms of the given types {@link TermType} e.g. Feature, Modifier, State.
* @param termTypes a set of {@link TermType}s of the terms in the vocabulary and of the vocabulary
* @return a list of term vocabulary DTOs
*/
- public List<TermCollectionDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes);
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes);
/**
* Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State.
* will be returned
* @return a list of term vocabulary DTOs
*/
- public List<TermCollectionDto> findVocabularyDtoByTermType(TermType termType, boolean includeSubtypes);
+ public List<TermVocabularyDto> findVocabularyDtoByTermType(TermType termType, boolean includeSubtypes);
/**
* Returns term vocabularies that contain terms of the given types {@link TermType} e.g. Feature, Modifier, State.
* will be returned
* @return a list of term vocabulary DTOs
*/
- public List<TermCollectionDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes, boolean includeSubtypes);
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes, boolean includeSubtypes);
/**
* Creates a new term as a direct child of the given vocabulary.
* @param vocUuid
* @return
*/
- public List<TermCollectionDto> findVocabularyDtoByVocabularyUuids(List<UUID> vocUuid);
+ public List<TermVocabularyDto> findVocabularyDtoByVocabularyUuids(List<UUID> vocUuid);
- public List<TermCollectionDto> findVocabularyDtoByTermTypeAndPattern(String pattern, TermType termType);
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypeAndPattern(String pattern, TermType termType);
/**
* @param termTypes
* @param includeSubtypes
* @return
*/
- public List<TermCollectionDto> findFeatureVocabularyDtoByTermTypes(Set<CdmClass> availableFor);
+ public List<TermVocabularyDto> findFeatureVocabularyDtoByTermTypes(Set<CdmClass> availableFor);
/**
* Returns a list of vocabulary {@link UUID uuids} according to the given filter.
import eu.etaxonomy.cdm.persistence.dao.term.ITermNodeDao;
import eu.etaxonomy.cdm.persistence.dao.term.ITermTreeDao;
import eu.etaxonomy.cdm.persistence.dto.MergeResult;
-import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
}
@Override
- public List<TermCollectionDto> listTermTreeDtosByTermType(TermType termType) {
+ public List<TermTreeDto> listTermTreeDtosByTermType(TermType termType) {
return dao.listTermTreeDtosByTermType(termType);
}
@Override
- public TermCollectionDto getTermTreeDtoByUuid(UUID uuid) {
+ public TermTreeDto getTermTreeDtoByUuid(UUID uuid) {
return dao.getTermTreeDtosByUuid(uuid);
}
@Override
- public List<TermCollectionDto> getTermTreeDtosByUuids(List<UUID> uuid) {
- return dao.findVocabularyDtoByUuids(uuid);
+ public List<TermTreeDto> getTermTreeDtosByUuids(List<UUID> uuid) {
+ return dao.findTermTreeDtoByUuids(uuid);
}
}
import eu.etaxonomy.cdm.persistence.dao.term.ITermVocabularyDao;
import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.OrderHint;
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByTermType(TermType termType) {
+ public List<TermVocabularyDto> findVocabularyDtoByTermType(TermType termType) {
return findVocabularyDtoByTermTypes(Collections.singleton(termType), true);
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByTermTypeAndPattern(String pattern, TermType termType) {
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypeAndPattern(String pattern, TermType termType) {
return dao.findVocabularyDtoByTermTypes(Collections.singleton(termType), pattern, true);
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes) {
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes) {
return findVocabularyDtoByTermTypes(termTypes, true);
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByTermType(TermType termType, boolean includeSubtypes) {
+ public List<TermVocabularyDto> findVocabularyDtoByTermType(TermType termType, boolean includeSubtypes) {
return findVocabularyDtoByTermTypes(Collections.singleton(termType), includeSubtypes);
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes, boolean includeSubtypes) {
+ public List<TermVocabularyDto> findVocabularyDtoByTermTypes(Set<TermType> termTypes, boolean includeSubtypes) {
return dao.findVocabularyDtoByTermTypes(termTypes, includeSubtypes);
}
@Override
- public List<TermCollectionDto> findFeatureVocabularyDtoByTermTypes(Set<CdmClass> availableFor) {
+ public List<TermVocabularyDto> findFeatureVocabularyDtoByTermTypes(Set<CdmClass> availableFor) {
return dao.findVocabularyDtoByAvailableFor(availableFor);
}
}
@Override
- public List<TermCollectionDto> findVocabularyDtoByVocabularyUuids(List<UUID> vocUuids) {
+ public List<TermVocabularyDto> findVocabularyDtoByVocabularyUuids(List<UUID> vocUuids) {
return dao.findVocabularyDtoByUuids(vocUuids);
}