X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/blobdiff_plain/40368de1fbee4bf0b12edd7dad8a38af94029b6c..8849a7eb10f7d2d587fbccb4610fa7e38c9be78d:/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IVocabularyService.java diff --git a/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IVocabularyService.java b/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IVocabularyService.java index a28980b643..452d8ef634 100644 --- a/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IVocabularyService.java +++ b/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IVocabularyService.java @@ -1,95 +1,158 @@ -/** -* Copyright (C) 2009 EDIT -* European Distributed Institute of Taxonomy -* http://www.e-taxonomy.eu -* -* 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.List; - -import eu.etaxonomy.cdm.api.service.pager.Pager; -import eu.etaxonomy.cdm.model.common.DefinedTermBase; -import eu.etaxonomy.cdm.model.common.Language; -import eu.etaxonomy.cdm.model.common.TermType; -import eu.etaxonomy.cdm.model.common.TermVocabulary; -import eu.etaxonomy.cdm.model.common.VocabularyEnum; -import eu.etaxonomy.cdm.persistence.query.OrderHint; - -public interface IVocabularyService extends IIdentifiableEntityService { - - //TODO candidate for harmonization: rename to load(VocabularyEnum vocabularyType) - public TermVocabulary getVocabulary(VocabularyEnum vocabularyType); - - /** - * Returns term vocabularies that contain terms of a certain class e.g. Feature, Modifier, State. - * - * @param - * @param clazz the term class of the terms in the vocabulary - * @param limit The maximum number of vocabularies returned (can be null for all vocabularies) - * @param start The offset from the start of the result set (0 - based, can be null - equivalent of starting at the beginning of the recordset) - * @param orderHints - * Supports path like orderHints.propertyNames which - * include *-to-one properties like createdBy.username or - * authorTeam.persistentTitleCache - * @param propertyPaths properties to be initialized - * @return a list of term vocabularies - * @see #listByTermClass(Class, boolean, Integer, Integer, List, List) - */ - public List> listByTermClass(Class clazz, Integer limit, Integer start, List orderHints, List propertyPaths); - - /** - * Returns term vocabularies that contain terms of a certain class e.g. Feature, Modifier, State. - * - * @param - * @param clazz the term class of the terms in the vocabulary - * @param includeSubclasses if true all subclasses of clazz will be included for computation of the result - * @param includeEmptyVocs if true all vocabularies that do not contain any term will be included in the result - * @param limit The maximum number of vocabularies returned (can be null for all vocabularies) - * @param start The offset from the start of the result set (0 - based, can be null - equivalent of starting at the beginning of the recordset) - * @param orderHints - * Supports path like orderHints.propertyNames which - * include *-to-one properties like createdBy.username or - * authorTeam.persistentTitleCache - * @param propertyPaths properties to be initialized - * @return a list of term vocabularies - * @see #listByTermClass(Class, Integer, Integer, List, List) - */ - public List> listByTermClass(Class clazz, boolean includeSubclasses, boolean includeEmptyVocs, Integer limit, Integer start, List orderHints, List propertyPaths); - - - /** - * Returns Language Vocabulary - * @return - */ - //TODO candidate for harmonization: rename to loadLanguageVocabulary(... - public TermVocabulary getLanguageVocabulary(); - - /** - * Returns a list of terms belonging to the vocabulary passed as an argument - * - * @param vocabulary The vocabulary for which the list of terms is desired - * @param limit The maximum number of terms returned (can be null for all terms in the vocabulary) - * @param start The offset from the start of the result set (0 - based, can be null - equivalent of starting at the beginning of the recordset) - * @param orderHints - * Supports path like orderHints.propertyNames which - * include *-to-one properties like createdBy.username or - * authorTeam.persistentTitleCache - * @param propertyPaths properties to be initialized - * @return a paged list of terms - */ - //TODO candidate for harmonization: rename to getTerms(... - public Pager getTerms(TermVocabulary vocabulary, Integer limit, Integer start, List orderHints, List propertyPaths); - - /** - * Returns a list of term vocabularies corresponding to a term type - * - * @param termType The term type for which the list of vocabularies is desired - * @return a list of vocabularies - */ - public List> findByTermType(TermType termType); - -} +/** +* Copyright (C) 2009 EDIT +* European Distributed Institute of Taxonomy +* http://www.e-taxonomy.eu +* +* 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.Collection; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import eu.etaxonomy.cdm.api.service.pager.Pager; +import eu.etaxonomy.cdm.model.common.Language; +import eu.etaxonomy.cdm.model.term.DefinedTermBase; +import eu.etaxonomy.cdm.model.term.TermType; +import eu.etaxonomy.cdm.model.term.TermVocabulary; +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; + +public interface IVocabularyService extends IIdentifiableEntityService { + + /** + * Returns term vocabularies that contain terms of a certain {@link TermType} e.g. Feature, Modifier, State. + * + * @param + * @param termType the {@link TermType} of the terms in the vocabulary and of the vocabulary + * @param includeSubTypes if true all subtypes will be included for computation of the result + * @param limit The maximum number of vocabularies returned (can be null for all vocabularies) + * @param start The offset from the start of the result set (0 - based, can be null - equivalent of starting at the beginning of the recordset) + * @param orderHints + * Supports path like orderHints.propertyNames which + * include *-to-one properties like createdBy.username or + * authorTeam.persistentTitleCache + * @param propertyPaths properties to be initialized + * @return a list of term vocabularies + */ + public List listByTermType(TermType termType, boolean includeSubTypes, Integer limit, Integer start, List orderHints, List propertyPaths); + + /** + * Returns Language Vocabulary + * @return + */ + //TODO candidate for harmonization: rename to loadLanguageVocabulary(... + public TermVocabulary getLanguageVocabulary(); + + /** + * Returns a list of terms belonging to the vocabulary passed as an argument + * + * @param vocabulary The vocabulary for which the list of terms is desired + * @param limit The maximum number of terms returned (can be null for all terms in the vocabulary) + * @param start The offset from the start of the result set (0 - based, can be null - equivalent of starting at the beginning of the recordset) + * @param orderHints + * Supports path like orderHints.propertyNames which + * include *-to-one properties like createdBy.username or + * authorTeam.persistentTitleCache + * @param propertyPaths properties to be initialized + * @return a paged list of terms + */ + //TODO candidate for harmonization: rename to getTerms(... + public Pager getTerms(TermVocabulary vocabulary, Integer limit, Integer start, List orderHints, List propertyPaths); + + /** + * Returns a list of term vocabularies corresponding to a term type + * + * @param termType The term type for which the list of vocabularies is desired + * @return a list of vocabularies + */ + public List> findByTermType(TermType termType, List propertyPaths); + + /** + * Loads all top level terms, i.e. terms that have no parent terms, for the given vocabulary + * @param vocabularyUuid the uuid of the vocabulary + * @return a collection of top level terms + */ + public Collection getTopLevelTerms(UUID vocabularyUuid); + + /** + * Loads all terms for the given vocabulary + * @param vocabularyUuid the id of the vocabulary + * @return a collection of terms + */ + public Collection getTerms(UUID vocabularyUuid); + + /** + * Loads all terms for the given vocabularies + * @param vocabularyUuids the ids of the vocabularies + * @return a collection of terms + */ + public Collection getTerms(List vocabularyUuids); + + /** + * Initializes the complete term hierarchy consisting of {@link TermDto}s + * for the given vocabulary + * @param vocabularyDto the dto of the term vocabulary + * @return a the top level elements for this vocabulary + */ + public Collection getCompleteTermHierarchy(TermVocabularyDto vocabularyDto); + + /** + * 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 vocabulary DTOs + */ + public List 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 findVocabularyDtoByTermTypes(Set termTypes); + + /** + * Creates a new term as a direct child of the given vocabulary. + * @param termType the {@link TermType} of the term to create + * @param vocabularyUUID the {@link UUID} of the vocabulary + * kindOf relation. Otherwise it will added via a partOf relation + * @return the new term + */ + public TermDto addNewTerm(TermType termType, UUID vocabularyUUID); + + /** + * + * Like {@link #getUuidAndTitleCache(Class, Integer, String)} but filtering + * the results by {@link TermType} of the vocabularies. + * + * + * @param clazz + * the (sub)class + * @param termType + * the {@link TermType} of the vocabularies to be retrieved + * @param limit + * max number of results + * @param pattern + * search pattern + * @return a list of {@link UuidAndTitleCache} + * + * @see #getUuidAndTitleCache(Class, Integer, String)) + */ + public List> getUuidAndTitleCache(Class clazz, TermType termType, + Integer limit, String pattern); + + /** + * @param vocUuid + * @return + */ + TermVocabularyDto findVocabularyDtoByVocabularyUuid(UUID vocUuid); + +}