eu.etaxonomy.cdm.api.service
Class TaxonServiceImpl

java.lang.Object
  extended by eu.etaxonomy.cdm.api.service.ServiceBase<T,DAO>
      extended by eu.etaxonomy.cdm.api.service.VersionableServiceBase<T,DAO>
          extended by eu.etaxonomy.cdm.api.service.AnnotatableServiceBase<T,DAO>
              extended by eu.etaxonomy.cdm.api.service.IdentifiableServiceBase<TaxonBase,ITaxonDao>
                  extended by eu.etaxonomy.cdm.api.service.TaxonServiceImpl
All Implemented Interfaces:
IAnnotatableService<TaxonBase>, IIdentifiableEntityService<TaxonBase>, IService<TaxonBase>, ITaxonService, IVersionableService<TaxonBase>, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Service
@Transactional(readOnly=true)
public class TaxonServiceImpl
extends IdentifiableServiceBase<TaxonBase,ITaxonDao>
implements ITaxonService

Author:
a.kohlbecker

Field Summary
static String INFERRED_EPITHET_NAMESPACE
           
static String INFERRED_GENUS_NAMESPACE
           
static String POTENTIAL_COMBINATION_NAMESPACE
           
 
Fields inherited from class eu.etaxonomy.cdm.api.service.IdentifiableServiceBase
commonService, UPDATE_TITLE_CACHE_DEFAULT_STEP_SIZE
 
Fields inherited from class eu.etaxonomy.cdm.api.service.ServiceBase
appContext, dao
 
Constructor Summary
TaxonServiceImpl()
          Constructor
 
Method Summary
 void changeHomotypicalGroupOfSynonym(Synonym synonym, HomotypicalGroup newHomotypicalGroup, Taxon targetTaxon, boolean removeFromOtherTaxa, boolean setBasionymRelationIfApplicable)
          Changes the homotypic group of a synonym into the new homotypic group.
 Taxon changeSynonymToAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon, boolean deleteSynonym, boolean copyCitationInfo, Reference citation, String microCitation)
          Changes a synonym into an accepted taxon and removes the synonym relationship to the given accepted taxon.
 Taxon changeSynonymToRelatedTaxon(Synonym synonym, Taxon toTaxon, TaxonRelationshipType taxonRelationshipType, Reference citation, String microcitation)
          TODO still needed and correct? Change a synonym into a related concept
 int countAllRelationships()
           
 List<Synonym> createAllInferredSynonyms(Taxon taxon, Classification tree, boolean doWithMisappliedNames)
          Creates all inferred synonyms for the taxon in the classification, but do not insert it to the database
 List<Synonym> createInferredSynonyms(Taxon taxon, Classification classification, SynonymRelationshipType type, boolean doWithMisappliedNames)
          Creates the specified inferred synonyms for the taxon in the classification, but do not insert it to the database
 void deleteSynonym(Synonym synonym, Taxon taxon, boolean removeNameIfPossible, boolean newHomotypicGroupIfNeeded)
          Removes a synonym.

In detail it removes all synonym relationship to the given taxon or to all taxa if taxon is null the synonym concept if it is not referenced by any synonym relationship anymore

If removeNameIfPossible is true it also removes the synonym name if it is not used in any other context (part of a concept, in DescriptionElementSource, part of a name relationship, used inline, ...)

If newHomotypicGroupIfNeeded is true and the synonym name is not deleted and the name is homotypic to the taxon the name is moved to a new homotypical group.

