Project

General

Profile

Revision e32daf11

IDe32daf11e2a1d6947e525bb2e42e99f124e02b38
Parent ca5879a8
Child 521a868a

Added by Andreas Kohlbecker about 2 years ago

fix #7461 ordering references in comboboxes by titleCache, issn, isbn - consistence by CdmFilterablePagingProviderFactory

View differences:

src/main/java/eu/etaxonomy/cdm/service/CdmFilterablePagingProviderFactory.java
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
}
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPresenter.java
135 135
        getView().getTypeStatusSelect().setItemCaptionPropertyId("description");
136 136

  
137 137
        getView().getCitationCombobox().getSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<Reference>());
138
        CdmFilterablePagingProvider<Reference,Reference> referencePagingProvider = new CdmFilterablePagingProvider<Reference, Reference>(getRepo().getReferenceService());
138
        CdmFilterablePagingProvider<Reference,Reference> referencePagingProvider = pagingProviderFactory.referencePagingProvider();
139 139
        getView().getCitationCombobox().loadFrom(referencePagingProvider, referencePagingProvider, referencePagingProvider.getPageSize());
140 140
        getView().getCitationCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityButtonUpdater<Reference>(getView().getCitationCombobox()));
141 141
        getView().getCitationCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getCitationCombobox(), this));
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetEditorPresenter.java
36 36
import eu.etaxonomy.cdm.model.reference.Reference;
37 37
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
38 38
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider;
39
import eu.etaxonomy.cdm.service.CdmFilterablePagingProviderFactory;
39 40
import eu.etaxonomy.cdm.service.CdmStore;
40 41
import eu.etaxonomy.cdm.service.ISpecimenTypeDesignationWorkingSetService;
41 42
import eu.etaxonomy.cdm.service.initstrategies.AgentBaseInit;
......
91 92

  
92 93
    private ICdmCacher cache;
93 94

  
95
    @Autowired
96
    protected CdmFilterablePagingProviderFactory pagingProviderFactory;
97

  
94 98
    SpecimenTypeDesignationWorkingSetDTO<Registration> workingSetDto;
95 99

  
96 100
    private Map<CollectionPopupEditor, SpecimenTypeDesignationDTORow> collectionPopupEditorsRowMap = new HashMap<>();
......
179 183

  
180 184
            CdmFilterablePagingProvider<Collection, Collection> collectionPagingProvider = new CdmFilterablePagingProvider<Collection, Collection>(getRepo().getCollectionService());
181 185

  
182
            CdmFilterablePagingProvider<Reference, Reference> referencePagingProvider = new CdmFilterablePagingProvider<Reference, Reference>(getRepo().getReferenceService());
186
            CdmFilterablePagingProvider<Reference, Reference> referencePagingProvider = pagingProviderFactory.referencePagingProvider();
183 187

  
184 188
            @Override
185 189
            public SpecimenTypeDesignationDTORow create() {
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java
83 83

  
84 84
    private BeanInstantiator<Reference> newReferenceInstantiator;
85 85

  
86

  
86 87
    /**
87 88
     * {@inheritDoc}
88 89
     */
......
112 113
        getView().getExBasionymAuthorshipField().setFilterablePersonPagingProvider(personPagingProvider, this);
113 114

  
114 115
        getView().getNomReferenceCombobox().getSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<Reference>());
115
        referencePagingProvider = new CdmFilterablePagingProvider<Reference, Reference>(getRepo().getReferenceService());
116
        referencePagingProvider = pagingProviderFactory.referencePagingProvider();
116 117
        referencePagingProvider.setInitStrategy(REFERENCE_INIT_STRATEGY);
117 118
        getView().getNomReferenceCombobox().loadFrom(referencePagingProvider, referencePagingProvider, referencePagingProvider.getPageSize());
118 119
        getView().getNomReferenceCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityButtonUpdater<Reference>(getView().getNomReferenceCombobox()));
119 120
        getView().getNomReferenceCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getNomReferenceCombobox(), this));
120 121

  
121 122
        getView().getBasionymComboboxSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<TaxonName>());
123

  
122 124
        CdmFilterablePagingProvider<TaxonName, TaxonName> basionymPagingProvider = new CdmFilterablePagingProvider<TaxonName, TaxonName>(getRepo().getNameService());
