Project

General

Profile

Download (1.6 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2018 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.service;
10

    
11
import java.util.ArrayList;
12
import java.util.List;
13

    
14
import org.springframework.beans.factory.annotation.Autowired;
15
import org.springframework.beans.factory.annotation.Qualifier;
16
import org.springframework.stereotype.Component;
17

    
18
import eu.etaxonomy.cdm.api.application.CdmRepository;
19
import eu.etaxonomy.cdm.model.reference.Reference;
20
import eu.etaxonomy.cdm.persistence.query.MatchMode;
21
import eu.etaxonomy.cdm.persistence.query.OrderHint;
22
import eu.etaxonomy.cdm.persistence.query.OrderHint.SortOrder;
23

    
24
/**
25
 * @author a.kohlbecker
26
 * @since Jun 7, 2018
27
 *
28
 */
29
@Component
30
public class CdmFilterablePagingProviderFactory {
31

    
32
    @Autowired
33
    @Qualifier("cdmRepository")
34
    private CdmRepository repo;
35

    
36

    
37
    public CdmFilterablePagingProvider<Reference,Reference> referencePagingProvider(){
38
        List<OrderHint> referenceOrderHints = new ArrayList<OrderHint>();
39
        referenceOrderHints.add(OrderHint.ORDER_BY_TITLE_CACHE);
40
        referenceOrderHints.add(new OrderHint("issn", SortOrder.ASCENDING));
41
        referenceOrderHints.add(new OrderHint("isbn", SortOrder.ASCENDING));
42
        CdmFilterablePagingProvider<Reference,Reference> referencePagingProvider = new CdmFilterablePagingProvider<Reference, Reference>(repo.getReferenceService(), MatchMode.ANYWHERE, referenceOrderHints);
43

    
44
        return referencePagingProvider;
45
    }
46

    
47

    
48
}
(2-2/9)