If synonym is null the method has no effect.
 long deleteSynonymRelationships(Synonym syn)
           
 long deleteSynonymRelationships(Synonym syn, Taxon taxon)
          Deletes all synonym relationships of a given synonym.
 void deleteTaxon(Taxon taxon, TaxonDeletionConfigurator config)
          Deletes a taxon from the underlying database according to the given configurator.
 Synonym findBestMatchingSynonym(String taxonName)
           
 Taxon findBestMatchingTaxon(MatchingTaxonConfigurator config)
           
 Taxon findBestMatchingTaxon(String taxonName)
           
 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)
          This is an experimental feature, it may be moved, modified, or even removed in future releases!!!
 Pager<SearchResult<TaxonBase>> findByEverythingFullText(String queryString, Classification classification, List<Language> languages, boolean highlightFragments, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
           
 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)
           
 List<TaxonNameBase> findIdenticalTaxonNameIds(List<String> propertyPath)
           
 List<TaxonNameBase> findIdenticalTaxonNames(List<String> propertyPath)
           
 Pager<IdentifiableEntity> findTaxaAndNames(IFindTaxaAndNamesConfigurator configurator)
          Returns a list of IdentifiableEntity instances (in particular, TaxonNameBase and TaxonBase instances) that match the properties specified in the configurator.
 List<UuidAndTitleCache<TaxonBase>> findTaxaAndNamesForEditor(IFindTaxaAndNamesConfigurator configurator)
           
 List<TaxonBase> findTaxaByID(Set<Integer> listOfIDs)
           
 Pager<TaxonBase> findTaxaByName(Class<? extends TaxonBase> clazz, String uninomial, String infragenericEpithet, String specificEpithet, String infraspecificEpithet, Rank rank, Integer pageSize, Integer pageNumber)
          Returns a list of TaxonBase instances where the taxon.name properties match the parameters passed.
 TaxonBase findTaxonByUuid(UUID uuid, List<String> propertyPaths)
          Returns the TaxonBase with the given UUID using the given match mode and initialization strategy
 List<MediaRepresentation> getAllMedia(Taxon taxon, int size, int height, int widthOrDuration, String[] mimeTypes)
           
 List<RelationshipBase> getAllRelationships(int limit, int start)
          Computes all relationships.
 List<Synonym> getAllSynonyms(int limit, int start)
          FIXME Candidate for harmonization list(Synonym.class, ...) (non-Javadoc)
 List<Taxon> getAllTaxa(int limit, int start)
          FIXME Candidate for harmonization list(Taxon.class, ...) (non-Javadoc)
 List<List<Synonym>> getHeterotypicSynonymyGroups(Taxon taxon, List<String> propertyPaths)
          Returns the ordered list of all homotypical groups that contain synonyms that are heterotypic to the given taxon.
 List<Synonym> getHomotypicSynonymsByHomotypicGroup(Taxon taxon, List<String> propertyPaths)
          Returns the list of all synonyms that share the same homotypical group with the given taxon.
 String getPhylumName(TaxonNameBase name)
           
 List<Taxon> getRootTaxa(Rank rank, Reference sec, boolean onlyWithChildren, boolean withMisapplications, List<String> propertyPaths)
          Computes all Taxon instances which name is of a certain Rank.
 List<Taxon> getRootTaxa(Reference sec, CdmFetch cdmFetch, boolean onlyWithChildren)
          FIXME Candidate for harmonization merge with getRootTaxa(Reference sec, ..., ...) (non-Javadoc)
 Pager<SynonymRelationship> getSynonyms(Synonym synonym, SynonymRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied) where the supplied synonym is relatedFrom.
 Pager<SynonymRelationship> getSynonyms(Taxon taxon, SynonymRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied) where the supplied taxon is relatedTo.
 OrderedTermVocabulary<TaxonRelationshipType> getTaxonRelationshipTypeVocabulary()
          Deprecated. 
 List<UuidAndTitleCache<TaxonBase>> getTaxonUuidAndTitleCache()
           
 List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheSynonym()
           
 List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheTaxon()
           
 List<Classification> listClassifications(TaxonBase taxonBase, Integer limit, Integer start, List<String> propertyPaths)
          lists all accepted taxa for the given Synonym
 List<TaxonRelationship> listFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) where the supplied taxon is relatedFrom.
 List<Media> listMedia(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships, Boolean limitToGalleries, Boolean includeTaxonDescriptions, Boolean includeOccurrences, Boolean includeTaxonNameDescriptions, List<String> propertyPath)
          Lists all Media found in an any TaxonDescription, NameDescription, SpecimenOrObservationBase, DnaSample Chromatograms, etc.
 Set<Taxon> listRelatedTaxa(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships, Integer maxDepth, Integer limit, Integer start, List<String> propertyPaths)
          lists all taxa which are related to the taxon given as parameter.
 List<SynonymRelationship> listSynonymRelationships(TaxonBase taxonBase, SynonymRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths, RelationshipBase.Direction direction)
          Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied) depending on direction, where the supplied taxon is relatedTo or the supplied synonym is relatedFrom.
 List<TaxonBase> listTaxaByName(Class<? extends TaxonBase> clazz, String uninomial, String infragenericEpithet, String specificEpithet, String infraspecificEpithet, Rank rank, Integer pageSize, Integer pageNumber)
          Returns a list of TaxonBase instances where the taxon.name properties match the parameters passed.
 List<Media> listTaxonDescriptionMedia(Taxon taxon, Set<TaxonRelationshipEdge> includeRelationships, boolean limitToGalleries, List<String> propertyPath)
          Lists all Media found in an any TaxonDescription associated with this taxon.
 List<TaxonRelationship> listToTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) where the supplied taxon is relatedTo.
 SynonymRelationship moveSynonymToAnotherTaxon(SynonymRelationship oldSynonymRelation, Taxon newTaxon, boolean moveHomotypicGroup, SynonymRelationshipType newSynonymRelationshipType, Reference reference, String referenceDetail, boolean keepReference)
          Moves a synonym to another taxon and removes the old synonym relationship.
 Pager<TaxonRelationship> pageFromTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) where the supplied taxon is relatedFrom.
 Pager<TaxonRelationship> pageToTaxonRelationships(Taxon taxon, TaxonRelationshipType type, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns the TaxonRelationships (of where relationship.type == type, if this arguement is supplied) where the supplied taxon is relatedTo.
protected  LuceneSearch prepareByDescriptionElementFullTextSearch(Class<? extends CdmBase> clazz, String queryString, Classification classification, List<Feature> features, List<Language> languages, boolean highlightFragments)
           
protected  LuceneSearch prepareFindByFullTextSearch(Class<? extends CdmBase> clazz, String queryString, Classification classification, List<Language> languages, boolean highlightFragments)
           
 List<TaxonBase> searchTaxaByName(String name, Reference sec)
          FIXME Candidate for harmonization rename searchByName ?
protected  void setDao(ITaxonDao dao)
           
 void swapSynonymAndAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon)
          Swaps given synonym and accepted taxon.
 void updateTitleCache(Class<? extends TaxonBase> clazz, Integer stepSize, IIdentifiableEntityCacheStrategy<TaxonBase> cacheStrategy, IProgressMonitor monitor)
          (Re-)generate the title caches for all objects of this concrete IdentifiableEntity class
 
