Project

General

Profile

Revision f13dc62d

IDf13dc62d0688bbb10e12820900f0317e07c456d2
Parent 7b43c8a7
Child fe0c2ae8

Added by Andreas Müller about 2 years ago

remove harmonization candidates in TaxonDao and NameService

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/taxon/TaxonDaoHibernateImpl.java
635 635

  
636 636

  
637 637
    @Override
638
    public List<TaxonBase> getAllTaxonBases(Integer pagesize, Integer page) {
639
        return super.list(pagesize, page);
640
    }
641

  
642
    @Override
643
    public List<Synonym> getAllSynonyms(Integer limit, Integer start) {
644
        Criteria criteria = getSession().createCriteria(Synonym.class);
645

  
646
        if(limit != null) {
647
            criteria.setFirstResult(start);
648
            criteria.setMaxResults(limit);
649
        }
650

  
651
        @SuppressWarnings("unchecked")
652
        List<Synonym> result = criteria.list();
653
        return result;
654
    }
655

  
656
    @Override
657
    public List<Taxon> getAllTaxa(Integer limit, Integer start) {
658
        Criteria criteria = getSession().createCriteria(Taxon.class);
659

  
660
        if(limit != null) {
661
            criteria.setFirstResult(start);
662
            criteria.setMaxResults(limit);
663
        }
664

  
665
        @SuppressWarnings("unchecked")
666
        List<Taxon> result = criteria.list();
667
        return result;
668
    }
669

  
670

  
671
    @Override
672 638
    public UUID delete(TaxonBase taxonBase) throws DataAccessException{
673 639
        if (taxonBase == null){
674 640
            logger.warn("TaxonBase was 'null'");
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/taxon/ITaxonDao.java
241 241
            Integer pageNumber, List<String> propertyPaths);
242 242

  
243 243
    /**
244
     * TODO necessary?
245
     * @param pagesize max maximum number of returned taxa
246
     * @param page page to start, with 0 being first page
247
     * @return
248
     */
249
    public List<TaxonBase> getAllTaxonBases(Integer pagesize, Integer page);
250

  
251

  
252
    /**
253
     * @param limit
254
     * @param start
255
     * @return
256
     */
257
    public List<Taxon> getAllTaxa(Integer limit, Integer start);
258

  
259
    /**
260
     * @param limit
261
     * @param start
262
     * @return
263
     */
264
    public List<Synonym> getAllSynonyms(Integer limit, Integer start);
265

  
266
    /**
267 244
     * Counts the number of synonyms
268 245
     * @param onlyAttachedToTaxon if <code>true</code> only those synonyms being attached to
269 246
     * an accepted taxon are counted
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/INameService.java
17 17
import java.util.Optional;
18 18
import java.util.UUID;
19 19

  
20
import org.apache.lucene.index.CorruptIndexException;
20 21
import org.hibernate.criterion.Criterion;
21 22

  
22 23
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
......
25 26
import eu.etaxonomy.cdm.api.service.search.LuceneParseException;
26 27
import eu.etaxonomy.cdm.api.service.search.SearchResult;
27 28
import eu.etaxonomy.cdm.api.utility.TaxonNamePartsFilter;
28
import eu.etaxonomy.cdm.model.common.CdmBase;
29 29
import eu.etaxonomy.cdm.model.common.Language;
30 30
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
31 31
import eu.etaxonomy.cdm.model.common.RelationshipBase;
......
40 40
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
41 41
import eu.etaxonomy.cdm.model.name.TaxonName;
42 42
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
43
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
43 44
import eu.etaxonomy.cdm.persistence.dto.TaxonNameParts;
44 45
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
45 46
import eu.etaxonomy.cdm.persistence.query.MatchMode;
46 47
import eu.etaxonomy.cdm.persistence.query.OrderHint;
47 48
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
49
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl;
48 50

  
49 51
public interface INameService extends IIdentifiableEntityService<TaxonName> {
50 52

  
......
184 186
	public List<TaxonName> findNamesByNameCache(String nameCache, MatchMode matchMode, List<String> propertyPaths);
185 187

  
186 188
	/**
187
	 * @param name
188
	 * @param sessionObject An object that is attached to the session before executing the query
189
	 * @return
190
	 */
191
	public List getNamesByName(String name, CdmBase sessionObject);
192

  
193
	/**
194 189
	 * Fuzzy matching for the taxon name elements. The input name is first atomised using the {@link NonViralNameParserImpl}
195 190
	 * into its separate parts (genusOrUninomial,infraGenericEpithet,specificEpithet,infraGenericEpithet,authorshipCache).
196 191
	 * Each field is then matched separately with the same accuracy parameter.
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IdentifiableServiceBase.java
98 98
	public T replace(T x, T y) {
99 99
		return dao.replace(x, y);
100 100
	}
101
	/**
102
	 * FIXME Candidate for harmonization
103
	 * Given that this method is strongly typed, and generic, could we not simply expose it as
104
	 * List<T> findByTitle(String title) as it is somewhat less cumbersome. Admittedly, I don't
105
	 * understand what is going on with the configurators etc. so maybe there is a good reason for
106
	 * the design of this method.
107
	 * @param title
108
	 * @return
109
	 */
110
	@Transactional(readOnly = true)
111
	protected List<T> findCdmObjectsByTitle(String title){
112
		return ((IIdentifiableDao)dao).findByTitle(title);
113
	}
114

  
115
	@Transactional(readOnly = true)
116
	protected List<T> findCdmObjectsByTitle(String title, Class<T> clazz){
117
		return ((IIdentifiableDao)dao).findByTitleAndClass(title, clazz);
118
	}
119
	@Transactional(readOnly = true)
120
	protected List<T> findCdmObjectsByTitle(String title, CdmBase sessionObject){
121
		return ((IIdentifiableDao)dao).findByTitle(title, sessionObject);
122
	}
123 101

  
124 102
	/*
125 103
	 * TODO - Migrated from CommonServiceBase
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/NameServiceImpl.java
92 92

  
93 93
@Service
94 94
@Transactional(readOnly = true)
95
public class NameServiceImpl extends IdentifiableServiceBase<TaxonName,ITaxonNameDao> implements INameService {
95
public class NameServiceImpl
96
          extends IdentifiableServiceBase<TaxonName,ITaxonNameDao>
97
          implements INameService {
96 98
    static private final Logger logger = Logger.getLogger(NameServiceImpl.class);
97 99

  
98 100
    @Autowired
......
381 383

  
382 384
    /**
383 385
     * TODO candidate for harmonization
384
     */
385
    @Override
386
    public List getNamesByName(String name, CdmBase sessionObject){
387
        return super.findCdmObjectsByTitle(name, sessionObject);
388
    }
389

  
390
    /**
391
     * TODO candidate for harmonization
392 386
     * new name saveHomotypicalGroups
393 387
     */
394 388
    @Override

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)