import java.io.IOException;
import java.util.EnumSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.UUID;
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.LuceneMultiSearchException;
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.model.common.DefinedTerm;
+import eu.etaxonomy.cdm.api.util.TaxonRelationshipEdge;
+import eu.etaxonomy.cdm.exception.UnpublishedException;
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.metadata.SecReferenceHandlingEnum;
+import eu.etaxonomy.cdm.model.metadata.SecReferenceHandlingSwapEnum;
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.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.cdm.model.term.DefinedTerm;
+import eu.etaxonomy.cdm.model.term.IdentifierType;
+import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
*
* @param synonym
* @param acceptedTaxon
+ * @param setNameInSource
* @return
*/
- public UpdateResult swapSynonymAndAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon);
+ public UpdateResult swapSynonymAndAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon, boolean setNameInSource, boolean newUuidForAcceptedTaxon, SecReferenceHandlingSwapEnum secHandling, Reference secRefAcc, Reference secRefSyn);
+
+ public UpdateResult swapSynonymAndAcceptedTaxon(UUID synonymUUid, UUID acceptedTaxonUuid, boolean setNameInSource, boolean newUuidForAcceptedTaxon, SecReferenceHandlingSwapEnum secHandling, UUID newSecAcc, UUID newSecSyn);
/**
* Changes a synonym into an accepted taxon and removes
* in the homotypic group. It is up to the implementing class to
* handle this situation via an exception or in another way.
*/
- public UpdateResult changeSynonymToAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon, boolean deleteSynonym) throws HomotypicalGroupChangeException;
+ public UpdateResult changeSynonymToAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon,Reference newSecRef, String microRef, SecReferenceHandlingEnum secHandling, boolean deleteSynonym) throws HomotypicalGroupChangeException;
/**
* @param synonymUuid
* @return
* @throws HomotypicalGroupChangeException
*/
- public UpdateResult changeSynonymToAcceptedTaxon(UUID synonymUuid, UUID acceptedTaxonUuid, UUID newParentNodeUuid,
+ public UpdateResult changeSynonymToAcceptedTaxon(UUID synonymUuid, UUID acceptedTaxonUuid, UUID newParentNodeUuid, UUID newSecRef, String microRef, SecReferenceHandlingEnum secHandling,
boolean deleteSynonym)
throws HomotypicalGroupChangeException;
public UpdateResult moveSynonymToAnotherTaxon(Synonym oldSynonym, Taxon newTaxon, boolean moveHomotypicGroup,
SynonymType newSynonymType) throws HomotypicalGroupChangeException;
-
/**
* Moves a synonym to another taxon and removes the old synonym relationship.
*
* (2) synonym is in homotypic group with other synonyms and <code>moveHomotypicGroup</code> is false
*/
public UpdateResult moveSynonymToAnotherTaxon(Synonym oldSynonym, Taxon newTaxon, boolean moveHomotypicGroup,
- SynonymType newSynonymType, Reference newSecundum,
+ SynonymType newSynonymType, UUID newSecundumUuid,
String newSecundumDetail, boolean keepSecundumIfUndefined) throws HomotypicalGroupChangeException;
-
/**
- * @param oldSynonym
- * @param newTaxonUUID
- * @param moveHomotypicGroup
- * @param newSynonymType
- * @param reference
- * @param referenceDetail
- * @param keepReference
- * @return
- * @throws HomotypicalGroupChangeException
- *
* @see {@link #moveSynonymToAnotherTaxon(Synonym, Taxon, boolean, SynonymType, Reference, String, boolean)}
*/
public UpdateResult moveSynonymToAnotherTaxon(Synonym oldSynonym,
UUID newTaxonUUID, boolean moveHomotypicGroup,
SynonymType newSynonymType,
- Reference newSecundum, String newSecundumDetail, boolean keepSecundumIfUndefined)
+ UUID newSecundumUuid, String newSecundumDetail, boolean keepSecundumIfUndefined)
throws HomotypicalGroupChangeException;
/**
*
* @param taxon The taxon that is relatedTo
* @param type The type of TaxonRelationship (can be null)
- * @param includePublished should unpublished related taxa also be returned?
+ * @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
* @return a List of TaxonRelationship instances
*/
public List<TaxonRelationship> listToTaxonRelationships(Taxon taxon, TaxonRelationshipType type,
- boolean includePublished, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+ 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 includePublished should unpublished related taxa also be returned?
+ * @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
* @return a Pager of TaxonRelationship instances
*/
public Pager<TaxonRelationship> pageToTaxonRelationships(Taxon taxon, TaxonRelationshipType type,
- boolean includePublished, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+ 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 includePublished should unpublished related taxa also be returned?
+ * @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
* @return a List of TaxonRelationship instances
*/
public List<TaxonRelationship> listFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type,
- boolean includePublished, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+ 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 includePublished should unpublished related taxa also be returned?
+ * @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
* @return a Pager of TaxonRelationship instances
*/
public Pager<TaxonRelationship> pageFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type,
- boolean includePublished, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
+ 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
*
* @param types The taxon relationship type filter, if <code>null</code> no filter is set, if empty the result will also be empty
* @param pageSize the page size
- * @param pageStart the number of the start page
+ * @param pageStart the number of the page
* @param orderHints the order hints
* @param propertyPaths the property path to initialize the resulting objects
* @return list of taxon relationships matching the filter criteria
*/
public List<TaxonRelationship> listTaxonRelationships(Set<TaxonRelationshipType> types,
- Integer pageSize, Integer pageStart, List<OrderHint> orderHints, List<String> propertyPaths);
+ Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
/**
* Lists all classifications the given taxon/synonym is used in{@link Synonym}
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
* @return a list of TaxonBase instances
*/
- public Pager<TaxonBase> findTaxaByName(Class<? extends TaxonBase> clazz, String uninomial, String infragenericEpithet, String specificEpithet, String infraspecificEpithet, String authorship, Rank rank, Integer pageSize, Integer pageNumber);
+ public <T extends TaxonBase> Pager<T> findTaxaByName(Class<T> clazz, String uninomial, String infragenericEpithet, String specificEpithet,
+ String infraspecificEpithet, String authorshipCache, Rank rank, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
/**
* Returns a list of TaxonBase instances where the
* @param specificEpithet
* @param infraspecificEpithet
* @param rank
+ * @param authorshipCache
* @param pageSize The maximum number of taxa returned (can be null for all matching taxa)
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
* @return a List of TaxonBase instances
*/
- public List<TaxonBase> listTaxaByName(Class<? extends TaxonBase> clazz, String uninomial, String infragenericEpithet, String specificEpithet, String infraspecificEpithet, String authorship, Rank rank, Integer pageSize, Integer pageNumber);
+ public <T extends TaxonBase> List<T> listTaxaByName(Class<T> clazz, String uninomial, String infragenericEpithet, String specificEpithet,
+ String infraspecificEpithet, String authorshipCache, Rank rank, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
/**
* Returns a list of IdentifiableEntity instances (in particular, TaxonName and TaxonBase instances)
* that match the properties specified in the configurator.
- * @param configurator
- * @return
+ *
+ * Note: The search result includes a search on titleCache (with {@link MatchMode#BEGINNING} or {@link MatchMode#ANYWHERE} )
+ * for all records with protected titleCache (see #9561). Maybe this should be parameterized in future.
*/
public Pager<IdentifiableEntity> findTaxaAndNames(IFindTaxaAndNamesConfigurator configurator);
*/
@Deprecated
public Pager<SearchResult<TaxonBase>> findByEverythingFullText(String queryString,
- Classification classification, boolean includeUnpublished, 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 LuceneParseException
*/
public Pager<SearchResult<TaxonBase>> findByFullText(Class<? extends TaxonBase> clazz, String queryString,
- Classification classification, boolean includeUnpublished, List<Language> languages,
- boolean highlightFragments, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,
- List<String> propertyPaths) throws IOException, LuceneParseException;
+ 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;
-
+ 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;
- /**
- *
- * @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);
-
-
- /**
- * Lists all Media found in an any TaxonDescription associated with this
- * taxon.
- *
- * @param taxon
- * @param includeRelationships
- * the given list of TaxonRelationshipEdges will be taken into
- * account when retrieving media associated with the given taxon.
- * Can be NULL.
- * @param limitToGalleries
- * whether to take only TaxonDescription into account which are
- * marked as gallery
- * @return
- * @deprecated use {@link #listMedia(Taxon, Set, boolean, boolean, List)} instead
- */
- @Deprecated
- public List<Media> listTaxonDescriptionMedia(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships, boolean limitToGalleries, List<String> propertyPath);
-
- /**
+ /**
* Lists all Media found in an any TaxonDescription, NameDescription,
* SpecimenOrObservationBase, DnaSample Chromatograms, etc. associated with this taxon.
*
* @param includeTaxonDescriptions
* whether to take TaxonDescriptions into account, can be NULL
* @param includeOccurrences
- * whether to take TaxonDescriptions into account, can be NULL
+ * whether to take SpecimenDescriptions into account, can be NULL
+ * @param includeOriginals
+ * whether to take SpecimenDescriptions of the originals of associated derived units into account, can be NULL
* @param includeTaxonNameDescriptions
* whether to take TaxonNameDescriptions into account, can be NULL
* @param propertyPath
* @return
*/
public List<Media> listMedia(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships,
- Boolean limitToGalleries, Boolean includeTaxonDescriptions, Boolean includeOccurrences,
- Boolean includeTaxonNameDescriptions, List<String> propertyPath);
+ Boolean limitToGalleries, Boolean includeTaxonDescriptions, Boolean includeOccurrences, Boolean includeOriginals,
+ Boolean includeTaxonNameDescriptions, boolean includeUnpublished, List<String> propertyPath);
public List<TaxonBase> findTaxaByID(Set<Integer> listOfIDs);
* an accepted taxon are counted
* @return the number of synonyms
*/
- public int countSynonyms(boolean onlyAttachedToTaxon);
-
- public List<TaxonName> findIdenticalTaxonNames(List<String> propertyPath);
+ public long countSynonyms(boolean onlyAttachedToTaxon);
- public List<TaxonName> findIdenticalTaxonNameIds(List<String> propertyPath);
-//
-// public String getPhylumName(TaxonName name);
+ /**
+ * Returns a map of taxon names that have identical name caches but derive from different sources.
+ * The sources are defined via the sources reference uuid.
+ *
+ * @return map of nameCaches and taxon name maps where the key is the UUID of the according sourceRefUuid
+ */
+ public Map<String, Map<UUID,Set<TaxonName>>> findIdenticalTaxonNames(List<UUID> sourceRefUuids, List<String> propertyPaths);
/**
* Returns all {@link Taxon taxa} which are {@link TaxonRelationshipType#CONGRUENT_TO() congruent} or
* @param synonym
* @param removeNameIfPossible
* @return deleteResult
- *
*/
public DeleteResult deleteSynonym(Synonym synonym, SynonymDeletionConfigurator config);
*/
public DeleteResult deleteSynonym(UUID synonymUuid, SynonymDeletionConfigurator config);
- /**
- * @param tnb
- * @return
- */
public Taxon findBestMatchingTaxon(String taxonName);
public Taxon findBestMatchingTaxon(MatchingTaxonConfigurator config);
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);
-
/**
* @param clazz the optional {@link TaxonBase} subclass
* @param identifier the identifier string
* @see IIdentifiableEntityService#findByIdentifier(Class, String, DefinedTerm, MatchMode, boolean, Integer, Integer, List)
*/
public <S extends TaxonBase> Pager<IdentifiedEntityDTO<S>> findByIdentifier(
- Class<S> clazz, String identifier, DefinedTerm identifierType, TaxonNode subtreeFilter,
+ Class<S> clazz, String identifier, IdentifierType identifierType, TaxonNode subtreeFilter,
MatchMode matchmode, boolean includeEntity, Integer pageSize,
Integer pageNumber, List<String> propertyPaths);
TaxonNode subtreeFilter, boolean includeEntity, TaxonTitleType titleType,
Integer pageSize, Integer pageNumber, List<String> propertyPaths);
- /**
- * @param synonymUUid
- * @param acceptedTaxonUuid
- * @return
- */
- public UpdateResult swapSynonymAndAcceptedTaxon(UUID synonymUUid, UUID acceptedTaxonUuid);
-
- /**
- * @param taxonUuid
- * @param config
- * @param classificationUuid
- * @return
- */
public DeleteResult deleteTaxon(UUID taxonUuid, TaxonDeletionConfigurator config, UUID classificationUuid);
-
public UpdateResult moveFactualDateToAnotherTaxon(UUID fromTaxonUuid,
UUID toTaxonUuid);
-
- /**
- * @param synonymUuid
- * @param toTaxonUuid
- * @param taxonRelationshipType
- * @param citation
- * @param microcitation
- * @return
- */
public UpdateResult changeSynonymToRelatedTaxon(UUID synonymUuid, UUID toTaxonUuid, TaxonRelationshipType taxonRelationshipType,
Reference citation, String microcitation);
- /**
- * @param fromTaxonUuid
- * @param toTaxonUuid
- * @param oldRelationshipType
- * @param synonymType
- * @return
- * @throws DataChangeNoRollbackException
- */
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.
+ */
+ public TaxonRelationshipsDTO listTaxonRelationships(UUID taxonUuid,
+ Set<TaxonRelationshipType> directTypes,
+ Set<TaxonRelationshipType> inversTypes, Direction direction, boolean groupMisapplications,
+ boolean includeUnpublished, Integer pageSize, Integer pageNumber);
-
-
+ public <S extends TaxonBase> Pager<S> page(Class<S> clazz, List<Restriction<?>> restrictions, Integer pageSize, Integer pageIndex,
+ List<OrderHint> orderHints, List<String> propertyPaths, boolean includeUnpublished);
}