Methods inherited from class eu.etaxonomy.cdm.api.service.IdentifiableServiceBase
countByTitle, countByTitle, deduplicate, find, findByTitle, findByTitle, findCdmObjectsByTitle, findCdmObjectsByTitle, findCdmObjectsByTitle, findTitleCache, getRights, getSourcedObjectByIdInSource, getSources, getUuidAndTitleCache, listByReferenceTitle, listByTitle, replace, search, setOtherCachesNull, updateTitleCache, updateTitleCacheImpl
 
Methods inherited from class eu.etaxonomy.cdm.api.service.AnnotatableServiceBase
countMarkers, getAnnotations, getMarkers, groupMarkers
 
Methods inherited from class eu.etaxonomy.cdm.api.service.VersionableServiceBase
getNextAuditEvent, getPreviousAuditEvent, pageAuditEvents, pageAuditEvents
 
Methods inherited from class eu.etaxonomy.cdm.api.service.ServiceBase
clear, count, delete, exists, find, find, find, findById, getSession, group, list, list, load, load, lock, merge, page, refresh, refresh, rows, save, save, saveOrUpdate, saveOrUpdate, setApplicationContext, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface eu.etaxonomy.cdm.api.service.ITaxonService
search
 
Methods inherited from interface eu.etaxonomy.cdm.api.service.IIdentifiableEntityService
countByTitle, countByTitle, deduplicate, find, findByTitle, findByTitle, findTitleCache, getRights, getSourcedObjectByIdInSource, getSources, getUuidAndTitleCache, listByReferenceTitle, listByTitle, replace, updateTitleCache
 
Methods inherited from interface eu.etaxonomy.cdm.api.service.IAnnotatableService
countMarkers, getAnnotations, getMarkers, groupMarkers
 
Methods inherited from interface eu.etaxonomy.cdm.api.service.IVersionableService
getNextAuditEvent, getPreviousAuditEvent, pageAuditEvents, pageAuditEvents
 
Methods inherited from interface eu.etaxonomy.cdm.api.service.IService
clear, count, delete, exists, find, find, find, findById, getSession, group, list, list, load, load, lock, merge, page, refresh, refresh, rows, save, save, saveOrUpdate, saveOrUpdate, update
 

Field Detail

POTENTIAL_COMBINATION_NAMESPACE

public static final String POTENTIAL_COMBINATION_NAMESPACE
See Also:
Constant Field Values

INFERRED_EPITHET_NAMESPACE

public static final String INFERRED_EPITHET_NAMESPACE
See Also:
Constant Field Values

INFERRED_GENUS_NAMESPACE

public static final String INFERRED_GENUS_NAMESPACE
See Also:
Constant Field Values
Constructor Detail

TaxonServiceImpl

public TaxonServiceImpl()
Constructor

Method Detail

searchTaxaByName

public List<TaxonBase> searchTaxaByName(String name,
                                        Reference sec)
FIXME Candidate for harmonization rename searchByName ?

Specified by:
searchTaxaByName in interface ITaxonService
Parameters:
name - the name string to search for
sec - the taxons sec reference
Returns:
a list of taxa matching the name and the sec reference

getAllSynonyms

public List<Synonym> getAllSynonyms(int limit,
                                    int start)
FIXME Candidate for harmonization list(Synonym.class, ...) (non-Javadoc)

Specified by:
getAllSynonyms in interface ITaxonService
Returns:
FIXME could substitute with list(Synonym.class, limit, start)
See Also:
ITaxonService.getAllSynonyms(int, int)

getAllTaxa

public List<Taxon> getAllTaxa(int limit,
                              int start)
FIXME Candidate for harmonization list(Taxon.class, ...) (non-Javadoc)

Specified by:
getAllTaxa in interface ITaxonService
Returns:
FIXME could substitute with list(Taxon.class, limit,start)
See Also:
ITaxonService.getAllTaxa(int, int)

getRootTaxa

public List<Taxon> getRootTaxa(Reference sec,
                               CdmFetch cdmFetch,
                               boolean onlyWithChildren)
FIXME Candidate for harmonization merge with getRootTaxa(Reference sec, ..., ...) (non-Javadoc)

Specified by:
getRootTaxa in interface ITaxonService
Parameters:
sec - The concept reference that the taxon belongs to
onlyWithChildren - if true only taxa are returned that have taxonomic children.
Default: true.
Returns:
The List of root taxa.
See Also:
eu.etaxonomy.cdm.api.service.ITaxonService#getRootTaxa(eu.etaxonomy.cdm.model.reference.Reference, boolean)

getRootTaxa

public List<Taxon> getRootTaxa(Rank rank,
                               Reference sec,
                               boolean onlyWithChildren,
                               boolean withMisapplications,
                               List<String> propertyPaths)
Description copied from interface: ITaxonService
Computes all Taxon instances which name is of a certain Rank.

Specified by:
getRootTaxa in interface ITaxonService
Parameters:
rank - The rank of the taxon name
sec - The concept reference that the taxon belongs to
onlyWithChildren - if true only taxa are returned that have taxonomic children.
Default: true.
withMisapplications - if false taxa that have at least one misapplied name relationship in which they are the misapplied name are not returned.
Default: true.
propertyPaths - properties to be initialized, For detailed description and examples please refer to: IBeanInitializer.initialize(Object, List).
Default: true.
Returns:
The List of root taxa.

getAllRelationships

public List<RelationshipBase> getAllRelationships(int limit,
                                                  int start)
Description copied from interface: ITaxonService
Computes all relationships.

Specified by:
getAllRelationships in interface ITaxonService
Returns:
FIXME candidate for harmonization - rename to listRelationships

