1
|
/**
|
2
|
* Copyright (C) 2014 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.api.service.molecular;
|
10
|
|
11
|
import java.util.ArrayList;
|
12
|
import java.util.List;
|
13
|
|
14
|
import org.apache.log4j.Logger;
|
15
|
import org.hibernate.criterion.Criterion;
|
16
|
import org.springframework.beans.factory.annotation.Autowired;
|
17
|
import org.springframework.stereotype.Service;
|
18
|
import org.springframework.transaction.annotation.Transactional;
|
19
|
|
20
|
import eu.etaxonomy.cdm.api.service.AnnotatableServiceBase;
|
21
|
import eu.etaxonomy.cdm.api.service.pager.Pager;
|
22
|
import eu.etaxonomy.cdm.api.service.pager.impl.AbstractPagerImpl;
|
23
|
import eu.etaxonomy.cdm.api.service.pager.impl.DefaultPagerImpl;
|
24
|
import eu.etaxonomy.cdm.model.molecular.Amplification;
|
25
|
import eu.etaxonomy.cdm.persistence.dao.molecular.IAmplificationDao;
|
26
|
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
|
27
|
import eu.etaxonomy.cdm.persistence.query.MatchMode;
|
28
|
import eu.etaxonomy.cdm.persistence.query.OrderHint;
|
29
|
|
30
|
/**
|
31
|
* @author pplitzner
|
32
|
\* @since 11.03.2014
|
33
|
*
|
34
|
*/
|
35
|
@Service
|
36
|
@Transactional(readOnly = true)
|
37
|
public class AmplificationServiceImpl extends AnnotatableServiceBase<Amplification, IAmplificationDao> implements IAmplificationService{
|
38
|
@SuppressWarnings("unused")
|
39
|
private static final Logger logger = Logger.getLogger(AmplificationServiceImpl.class);
|
40
|
|
41
|
@Override
|
42
|
@Autowired
|
43
|
protected void setDao(IAmplificationDao dao) {
|
44
|
this.dao = dao;
|
45
|
}
|
46
|
|
47
|
@Override
|
48
|
public List<UuidAndTitleCache<Amplification>> getAmplificationUuidAndLabelCache(Integer limit, String pattern) {
|
49
|
return dao.getAmplificationUuidAndLabelCache(limit, pattern);
|
50
|
}
|
51
|
|
52
|
@Override
|
53
|
public Pager<Amplification> findByLabelCache(String queryString, MatchMode matchmode, List<Criterion> criteria, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths){
|
54
|
long numberOfResults = dao.countByTitle(queryString, matchmode, criteria);
|
55
|
|
56
|
List<Amplification> results = new ArrayList<Amplification>();
|
57
|
if(AbstractPagerImpl.hasResultsInRange(numberOfResults, pageNumber, pageSize)) {
|
58
|
results = dao.findByTitle(queryString, matchmode, criteria, pageSize, pageNumber, orderHints, propertyPaths);
|
59
|
}
|
60
|
|
61
|
return new DefaultPagerImpl<Amplification>(pageNumber, numberOfResults, pageSize, results);
|
62
|
}
|
63
|
|
64
|
}
|