import eu.etaxonomy.cdm.api.service.dto.IdentifiedEntityDTO;
import eu.etaxonomy.cdm.api.service.dto.IncludedTaxaDTO;
import eu.etaxonomy.cdm.api.service.dto.MarkedEntityDTO;
+import eu.etaxonomy.cdm.api.service.dto.TaxonRelationshipsDTO;
import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;
import eu.etaxonomy.cdm.api.service.exception.HomotypicalGroupChangeException;
import eu.etaxonomy.cdm.api.service.pager.Pager;
import eu.etaxonomy.cdm.api.service.search.LuceneParseException;
import eu.etaxonomy.cdm.api.service.search.SearchResult;
import eu.etaxonomy.cdm.api.service.util.TaxonRelationshipEdge;
+import eu.etaxonomy.cdm.exception.UnpublishedException;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.common.MarkerType;
+import eu.etaxonomy.cdm.model.common.RelationshipBase.Direction;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.media.Media;
-import eu.etaxonomy.cdm.model.media.MediaRepresentation;
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.persistence.query.TaxonTitleType;
-public interface ITaxonService extends IIdentifiableEntityService<TaxonBase>{
+public interface ITaxonService
+ extends IIdentifiableEntityService<TaxonBase>, IPublishableService<TaxonBase>{
+
+ /**
+ * {@inheritDoc}
+ * <BR><BR>
+ * NOTE: Also taxa with <code>publish=false</code> are returned.
+ */
+ @Override
+ public TaxonBase load(UUID uuid, List<String> propertyPaths);
/**
* Returns a list of taxa that matches the name string and the sec reference
* @param sec the taxons sec reference
* @return a list of taxa matching the name and the sec reference
*/
- public List<TaxonBase> searchTaxaByName(String name, Reference sec);
+ public List<TaxonBase> searchByName(String name, boolean includeUnpublished, Reference sec);
/**
* Swaps given synonym and accepted taxon.
*
* @param taxon The taxon that is relatedTo
* @param type The type of TaxonRelationship (can be null)
+ * @param includeUnpublished should unpublished related taxa also be returned?
* @param pageSize The maximum number of relationships returned (can be null for all relationships)
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
* @param orderHints Properties to order by
* @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
* @return a List of TaxonRelationship instances
*/
- public List<TaxonRelationship> listToTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+ public List<TaxonRelationship> listToTaxonRelationships(Taxon taxon, TaxonRelationshipType type,
+ boolean includeUnpublished, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
/**
*
* @param taxon The taxon that is relatedTo
* @param type The type of TaxonRelationship (can be null)
+ * @param includeUnpublished should unpublished related taxa also be returned?
* @param pageSize The maximum number of relationships returned (can be null for all relationships)
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
* @param orderHints Properties to order by
* @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
* @return a Pager of TaxonRelationship instances
*/
- public Pager<TaxonRelationship> pageToTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+ public Pager<TaxonRelationship> pageToTaxonRelationships(Taxon taxon, TaxonRelationshipType type,
+ boolean includeUnpublished, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
/**
* Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied)
*
* @param taxon The taxon that is relatedFrom
* @param type The type of TaxonRelationship (can be null)
+ * @param includeUnpublished should unpublished related taxa also be returned?
* @param pageSize The maximum number of relationships returned (can be null for all relationships)
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
* @param orderHints Properties to order by
* @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
* @return a List of TaxonRelationship instances
*/
- public List<TaxonRelationship> listFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+ public List<TaxonRelationship> listFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type,
+ boolean includeUnpublished, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
/**
*
* @param taxon The taxon that is relatedFrom
* @param type The type of TaxonRelationship (can be null)
+ * @param includeUnpublished should unpublished related taxa also be returned?
* @param pageSize The maximum number of relationships returned (can be null for all relationships)
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
* @param orderHints Properties to order by
* @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
* @return a Pager of TaxonRelationship instances
*/
- public Pager<TaxonRelationship> pageFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+ public Pager<TaxonRelationship> pageFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type,
+ boolean includeUnpublished, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
/**
* lists all taxa which are related to the <code>taxon</code> given as
* @return
*/
public Set<Taxon> listRelatedTaxa(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships, Integer maxDepth,
- Integer limit, Integer start, List<String> propertyPaths);
+ boolean includeUnpublished, Integer limit, Integer start, List<String> propertyPaths);
/**
*/
@Deprecated
public Pager<SearchResult<TaxonBase>> findByEverythingFullText(String queryString,
- Classification classification, List<Language> languages, boolean highlightFragments,
+ Classification classification, TaxonNode subtree, boolean includeUnpublished, List<Language> languages, boolean highlightFragments,
Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) throws IOException, LuceneParseException, LuceneMultiSearchException;
/**
* @throws IOException
* @throws LuceneParseException
*/
- public Pager<SearchResult<TaxonBase>> findByFullText(Class<? extends TaxonBase> clazz, String queryString, Classification classification,
- List<Language> languages, boolean highlightFragments, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,
- List<String> propertyPaths) throws IOException, LuceneParseException;
+ public Pager<SearchResult<TaxonBase>> findByFullText(Class<? extends TaxonBase> clazz, String queryString,
+ Classification classification, TaxonNode subtree,
+ boolean includeUnpublished, List<Language> languages,
+ boolean highlightFragments, Integer pageSize, Integer pageNumber,
+ List<OrderHint> orderHints, List<String> propertyPaths)
+ throws IOException, LuceneParseException;
/**
* @throws IOException
* @throws LuceneParseException
*/
+ //TODO needed? currently only used in test
public Pager<SearchResult<TaxonBase>> findByDistribution(List<NamedArea> areaFilter, List<PresenceAbsenceTerm> statusFilter,
- Classification classification,
+ Classification classification, TaxonNode subtree,
Integer pageSize, Integer pageNumber,
List<OrderHint> orderHints, List<String> propertyPaths) throws IOException, LuceneParseException;
* Additional filter criterion: If a taxonomic classification
* three is specified here the result set will only contain taxa
* of the given classification
+ * @param subtree
* @param namedAreas
+ * @param distributionStatus
* @param languages
* Additional filter criterion: Search only in these languages.
* Not all text fields in the cdm model are multilingual, thus
*/
public Pager<SearchResult<TaxonBase>> findTaxaAndNamesByFullText(
EnumSet<TaxaAndNamesSearchMode> searchModes,
- String queryString, Classification classification, Set<NamedArea> namedAreas, Set<PresenceAbsenceTerm> distributionStatus,
+ String queryString, Classification classification, TaxonNode subtree,
+ Set<NamedArea> namedAreas, Set<PresenceAbsenceTerm> distributionStatus,
List<Language> languages, boolean highlightFragments, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,
List<String> propertyPaths) throws IOException, LuceneParseException, LuceneMultiSearchException;
* the query string to filter by
* @param classification
* Additional filter criterion: If a taxonomic classification
- * three is specified here the result set will only contain taxa
+ * tree is specified here the result set will only contain taxa
* of the given classification
+ * @param subtree
+ * Additional filter criterion: If a taxonomic classification
+ * subtree is specified here the result set will only contain taxa
+ * of the given subtree
* @param features
* TODO
* @param languages
* Additional filter criterion: Search only in these languages.
- * Not all text fields in the cdm model are multilingual, thus
- * this setting will only apply to the multilingiual fields.
+ * Not all text fields in the CDM model are multi-lingual, thus
+ * this setting will only apply to the multi-lingual fields.
* Other fields are searched nevertheless if this parameter is
* set or not.
* @param highlightFragments
* @throws LuceneCorruptIndexException
* @throws LuceneParseException
*/
- public Pager<SearchResult<TaxonBase>> findByDescriptionElementFullText(Class<? extends DescriptionElementBase> clazz, String queryString, Classification classification, List<Feature> features, List<Language> languages, boolean highlightFragments, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) throws IOException, LuceneParseException;
-
-
- /**
- *
- * @param taxon
- * @param size
- * @param height
- * @param widthOrDuration
- * @param mimeTypes
- * @return
- *
- * @deprecated use {@link #listMedia(Taxon, Set, boolean, boolean, List)} instead
- */
- @Deprecated
- public List<MediaRepresentation> getAllMedia(Taxon taxon, int size, int height, int widthOrDuration, String[] mimeTypes);
-
+ public Pager<SearchResult<TaxonBase>> findByDescriptionElementFullText(Class<? extends DescriptionElementBase> clazz,
+ String queryString, Classification classification, TaxonNode subtree, List<Feature> features, List<Language> languages, boolean highlightFragments, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) throws IOException, LuceneParseException;
/**
* Lists all Media found in an any TaxonDescription associated with this
* an accepted taxon are counted
* @return the number of synonyms
*/
- public int countSynonyms(boolean onlyAttachedToTaxon);
+ public long countSynonyms(boolean onlyAttachedToTaxon);
public List<TaxonName> findIdenticalTaxonNames(List<String> propertyPath);
public Taxon findBestMatchingTaxon(MatchingTaxonConfigurator config);
- public Synonym findBestMatchingSynonym(String taxonName);
+ public Synonym findBestMatchingSynonym(String taxonName, boolean includeUnpublished);
- public List<UuidAndTitleCache<IdentifiableEntity>> findTaxaAndNamesForEditor(IFindTaxaAndNamesConfigurator configurator);
+ public List<UuidAndTitleCache<? extends IdentifiableEntity>> findTaxaAndNamesForEditor(IFindTaxaAndNamesConfigurator configurator);
/**
* Creates the specified inferred synonyms for the taxon in the classification, but do not insert it to the database
*/
public List<Synonym> createAllInferredSynonyms(Taxon taxon, Classification tree, boolean doWithMisappliedNames);
- public Taxon findAcceptedTaxonFor(UUID synonymUuid, UUID classificationUuid, List<String> propertyPaths);
+ public Taxon findAcceptedTaxonFor(UUID synonymUuid, UUID classificationUuid, boolean includeUnpublished,
+ List<String> propertyPaths) throws UnpublishedException;
public List<TaxonBase> findTaxaByName(MatchingTaxonConfigurator config);
public UpdateResult changeRelatedTaxonToSynonym(UUID fromTaxonUuid, UUID toTaxonUuid,
TaxonRelationshipType oldRelationshipType, SynonymType synonymType) throws DataChangeNoRollbackException;
+ /**
+ * Returns a list of taxon relationships for a given taxon as DTO.
+ * @param taxonUuid
+ * @param directTypes
+ * @param inversTypes
+ * @param direction
+ * @param groupMisapplications
+ * @param includeUnpublished
+ * @param pageSize
+ * @param pageNumber
+ * @return
+ */
+ public TaxonRelationshipsDTO listTaxonRelationships(UUID taxonUuid,
+ Set<TaxonRelationshipType> directTypes,
+ Set<TaxonRelationshipType> inversTypes, Direction direction, boolean groupMisapplications,
+ boolean includeUnpublished, Integer pageSize, Integer pageNumber);
+
+
}