getTaxonRelationshipTypeVocabulary

@Deprecated
public OrderedTermVocabulary<TaxonRelationshipType> getTaxonRelationshipTypeVocabulary()
Deprecated. 

FIXME Candidate for harmonization is this the same as termService.getVocabulary(VocabularyEnum.TaxonRelationshipType) ?

Specified by:
getTaxonRelationshipTypeVocabulary in interface ITaxonService
Returns:

swapSynonymAndAcceptedTaxon

@Transactional(readOnly=false)
public void swapSynonymAndAcceptedTaxon(Synonym synonym,
                                                      Taxon acceptedTaxon)
Description copied from interface: ITaxonService
Swaps given synonym and accepted taxon. In particular:

Specified by:
swapSynonymAndAcceptedTaxon in interface ITaxonService

changeSynonymToAcceptedTaxon

@Transactional(readOnly=false)
public Taxon changeSynonymToAcceptedTaxon(Synonym synonym,
                                                        Taxon acceptedTaxon,
                                                        boolean deleteSynonym,
                                                        boolean copyCitationInfo,
                                                        Reference citation,
                                                        String microCitation)
                                   throws HomotypicalGroupChangeException
Description copied from interface: ITaxonService
Changes a synonym into an accepted taxon and removes the synonym relationship to the given accepted taxon. Other synonyms homotypic to the synonym to change are moved to the same new accepted taxon as homotypic synonyms. The new accepted taxon has the same name and the same sec reference as the old synonym.
If the given accepted taxon and the synonym are homotypic to each other an exception may be thrown as taxonomically it doesn't make sense to have two accepted taxa in the same homotypic group but also it is than difficult to decide how to handle other names in the homotypic group. It is up to the implementing class to handle this situation via an exception or in another way. TODO Open issue: does the old synonym need to be deleted from the database?

Specified by:
changeSynonymToAcceptedTaxon in interface ITaxonService
Parameters:
synonym - the synonym to change into an accepted taxon
acceptedTaxon - an accepted taxon, the synonym had a relationship to
deleteSynonym - if true the method tries to delete the old synonym from the database
copyCitationInfo - if true the citation and the microcitation of newly created synonyms is taken from the old synonym relationships.
citation - if given this citation is added to the newly created synonym relationships as citation. Only used if copyCitationInfo is false
microCitation - if given this microCitation is added to the newly created synonym relationships as microCitation.Only used if copyCitationInfo is false
Returns:
the newly created accepted taxon
Throws:
HomotypicalGroupChangeException

changeSynonymToRelatedTaxon

public Taxon changeSynonymToRelatedTaxon(Synonym synonym,
                                         Taxon toTaxon,
                                         TaxonRelationshipType taxonRelationshipType,
                                         Reference citation,
                                         String microcitation)
Description copied from interface: ITaxonService
TODO still needed and correct? Change a synonym into a related concept

Specified by:
changeSynonymToRelatedTaxon in interface ITaxonService
Parameters:
synonym - the synonym to change into the concept taxon
toTaxon - the taxon the newly created concept should be related to
taxonRelationshipType - the type of relationship
Returns:
the newly created concept

changeHomotypicalGroupOfSynonym

@Transactional(readOnly=false)
public void changeHomotypicalGroupOfSynonym(Synonym synonym,
                                                          HomotypicalGroup newHomotypicalGroup,
                                                          Taxon targetTaxon,
                                                          boolean removeFromOtherTaxa,
                                                          boolean setBasionymRelationIfApplicable)
Description copied from interface: ITaxonService
Changes the homotypic group of a synonym into the new homotypic group. All relations to taxa are updated correctly depending on the homotypic group of the accepted taxon.
All existing basionym relationships to and from this name are removed.
If the parameter targetTaxon is defined, the synonym is added to this taxon irrespctive of if it has been related to this taxon before.
If removeFromOtherTaxa is true and targetTaxon is defined all relationships to other taxa are deleted.
If setBasionymRelationIfApplicable is true a basionym relationship between the existing basionym(s) of the new homotypic group and the synonyms name is added.

Specified by:
changeHomotypicalGroupOfSynonym in interface ITaxonService

updateTitleCache

@Transactional(readOnly=false)
public void updateTitleCache(Class<? extends TaxonBase> clazz,
                                           Integer stepSize,
                                           IIdentifiableEntityCacheStrategy<TaxonBase> cacheStrategy,
                                           IProgressMonitor monitor)
Description copied from interface: IIdentifiableEntityService
(Re-)generate the title caches for all objects of this concrete IdentifiableEntity class

Specified by:
updateTitleCache in interface IIdentifiableEntityService<TaxonBase>
Parameters:
clazz - class of objects to be updated
stepSize - number of objects loaded per step. If null use default.
cacheStrategy - cachestrategy used for title cache. If null use default.
monitor - progress monitor. If null use default.

setDao

@Autowired
protected void setDao(ITaxonDao dao)
Specified by:
setDao in class ServiceBase<TaxonBase,ITaxonDao>

findTaxaByName

public Pager<TaxonBase> findTaxaByName(Class<? extends TaxonBase> clazz,
                                       String uninomial,
                                       String infragenericEpithet,
                                       String specificEpithet,
                                       String infraspecificEpithet,
                                       Rank rank,
                                       Integer pageSize,
                                       Integer pageNumber)
Description copied from interface: ITaxonService
Returns a list of TaxonBase instances where the taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of null will search for those taxa with a value of null in that field

