eu.etaxonomy.cdm.api.service
Class OccurrenceServiceImpl

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<SpecimenOrObservationBase,IOccurrenceDao>
                  extended by eu.etaxonomy.cdm.api.service.OccurrenceServiceImpl
All Implemented Interfaces:
IAnnotatableService<SpecimenOrObservationBase>, IIdentifiableEntityService<SpecimenOrObservationBase>, IOccurrenceService, IService<SpecimenOrObservationBase>, IVersionableService<SpecimenOrObservationBase>, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Service
@Transactional(readOnly=true)
public class OccurrenceServiceImpl
extends IdentifiableServiceBase<SpecimenOrObservationBase,IOccurrenceDao>
implements IOccurrenceService

Author:
a.babadshanjan

Field Summary
 
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
OccurrenceServiceImpl()
           
 
Method Summary
 Pager<SearchResult<SpecimenOrObservationBase>> findByFullText(Class<? extends SpecimenOrObservationBase> clazz, String queryString, org.hibernate.search.spatial.impl.Rectangle boundingBox, List<Language> languages, boolean highlightFragments, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
           
 WaterbodyOrCountry getCountryByIso(String iso639)
          FIXME Candidate for harmonization move to termService
 Pager<DerivationEvent> getDerivationEvents(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths)
          Returns a list of derivation events that have involved creating new DerivedUnits from this occurence
 List<UuidAndTitleCache<DerivedUnitBase>> getDerivedUnitBaseUuidAndTitleCache()
           
 DerivedUnitFacade getDerivedUnitFacade(DerivedUnitBase derivedUnit, List<String> propertyPaths)
           
 Pager<DeterminationEvent> getDeterminations(SpecimenOrObservationBase occurrence, TaxonBase taxonBase, Integer pageSize, Integer pageNumber, List<String> propertyPaths)
          Returns a List of determinations that have been made for a given occurence
 List<UuidAndTitleCache<FieldObservation>> getFieldObservationUuidAndTitleCache()
           
 Pager<Media> getMedia(SpecimenOrObservationBase occurence, Integer pageSize, Integer pageNumber, List<String> propertyPaths)
          Returns a List of Media that are associated with a given occurence
 List<WaterbodyOrCountry> getWaterbodyOrCountryByName(String name)
          FIXME Candidate for harmonization move to termService
 Pager<SpecimenOrObservationBase> list(Class<? extends SpecimenOrObservationBase> type, TaxonBase determinedAs, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns a paged list of occurrences that have been determined to belong to the taxon concept determinedAs, optionally restricted to objects belonging to a class that that extends SpecimenOrObservationBase.
<T extends SpecimenOrObservationBase>
List<T>
listByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships, Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
          Lists all instances of SpecimenOrObservationBase which are associated with the taxon specified as parameter.
 List<DerivedUnitFacade> listDerivedUnitFacades(DescriptionBase description, List<String> propertyPaths)
           
<T extends SpecimenOrObservationBase>
Pager<T>
pageByAssociatedTaxon(Class<T> type, Set<TaxonRelationshipEdge> includeRelationships, Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
          See IOccurrenceService.listByAssociatedTaxon(Class, Set, Taxon, Integer, Integer, Integer, List, List)
protected  void setDao(IOccurrenceDao dao)
           
 void updateTitleCache(Class<? extends SpecimenOrObservationBase> clazz, Integer stepSize, IIdentifiableEntityCacheStrategy<SpecimenOrObservationBase> 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.IOccurrenceService
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
 

Constructor Detail

OccurrenceServiceImpl

public OccurrenceServiceImpl()
Method Detail

updateTitleCache

@Transactional(readOnly=false)
public void updateTitleCache(Class<? extends SpecimenOrObservationBase> clazz,
                                           Integer stepSize,
                                           IIdentifiableEntityCacheStrategy<SpecimenOrObservationBase> 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<SpecimenOrObservationBase>
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.

getCountryByIso

public WaterbodyOrCountry getCountryByIso(String iso639)
FIXME Candidate for harmonization move to termService

Specified by:
getCountryByIso in interface IOccurrenceService

getWaterbodyOrCountryByName

public List<WaterbodyOrCountry> getWaterbodyOrCountryByName(String name)
FIXME Candidate for harmonization move to termService

Specified by:
getWaterbodyOrCountryByName in interface IOccurrenceService

setDao

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

getDerivationEvents

public Pager<DerivationEvent> getDerivationEvents(SpecimenOrObservationBase occurence,
                                                  Integer pageSize,
                                                  Integer pageNumber,
                                                  List<String> propertyPaths)
Description copied from interface: IOccurrenceService
Returns a list of derivation events that have involved creating new DerivedUnits from this occurence

Specified by:
getDerivationEvents in interface IOccurrenceService
Parameters:
occurence - the occurence that was a source of these derivation events
pageSize - The maximum number of derivation events returned (can be null for all related derivation events)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
Returns:
a Pager of derivation events

getDeterminations

public Pager<DeterminationEvent> getDeterminations(SpecimenOrObservationBase occurrence,
                                                   TaxonBase taxonBase,
                                                   Integer pageSize,
                                                   Integer pageNumber,
                                                   List<String> propertyPaths)
Description copied from interface: IOccurrenceService
Returns a List of determinations that have been made for a given occurence

Specified by:
getDeterminations in interface IOccurrenceService
Parameters:
occurrence - the occurence associated with these determinations (can be null for all occurrences)
pageSize - The maximum number of determinations returned (can be null for all related determinations)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
Returns:
a Pager of determination instances

getMedia

public Pager<Media> getMedia(SpecimenOrObservationBase occurence,
                             Integer pageSize,
                             Integer pageNumber,
                             List<String> propertyPaths)
Description copied from interface: IOccurrenceService
Returns a List of Media that are associated with a given occurence

Specified by:
getMedia in interface IOccurrenceService
Parameters:
occurence - the occurence associated with these media
pageSize - The maximum number of media returned (can be null for all related media)
pageNumber - The offset (in pageSize chunks) from the start of the result set (0 - based)
propertyPaths - properties to initialize - see IBeanInitializer.initialize(Object, List)
Returns:
a Pager of media instances

list

public Pager<SpecimenOrObservationBase> list(Class<? extends SpecimenOrObservationBase> type,
                                             TaxonBase determinedAs,
                                             Integer pageSize,
                                             Integer pageNumber,
                                             List<OrderHint> orderHints,
                                             List<String> propertyPaths)
Description copied from interface: IOccurrenceService
Returns a paged list of occurrences that have been determined to belong to the taxon concept determinedAs, optionally restricted to objects belonging to a class that that extends SpecimenOrObservationBase.

In contrast to #listByAnyAssociation(Class, Taxon, List) this method only takes SpecimenOrObservationBase instances into account which are actually determined as the taxon specified by determinedAs.

Specified by:
list in interface IOccurrenceService
Parameters:
type - The type of entities to return (can be null to count all entities of type )
determinedAs - the taxon concept that the occurrences have been determined to belong to
orderHints - Supports path like orderHints.propertyNames which include *-to-one properties like createdBy.username or authorTeam.persistentTitleCache
propertyPaths - properties to be initialized
Returns:

getDerivedUnitBaseUuidAndTitleCache

public List<UuidAndTitleCache<DerivedUnitBase>> getDerivedUnitBaseUuidAndTitleCache()
Specified by:
getDerivedUnitBaseUuidAndTitleCache in interface IOccurrenceService

getFieldObservationUuidAndTitleCache

public List<UuidAndTitleCache<FieldObservation>> getFieldObservationUuidAndTitleCache()
Specified by:
getFieldObservationUuidAndTitleCache in interface IOccurrenceService

getDerivedUnitFacade

public DerivedUnitFacade getDerivedUnitFacade(DerivedUnitBase derivedUnit,
                                              List<String> propertyPaths)
                                       throws DerivedUnitFacadeNotSupportedException
Specified by:
getDerivedUnitFacade in interface IOccurrenceService
Throws:
DerivedUnitFacadeNotSupportedException

listDerivedUnitFacades

public List<DerivedUnitFacade> listDerivedUnitFacades(DescriptionBase description,
                                                      List<String> propertyPaths)
Specified by:
listDerivedUnitFacades in interface IOccurrenceService

listByAssociatedTaxon

public <T extends SpecimenOrObservationBase> List<T> listByAssociatedTaxon(Class<T> type,
                                                                           Set<TaxonRelationshipEdge> includeRelationships,
                                                                           Taxon associatedTaxon,
                                                                           Integer maxDepth,
                                                                           Integer pageSize,
                                                                           Integer pageNumber,
                                                                           List<OrderHint> orderHints,
                                                                           List<String> propertyPaths)
Description copied from interface: IOccurrenceService
Lists all instances of SpecimenOrObservationBase which are associated with the taxon specified as parameter. SpecimenOrObservationBase instances can be associated to taxa in multiple ways, all these possible relations are taken into account: Further more there also can be taxa which are associated with the taxon in question (parameter associatedTaxon) by TaxonRelationships. If the parameter includeRelationships is containing elements, these according s and directional information will be used to collect further SpecimenOrObservationBase instances found this way.

Specified by:
listByAssociatedTaxon in interface IOccurrenceService
maxDepth - TODO
Returns:

pageByAssociatedTaxon

public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type,
                                                                            Set<TaxonRelationshipEdge> includeRelationships,
                                                                            Taxon associatedTaxon,
                                                                            Integer maxDepth,
                                                                            Integer pageSize,
                                                                            Integer pageNumber,
                                                                            List<OrderHint> orderHints,
                                                                            List<String> propertyPaths)
Description copied from interface: IOccurrenceService
See IOccurrenceService.listByAssociatedTaxon(Class, Set, Taxon, Integer, Integer, Integer, List, List)

Specified by:
pageByAssociatedTaxon in interface IOccurrenceService
Returns:
a Pager

findByFullText

public Pager<SearchResult<SpecimenOrObservationBase>> findByFullText(Class<? extends SpecimenOrObservationBase> clazz,
                                                                     String queryString,
                                                                     org.hibernate.search.spatial.impl.Rectangle boundingBox,
                                                                     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 IOccurrenceService
Returns:
Throws:
org.apache.lucene.index.CorruptIndexException
IOException
org.apache.lucene.queryParser.ParseException


Copyright © 2007-2013 EDIT. All Rights Reserved.