123 125
        basionymPagingProvider.setInitStrategy(BASIONYM_INIT_STRATEGY);
124 126
        getView().getBasionymComboboxSelect().setPagingProviders(basionymPagingProvider, basionymPagingProvider, basionymPagingProvider.getPageSize(), this);
src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferenceEditorPresenter.java
70 70

  
71 71
        });
72 72

  
73
        CdmFilterablePagingProvider<Reference, Reference> collectionPagingProvider = new CdmFilterablePagingProvider<Reference, Reference>(getRepo().getReferenceService());
73
        CdmFilterablePagingProvider<Reference, Reference> collectionPagingProvider = pagingProviderFactory.referencePagingProvider();
74 74
        getView().getInReferenceCombobox().loadFrom(collectionPagingProvider, collectionPagingProvider, collectionPagingProvider.getPageSize());
75 75
        getView().getInReferenceCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityButtonUpdater<Reference>(getView().getInReferenceCombobox()));
76 76
        getView().getInReferenceCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<Reference>(getView().getInReferenceCombobox(),this));
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/StartRegistrationPresenter.java
11 11
import java.util.EnumSet;
12 12
import java.util.UUID;
13 13

  
14
import org.springframework.beans.factory.annotation.Autowired;
14 15
import org.vaadin.spring.events.EventScope;
15 16
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
16 17
import org.vaadin.viritin.fields.LazyComboBox;
......
26 27
import eu.etaxonomy.cdm.model.reference.ReferenceType;
27 28
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
28 29
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider;
30
import eu.etaxonomy.cdm.service.CdmFilterablePagingProviderFactory;
29 31
import eu.etaxonomy.cdm.vaadin.event.EditorActionTypeFilter;
30 32
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
31 33
import eu.etaxonomy.cdm.vaadin.event.RegistrationEditorAction;
......
54 56

  
55 57
    private boolean registrationInProgress;
56 58

  
59
    @Autowired
60
    protected CdmFilterablePagingProviderFactory pagingProviderFactory;
61

  
57 62
    public StartRegistrationPresenter (){
58 63
        super();
59 64
    }
......
67 72

  
68 73
        super.onPresenterReady();
69 74

  
70
        CdmFilterablePagingProvider<Reference, Reference> pagingProvider = new CdmFilterablePagingProvider<Reference, Reference>(
71
                getRepo().getReferenceService());
75
        CdmFilterablePagingProvider<Reference, Reference> pagingProvider = pagingProviderFactory.referencePagingProvider();
72 76
        CdmTitleCacheCaptionGenerator<Reference> titleCacheGenrator = new CdmTitleCacheCaptionGenerator<Reference>();
73 77
        getView().getReferenceCombobox().setCaptionGenerator(titleCacheGenrator);
74 78
        getView().getReferenceCombobox().loadFrom(pagingProvider, pagingProvider, pagingProvider.getPageSize());
src/main/java/eu/etaxonomy/vaadin/mvp/CdmEditorPresenterBase.java
15 15

  
16 16
import org.apache.log4j.Logger;
17 17
import org.hibernate.HibernateException;
18
import org.springframework.beans.factory.annotation.Autowired;
18 19

  
19 20
import eu.etaxonomy.cdm.api.service.IService;
20 21
import eu.etaxonomy.cdm.cache.CdmTransientEntityCacher;
......
24 25
import eu.etaxonomy.cdm.model.common.User;
25 26
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
26 27
import eu.etaxonomy.cdm.persistence.hibernate.permission.CdmAuthority;
28
import eu.etaxonomy.cdm.service.CdmFilterablePagingProviderFactory;
27 29
import eu.etaxonomy.cdm.service.CdmStore;
28 30
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
29 31
import eu.etaxonomy.cdm.vaadin.permission.UserHelper;
......
65 67

  
66 68
    protected CdmAuthority newAuthorityCreated;
67 69

  
70
    @Autowired
71
    protected CdmFilterablePagingProviderFactory pagingProviderFactory;
72

  
68 73
    protected CdmStore<CDM, IService<CDM>> getStore() {
69 74
        if(store == null){
70 75
            store = new CdmStore<>(getRepo(), getService());

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)