Specified by:
findTaxaByName in interface ITaxonService
Parameters:
clazz - optionally filter by class (can be null to return all taxa)
pageSize - The maximum number of taxa returned (can be null for all matching taxa)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
Returns:
a list of TaxonBase instances

listTaxaByName

public List<TaxonBase> listTaxaByName(Class<? extends TaxonBase> clazz,
                                      String uninomial,
                                      String infragenericEpithet,
                                      String specificEpithet,
                                      String infraspecificEpithet,
                                      Rank rank,
                                      Integer pageSize,
                                      Integer pageNumber)
Description copied from interface: ITaxonService
Returns a list of TaxonBase instances where the taxon.name properties match the parameters passed. In order to search for any string value, pass '*', passing the string value of null will search for those taxa with a value of null in that field

Specified by:
listTaxaByName in interface ITaxonService
Parameters:
clazz - optionally filter by class
pageSize - The maximum number of taxa returned (can be null for all matching taxa)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
Returns:
a List of TaxonBase instances

listToTaxonRelationships

public List<TaxonRelationship> listToTaxonRelationships(Taxon taxon,
                                                        TaxonRelationshipType type,
                                                        Integer pageSize,
                                                        Integer pageNumber,
                                                        List<OrderHint> orderHints,
                                                        List<String> propertyPaths)
Description copied from interface: ITaxonService
Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) where the supplied taxon is relatedTo.

Specified by:
listToTaxonRelationships in interface ITaxonService
Parameters:
taxon - The taxon that is relatedTo
type - The type of TaxonRelationship (can be null)
pageSize - The maximum number of relationships returned (can be null for all relationships)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
orderHints - Properties to order by
propertyPaths - Properties to initialize in the returned entities, following the syntax described in IBeanInitializer.initialize(Object, List)
Returns:
a List of TaxonRelationship instances

pageToTaxonRelationships

public Pager<TaxonRelationship> pageToTaxonRelationships(Taxon taxon,
                                                         TaxonRelationshipType type,
                                                         Integer pageSize,
                                                         Integer pageNumber,
                                                         List<OrderHint> orderHints,
                                                         List<String> propertyPaths)
Description copied from interface: ITaxonService
Returns the TaxonRelationships (of where relationship.type == type, if this arguement is supplied) where the supplied taxon is relatedTo.

Specified by:
pageToTaxonRelationships in interface ITaxonService
Parameters:
taxon - The taxon that is relatedTo
type - The type of TaxonRelationship (can be null)
pageSize - The maximum number of relationships returned (can be null for all relationships)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
orderHints - Properties to order by
propertyPaths - Properties to initialize in the returned entities, following the syntax described in IBeanInitializer.initialize(Object, List)
Returns:
a Pager of TaxonRelationship instances

listFromTaxonRelationships

public List<TaxonRelationship> listFromTaxonRelationships(Taxon taxon,
                                                          TaxonRelationshipType type,
                                                          Integer pageSize,
                                                          Integer pageNumber,
                                                          List<OrderHint> orderHints,
                                                          List<String> propertyPaths)
Description copied from interface: ITaxonService
Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) where the supplied taxon is relatedFrom.

Specified by:
listFromTaxonRelationships in interface ITaxonService
Parameters:
taxon - The taxon that is relatedFrom
type - The type of TaxonRelationship (can be null)
pageSize - The maximum number of relationships returned (can be null for all relationships)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
orderHints - Properties to order by
propertyPaths - Properties to initialize in the returned entities, following the syntax described in IBeanInitializer.initialize(Object, List)
Returns:
a List of TaxonRelationship instances

pageFromTaxonRelationships

public Pager<TaxonRelationship> pageFromTaxonRelationships(Taxon taxon,
                                                           TaxonRelationshipType type,
                                                           Integer pageSize,
                                                           Integer pageNumber,
                                                           List<OrderHint> orderHints,
                                                           List<String> propertyPaths)
Description copied from interface: ITaxonService
Returns the TaxonRelationships (of where relationship.type == type, if this argument is supplied) where the supplied taxon is relatedFrom.

Specified by:
pageFromTaxonRelationships in interface ITaxonService
Parameters:
taxon - The taxon that is relatedFrom
type - The type of TaxonRelationship (can be null)
pageSize - The maximum number of relationships returned (can be null for all relationships)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
orderHints - Properties to order by
propertyPaths - Properties to initialize in the returned entities, following the syntax described in IBeanInitializer.initialize(Object, List)
Returns:
a Pager of TaxonRelationship instances

listRelatedTaxa

public Set<Taxon> listRelatedTaxa(Taxon taxon,
                                  Set<TaxonRelationshipEdge> includeRelationships,
                                  Integer maxDepth,
                                  Integer limit,
                                  Integer start,
                                  List<String> propertyPaths)
Description copied from interface: ITaxonService
lists all taxa which are related to the taxon given as parameter.

Specified by:
listRelatedTaxa in interface ITaxonService
Parameters:
taxon -
includeRelationships -
maxDepth -
limit -
starts -
propertyPaths -
Returns:
an List which is not specifically ordered

getSynonyms

public Pager<SynonymRelationship> getSynonyms(Taxon taxon,
                                              SynonymRelationshipType type,
                                              Integer pageSize,
                                              Integer pageNumber,
                                              List<OrderHint> orderHints,
                                              List<String> propertyPaths)
Description copied from interface: ITaxonService
Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied) where the supplied taxon is relatedTo.

Specified by:
getSynonyms in interface ITaxonService
Parameters:
taxon - The taxon that is relatedTo
type - The type of SynonymRelationship (can be null)
pageSize - The maximum number of relationships returned (can be null for all relationships)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based) * @param orderHints Properties to order by
propertyPaths - Properties to initialize in the returned entities, following the syntax described in IBeanInitializer.initialize(Object, List)
Returns:
a Pager of SynonymRelationship instances

getSynonyms

public Pager<SynonymRelationship> getSynonyms(Synonym synonym,
                                              SynonymRelationshipType type,
                                              Integer pageSize,
                                              Integer pageNumber,
                                              List<OrderHint> orderHints,
                                              List<String> propertyPaths)
Description copied from interface: ITaxonService
Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied) where the supplied synonym is relatedFrom.

Specified by:
getSynonyms in interface ITaxonService
type - The type of SynonymRelationship (can be null)
pageSize - The maximum number of relationships returned (can be null for all relationships)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based) * @param orderHints Properties to order by
propertyPaths - Properties to initialize in the returned entities, following the syntax described in IBeanInitializer.initialize(Object, List)
Returns:
a Pager of SynonymRelationship instances

getHomotypicSynonymsByHomotypicGroup

public List<Synonym> getHomotypicSynonymsByHomotypicGroup(Taxon taxon,
                                                          List<String> propertyPaths)
Description copied from interface: ITaxonService
Returns the list of all synonyms that share the same homotypical group with the given taxon. Only those homotypic synonyms are returned that do have a synonym relationship with the accepted taxon.

Specified by:
getHomotypicSynonymsByHomotypicGroup in interface ITaxonService
Returns:

getHeterotypicSynonymyGroups

public List<List<Synonym>> getHeterotypicSynonymyGroups(Taxon taxon,
                                                        List<String> propertyPaths)
Description copied from interface: ITaxonService
Returns the ordered list of all homotypical groups that contain synonyms that are heterotypic to the given taxon. Taxon names of heterotypic synonyms belong to a homotypical group which cannot be the homotypical group to which the taxon name of the given taxon belongs. This method does not return the homotypic group the given taxon belongs to.
This method does neglect the type of synonym relationship that is defined between the given taxon and the synonym. So the synonym relationship may be homotypic however a synonym is returned in one of the result lists as long as the synonym does not belong to the same homotypic group as the given taxon.
The list returned is ordered according to the date of publication of the first published name within each homotypical group.

Specified by:
getHeterotypicSynonymyGroups in interface ITaxonService
Returns:
See Also:
#getHeterotypicSynonymyGroups(), #getSynonyms(), SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF(), HomotypicalGroup

findTaxaAndNamesForEditor

public List<UuidAndTitleCache<TaxonBase>> findTaxaAndNamesForEditor(IFindTaxaAndNamesConfigurator configurator)
Specified by:
findTaxaAndNamesForEditor in interface ITaxonService

findTaxaAndNames

public Pager<IdentifiableEntity> findTaxaAndNames(IFindTaxaAndNamesConfigurator configurator)
Description copied from interface: ITaxonService
Returns a list of IdentifiableEntity instances (in particular, TaxonNameBase and TaxonBase instances) that match the properties specified in the configurator.

Specified by:
findTaxaAndNames in interface ITaxonService
Returns:

getTaxonUuidAndTitleCache

public List<UuidAndTitleCache<TaxonBase>> getTaxonUuidAndTitleCache()

getAllMedia

public List<MediaRepresentation> getAllMedia(Taxon taxon,
                                             int size,
                                             int height,
                                             int widthOrDuration,
                                             String[] mimeTypes)
Specified by:
getAllMedia in interface ITaxonService
Returns:

listTaxonDescriptionMedia

public List<Media> listTaxonDescriptionMedia(Taxon taxon,
                                             Set<TaxonRelationshipEdge> includeRelationships,
                                             boolean limitToGalleries,
                                             List<String> propertyPath)
Description copied from interface: ITaxonService
Lists all Media found in an any TaxonDescription associated with this taxon.

Specified by:
listTaxonDescriptionMedia in interface ITaxonService
includeRelationships - the given list of TaxonRelationshipEdges will be taken into account when retrieving media associated with the given taxon. Can be NULL.
limitToGalleries - whether to take only TaxonDescription into account which are marked as gallery
Returns:

listMedia

public List<Media> listMedia(Taxon taxon,
                             Set<TaxonRelationshipEdge> includeRelationships,
                             Boolean limitToGalleries,
                             Boolean includeTaxonDescriptions,
                             Boolean includeOccurrences,
                             Boolean includeTaxonNameDescriptions,
                             List<String> propertyPath)
Description copied from interface: ITaxonService
Lists all Media found in an any TaxonDescription, NameDescription, SpecimenOrObservationBase, DnaSample Chromatograms, etc. associated with this taxon.

Specified by:
listMedia in interface ITaxonService
includeRelationships - the given list of TaxonRelationshipEdges will be taken into account when retrieving media associated with the given taxon. Can be NULL.
limitToGalleries - whether to take only descriptions into account which are marked as gallery, can be NULL
includeTaxonDescriptions - whether to take TaxonDescriptions into account, can be NULL
includeOccurrences - whether to take TaxonDescriptions into account, can be NULL
includeTaxonNameDescriptions - whether to take TaxonNameDescriptions into account, can be NULL
Returns:

findTaxaByID

public List<TaxonBase> findTaxaByID(Set<Integer> listOfIDs)
Specified by:
findTaxaByID in interface ITaxonService

findTaxonByUuid

public TaxonBase findTaxonByUuid(UUID uuid,
                                 List<String> propertyPaths)
Description copied from interface: ITaxonService
Returns the TaxonBase with the given UUID using the given match mode and initialization strategy

Specified by:
findTaxonByUuid in interface ITaxonService
Returns:

countAllRelationships

public int countAllRelationships()
Specified by:
countAllRelationships in interface ITaxonService

findIdenticalTaxonNames

public List<TaxonNameBase> findIdenticalTaxonNames(List<String> propertyPath)
Specified by:
findIdenticalTaxonNames in interface ITaxonService

deleteTaxon

public void deleteTaxon(Taxon taxon,
                        TaxonDeletionConfigurator config)
                 throws ReferencedObjectUndeletableException
Description copied from interface: ITaxonService
Deletes a taxon from the underlying database according to the given configurator.

Specified by:
deleteTaxon in interface ITaxonService
Throws:
ReferencedObjectUndeletableException

deleteSynonym

@Transactional(readOnly=false)
public void deleteSynonym(Synonym synonym,
                                        Taxon taxon,
                                        boolean removeNameIfPossible,
                                        boolean newHomotypicGroupIfNeeded)
Description copied from interface: ITaxonService
Removes a synonym.

In detail it removes
  • all synonym relationship to the given taxon or to all taxa if taxon is null
  • the synonym concept if it is not referenced by any synonym relationship anymore


  • If removeNameIfPossible is true it also removes the synonym name if it is not used in any other context (part of a concept, in DescriptionElementSource, part of a name relationship, used inline, ...)

    If newHomotypicGroupIfNeeded is true and the synonym name is not deleted and the name is homotypic to the taxon the name is moved to a new homotypical group.

    If synonym is null the method has no effect.

    Specified by:
    deleteSynonym in interface ITaxonService

    findIdenticalTaxonNameIds

    public List<TaxonNameBase> findIdenticalTaxonNameIds(List<String> propertyPath)
    Specified by:
    findIdenticalTaxonNameIds in interface ITaxonService

    getPhylumName

    public String getPhylumName(TaxonNameBase name)
    Specified by:
    getPhylumName in interface ITaxonService

    deleteSynonymRelationships

    public long deleteSynonymRelationships(Synonym syn,
                                           Taxon taxon)
    Description copied from interface: ITaxonService
    Deletes all synonym relationships of a given synonym. If taxon is given only those relationships to the taxon are deleted.

    Specified by:
    deleteSynonymRelationships in interface ITaxonService
    Parameters:
    syn - the synonym
    Returns:

    deleteSynonymRelationships

    public long deleteSynonymRelationships(Synonym syn)
    Specified by:
    deleteSynonymRelationships in interface ITaxonService

    listSynonymRelationships

    public List<SynonymRelationship> listSynonymRelationships(TaxonBase taxonBase,
                                                              SynonymRelationshipType type,
                                                              Integer pageSize,
                                                              Integer pageNumber,
                                                              List<OrderHint> orderHints,
                                                              List<String> propertyPaths,
                                                              RelationshipBase.Direction direction)
    Description copied from interface: ITaxonService
    Returns the SynonymRelationships (of where relationship.type == type, if this argument is supplied) depending on direction, where the supplied taxon is relatedTo or the supplied synonym is relatedFrom.

    Specified by:
    listSynonymRelationships in interface ITaxonService
    Parameters:
    taxonBase - The taxon or synonym that is relatedTo or relatedFrom
    type - The type of SynonymRelationship (can be null)
    pageSize - The maximum number of relationships returned (can be null for all relationships)
    pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
    orderHints - Properties to order by
    propertyPaths - Properties to initialize in the returned entities, following the syntax described in IBeanInitializer.initialize(Object, List)
    direction - The direction of the relationship
    Returns:
    a List of SynonymRelationship instances

    findBestMatchingTaxon

    public Taxon findBestMatchingTaxon(String taxonName)
    Specified by:
    findBestMatchingTaxon in interface ITaxonService
    Returns:

    findBestMatchingTaxon

    public Taxon findBestMatchingTaxon(MatchingTaxonConfigurator config)
    Specified by:
    findBestMatchingTaxon in interface ITaxonService

    findBestMatchingSynonym

    public Synonym findBestMatchingSynonym(String taxonName)
    Specified by:
    findBestMatchingSynonym in interface ITaxonService

    moveSynonymToAnotherTaxon

    public SynonymRelationship moveSynonymToAnotherTaxon(SynonymRelationship oldSynonymRelation,
                                                         Taxon newTaxon,
                                                         boolean moveHomotypicGroup,
                                                         SynonymRelationshipType newSynonymRelationshipType,
                                                         Reference reference,
                                                         String referenceDetail,
                                                         boolean keepReference)
                                                  throws HomotypicalGroupChangeException
    Description copied from interface: ITaxonService
    Moves a synonym to another taxon and removes the old synonym relationship.

    Specified by:
    moveSynonymToAnotherTaxon in interface ITaxonService
    Parameters:
    oldSynonymRelation - the old synonym relationship defining the synonym to move and the old accepted taxon.
    newTaxon - the taxon the synonym will be moved to
    moveHomotypicGroup - if the synonym belongs to a homotypical group with other synonyms and moveHomotypicGroup is true all these synonyms are moved to the new taxon, if false a HomotypicalGroupChangeException is thrown. MoveHomotypicGroup has no effect if the synonym is the only synonym in it's homotypic group.
    newSynonymRelationshipType - the synonym relationship type of the new synonym relations. Default is heterotypic.
    reference - The reference for the new synonym relation(s).
    referenceDetail - The reference detail for the new synonym relation(s).
    keepReference - if no newReference and/or no newReferenceDetail is defined they are taken from the old synonym relation(s) if keepReference is true. If false the reference and the reference detail will be taken only from the newReference and newReferenceDetail.
    Returns:
    The new synonym relationship. If moveHomotypicGroup is true additionally created new synonym relationships must be retrieved separately from the new taxon.
    Throws:
    HomotypicalGroupChangeException - Exception is thrown if (1) synonym is homotypic to the old accepted taxon or (2) synonym is in homotypic group with other synonyms and moveHomotypicGroup is false

    getUuidAndTitleCacheTaxon

    public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheTaxon()
    Specified by:
    getUuidAndTitleCacheTaxon in interface ITaxonService

    getUuidAndTitleCacheSynonym

    public List<UuidAndTitleCache<TaxonBase>> getUuidAndTitleCacheSynonym()
    Specified by:
    getUuidAndTitleCacheSynonym in interface ITaxonService

    findByFullText

    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 org.apache.lucene.index.CorruptIndexException,
                                                         IOException,
                                                         org.apache.lucene.queryParser.ParseException
    Specified by:
    findByFullText in interface ITaxonService
    Throws:
    org.apache.lucene.index.CorruptIndexException
    IOException
    org.apache.lucene.queryParser.ParseException

    prepareFindByFullTextSearch

    protected LuceneSearch prepareFindByFullTextSearch(Class<? extends CdmBase> clazz,
                                                       String queryString,
                                                       Classification classification,
                                                       List<Language> languages,
                                                       boolean highlightFragments)
    Parameters:
    clazz -
    queryString -
    classification -
    languages -
    highlightFragments -
    directorySelectClass -
    Returns:

    findByDescriptionElementFullText

    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 org.apache.lucene.index.CorruptIndexException,
                                                                           IOException,
                                                                           org.apache.lucene.queryParser.ParseException
    Description copied from interface: ITaxonService

    This is an experimental feature, it may be moved, modified, or even removed in future releases!!!

    Specified by:
    findByDescriptionElementFullText in interface ITaxonService
    queryString - the query string to filter by
    classification - If a taxonomic classification three is specified here the result set will only contain taxa of the given classification
    features - TODO
    languages - 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. Other fields are searched nevertheless if this parameter is set or not.
    highlightFragments - TODO
    pageSize - The maximum number of objects returned (can be null for all objects)
    pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
    orderHints - Supports path like orderHints.propertyNames which include *-to-one properties like createdBy.username or authorTeam.persistentTitleCache
    propertyPaths - properties to initialize - see IBeanInitializer.initialize(Object, List)
    Returns:
    a paged list of instances of type T matching the queryString
    Throws:
    org.apache.lucene.index.CorruptIndexException
    IOException
    org.apache.lucene.queryParser.ParseException

    findByEverythingFullText

    public Pager<SearchResult<TaxonBase>> findByEverythingFullText(String queryString,
                                                                   Classification classification,
                                                                   List<Language> languages,
                                                                   boolean highlightFragments,
                                                                   Integer pageSize,
                                                                   Integer pageNumber,
                                                                   List<OrderHint> orderHints,
                                                                   List<String> propertyPaths)
                                                            throws org.apache.lucene.index.CorruptIndexException,
                                                                   IOException,
                                                                   org.apache.lucene.queryParser.ParseException
    Specified by:
    findByEverythingFullText in interface ITaxonService
    Throws:
    org.apache.lucene.index.CorruptIndexException
    IOException
    org.apache.lucene.queryParser.ParseException

    prepareByDescriptionElementFullTextSearch

    protected LuceneSearch prepareByDescriptionElementFullTextSearch(Class<? extends CdmBase> clazz,
                                                                     String queryString,
                                                                     Classification classification,
                                                                     List<Feature> features,
                                                                     List<Language> languages,
                                                                     boolean highlightFragments)
    Parameters:
    clazz -
    queryString -
    classification -
    features -
    languages -
    highlightFragments -
    directorySelectClass -
    Returns:

    createInferredSynonyms

    public List<Synonym> createInferredSynonyms(Taxon taxon,
                                                Classification classification,
                                                SynonymRelationshipType type,
                                                boolean doWithMisappliedNames)
    Description copied from interface: ITaxonService
    Creates the specified inferred synonyms for the taxon in the classification, but do not insert it to the database

    Specified by:
    createInferredSynonyms in interface ITaxonService
    Returns:
    list of inferred synonyms

    createAllInferredSynonyms

    public List<Synonym> createAllInferredSynonyms(Taxon taxon,
                                                   Classification tree,
                                                   boolean doWithMisappliedNames)
    Description copied from interface: ITaxonService
    Creates all inferred synonyms for the taxon in the classification, but do not insert it to the database

    Specified by:
    createAllInferredSynonyms in interface ITaxonService
    Returns:
    list of inferred synonyms

    listClassifications

    public List<Classification> listClassifications(TaxonBase taxonBase,
                                                    Integer limit,
                                                    Integer start,
                                                    List<String> propertyPaths)
    Description copied from interface: ITaxonService
    lists all accepted taxa for the given Synonym

    Specified by:
    listClassifications in interface ITaxonService
    Returns:


    Copyright © 2007-2013 EDIT. All Rights Reserved.