Project

General

Profile

Revision f4f3c705

IDf4f3c705b3839d688ae08c3493fdd65f0c2d4a49
Parent 277ef650
Child 3506344d

Added by Andreas Kohlbecker over 1 year ago

ref #8160 CdmBeanItemContainerFactory as service bean to load entities only in readyOnly transactions to avoid unintendet flushing

View differences:

src/main/java/eu/etaxonomy/cdm/service/CdmBeanItemContainerFactory.java
1
/**
2
* Copyright (C) 2017 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.Arrays;
13
import java.util.List;
14
import java.util.UUID;
15

  
16
import org.springframework.beans.factory.annotation.Autowired;
17
import org.springframework.beans.factory.annotation.Qualifier;
18
import org.springframework.stereotype.Service;
19
import org.springframework.transaction.annotation.Transactional;
20

  
21
import com.vaadin.data.util.BeanItemContainer;
22

  
23
import eu.etaxonomy.cdm.api.application.CdmRepository;
24
import eu.etaxonomy.cdm.api.service.pager.Pager;
25
import eu.etaxonomy.cdm.model.common.CdmBase;
26
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
27
import eu.etaxonomy.cdm.model.common.IEnumTerm;
28
import eu.etaxonomy.cdm.model.common.TermType;
29
import eu.etaxonomy.cdm.model.common.TermVocabulary;
30
import eu.etaxonomy.cdm.persistence.query.OrderHint;
31

  
32
/**
33
 * <b>Read only</b> service which can provide {@link BeanItemContainer BeanItemContainers} as source for select form
34
 * element options.
35
 *
36
 * @author a.kohlbecker
37
 * @since Apr 6, 2017
38
 *
39
 */
40
@Service
41
@Transactional(readOnly=true)
42
public class CdmBeanItemContainerFactory {
43

  
44
    @Autowired
45
    @Qualifier("cdmRepository")
46
    private CdmRepository repo;
47

  
48
    private final static List<String> INIT_STRATEGY = Arrays.asList(new String[]{"$", "representations"});
49

  
50
    private static List<OrderHint> orderHints = new ArrayList<>();
51

  
52
    static {
53
        orderHints.add(OrderHint.BY_ORDER_INDEX);
54
        orderHints.add(OrderHint.ORDER_BY_TITLE_CACHE);
55
    }
56

  
57
    /**
58
     * @param termType
59
     */
60
    @Transactional(readOnly=true)
61
    public BeanItemContainer<DefinedTermBase> buildBeanItemContainer(TermType termType) {
62
        // TODO use TermCacher?
63
        List<DefinedTermBase> terms = repo.getTermService().listByTermType(termType, null, null, orderHints, INIT_STRATEGY);
64
        BeanItemContainer<DefinedTermBase> termItemContainer = new BeanItemContainer<>(DefinedTermBase.class);
65
        termItemContainer.addAll(terms);
66
        return termItemContainer;
67
    }
68

  
69
    /**
70
     * @param termType
71
     */
72
    @Transactional(readOnly=true)
73
    public BeanItemContainer<DefinedTermBase> buildBeanItemContainer(UUID vocabularyUuid) {
74

  
75
        TermVocabulary vocab = repo.getVocabularyService().find(vocabularyUuid);
76
        Pager<DefinedTermBase> terms = repo.getVocabularyService().getTerms(vocab, null, null, orderHints, INIT_STRATEGY);
77
        BeanItemContainer<DefinedTermBase> termItemContainer = new BeanItemContainer<>(DefinedTermBase.class);
78
        termItemContainer.addAll(terms.getRecords());
79
        return termItemContainer;
80
    }
81

  
82
    /**
83
     * @param termType
84
     */
85
    @Transactional(readOnly=true)
86
    public BeanItemContainer<DefinedTermBase> buildTermItemContainer(UUID ... termUuid) {
87
        return buildTermItemContainer(Arrays.asList(termUuid));
88
    }
89

  
90
    /**
91
     * @param derivation_EVENT_TYPE_UUIDS
92
     * @return
93
     */
94
    @Transactional(readOnly=true)
95
    public BeanItemContainer<DefinedTermBase> buildTermItemContainer(List<UUID> termsUuids) {
96
        List<DefinedTermBase> terms = repo.getTermService().load(termsUuids, INIT_STRATEGY);
97
        BeanItemContainer<DefinedTermBase> termItemContainer = new BeanItemContainer<>(DefinedTermBase.class);
98
        termItemContainer.addAll(terms);
99
        return termItemContainer;
100
    }
101

  
102
    /**
103
     * @param termType
104
     */
105
    @Transactional(readOnly=true)
106
    public <T extends CdmBase> BeanItemContainer<T> buildBeanItemContainer(Class<T> type, List<OrderHint> orderHints) {
107

  
108
        if(orderHints == null){
109
            orderHints = OrderHint.defaultOrderHintsFor(type);
110
        }
111

  
112
        List<T> terms = repo.getCommonService().list(type, (Integer)null, (Integer)null,
113
                orderHints,
114
                Arrays.asList(new String[]{"$"}));
115
        BeanItemContainer<T> termItemContainer = new BeanItemContainer<>(type);
116
        termItemContainer.addAll(terms);
117
        return termItemContainer;
118
    }
119

  
120
    public <T extends CdmBase> BeanItemContainer<T> buildBeanItemContainer(Class<T> type) {
121
        return buildBeanItemContainer(type, null);
122
    }
123

  
124
    /**
125
     * @param values
126
     * @return
127
     */
128
    @Transactional(readOnly=true)
129
    public <T extends IEnumTerm<T>> BeanItemContainer<T> buildBeanItemContainer(Class<T> termType, T ... enumTerms) {
130
        BeanItemContainer<T> termItemContainer = new BeanItemContainer<>(termType);
131
        List<T> termList = Arrays.asList(enumTerms);
132
        termItemContainer.addAll(termList);
133
        return termItemContainer;
134
    }
135

  
136

  
137
}
src/main/java/eu/etaxonomy/cdm/vaadin/component/CdmBeanItemContainerFactory.java
1
/**
2
* Copyright (C) 2017 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.vaadin.component;
10

  
11
import java.util.ArrayList;
12
import java.util.Arrays;
13
import java.util.List;
14
import java.util.UUID;
15

  
16
import com.vaadin.data.util.BeanItemContainer;
17

  
18
import eu.etaxonomy.cdm.api.application.CdmRepository;
19
import eu.etaxonomy.cdm.api.service.pager.Pager;
20
import eu.etaxonomy.cdm.model.common.CdmBase;
21
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
22
import eu.etaxonomy.cdm.model.common.IEnumTerm;
23
import eu.etaxonomy.cdm.model.common.TermType;
24
import eu.etaxonomy.cdm.model.common.TermVocabulary;
25
import eu.etaxonomy.cdm.persistence.query.OrderHint;
26

  
27
/**
28
 * @author a.kohlbecker
29
 * @since Apr 6, 2017
30
 *
31
 */
32
public class CdmBeanItemContainerFactory {
33

  
34
    private CdmRepository repo;
35

  
36
    private final static List<String> INIT_STRATEGY = Arrays.asList(new String[]{"$", "representations"});
37

  
38
    private static List<OrderHint> orderHints = new ArrayList<>();
39

  
40
    static {
41
        orderHints.add(OrderHint.BY_ORDER_INDEX);
42
        orderHints.add(OrderHint.ORDER_BY_TITLE_CACHE);
43
    }
44

  
45
    /**
46
     * Constructor to be used by presenter classes directly
47
     *
48
     * @param repo
49
     */
50
    public CdmBeanItemContainerFactory(CdmRepository repo){
51
        this.repo = repo;
52
    }
53

  
54
    /**
55
     * @param termType
56
     */
57
    public BeanItemContainer<DefinedTermBase> buildBeanItemContainer(TermType termType) {
58
        // TODO use TermCacher?
59
        List<DefinedTermBase> terms = repo.getTermService().listByTermType(termType, null, null, orderHints, INIT_STRATEGY);
60
        BeanItemContainer<DefinedTermBase> termItemContainer = new BeanItemContainer<>(DefinedTermBase.class);
61
        termItemContainer.addAll(terms);
62
        return termItemContainer;
63
    }
64

  
65
    /**
66
     * @param termType
67
     */
68
    public BeanItemContainer<DefinedTermBase> buildBeanItemContainer(UUID vocabularyUuid) {
69

  
70
        TermVocabulary vocab = repo.getVocabularyService().find(vocabularyUuid);
71
        Pager<DefinedTermBase> terms = repo.getVocabularyService().getTerms(vocab, null, null, orderHints, INIT_STRATEGY);
72
        BeanItemContainer<DefinedTermBase> termItemContainer = new BeanItemContainer<>(DefinedTermBase.class);
73
        termItemContainer.addAll(terms.getRecords());
74
        return termItemContainer;
75
    }
76

  
77
    /**
78
     * @param termType
79
     */
80
    public BeanItemContainer<DefinedTermBase> buildTermItemContainer(UUID ... termUuid) {
81
        return buildTermItemContainer(Arrays.asList(termUuid));
82
    }
83

  
84
    /**
85
     * @param derivation_EVENT_TYPE_UUIDS
86
     * @return
87
     */
88
    public BeanItemContainer<DefinedTermBase> buildTermItemContainer(List<UUID> termsUuids) {
89
        List<DefinedTermBase> terms = repo.getTermService().load(termsUuids, INIT_STRATEGY);
90
        BeanItemContainer<DefinedTermBase> termItemContainer = new BeanItemContainer<>(DefinedTermBase.class);
91
        termItemContainer.addAll(terms);
92
        return termItemContainer;
93
    }
94

  
95
    /**
96
     * @param termType
97
     */
98
    public <T extends CdmBase> BeanItemContainer<T> buildBeanItemContainer(Class<T> type, List<OrderHint> orderHints) {
99

  
100
        if(orderHints == null){
101
            orderHints = OrderHint.defaultOrderHintsFor(type);
102
        }
103

  
104
        List<T> terms = repo.getCommonService().list(type, (Integer)null, (Integer)null,
105
                orderHints,
106
                Arrays.asList(new String[]{"$"}));
107
        BeanItemContainer<T> termItemContainer = new BeanItemContainer<>(type);
108
        termItemContainer.addAll(terms);
109
        return termItemContainer;
110
    }
111

  
112
    public <T extends CdmBase> BeanItemContainer<T> buildBeanItemContainer(Class<T> type) {
113
        return buildBeanItemContainer(type, null);
114
    }
115

  
116
    /**
117
     * @param values
118
     * @return
119
     */
120
    public <T extends IEnumTerm<T>> BeanItemContainer<T> buildBeanItemContainer(Class<T> termType, T ... enumTerms) {
121
        BeanItemContainer<T> termItemContainer = new BeanItemContainer<>(termType);
122
        List<T> termList = Arrays.asList(enumTerms);
123
        termItemContainer.addAll(termList);
124
        return termItemContainer;
125
    }
126

  
127

  
128
}
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPresenter.java
35 35
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider;
36 36
import eu.etaxonomy.cdm.service.CdmStore;
37 37
import eu.etaxonomy.cdm.service.UserHelperAccess;
38
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory;
39 38
import eu.etaxonomy.cdm.vaadin.event.EditorActionTypeFilter;
40 39
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
41 40
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent.Type;
......
144 143
    @Override
145 144
    public void handleViewEntered() {
146 145

  
147
        CdmBeanItemContainerFactory selectFactory = new CdmBeanItemContainerFactory(getRepo());
148
        getView().getTypeStatusSelect().setContainerDataSource(selectFactory.buildBeanItemContainer(NameTypeDesignationStatus.class));
146
        getView().getTypeStatusSelect().setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(NameTypeDesignationStatus.class));
149 147
        getView().getTypeStatusSelect().setItemCaptionPropertyId("description");
150 148

  
151 149
        getView().getCitationCombobox().getSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<Reference>());
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetEditorPresenter.java
41 41
import eu.etaxonomy.cdm.persistence.dao.common.Restriction.Operator;
42 42
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
43 43
import eu.etaxonomy.cdm.persistence.query.MatchMode;
44
import eu.etaxonomy.cdm.service.CdmBeanItemContainerFactory;
44 45
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider;
45 46
import eu.etaxonomy.cdm.service.CdmFilterablePagingProviderFactory;
46 47
import eu.etaxonomy.cdm.service.CdmStore;
47 48
import eu.etaxonomy.cdm.service.ISpecimenTypeDesignationWorkingSetService;
48 49
import eu.etaxonomy.cdm.service.UserHelperAccess;
49 50
import eu.etaxonomy.cdm.service.initstrategies.AgentBaseInit;
50
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory;
51 51
import eu.etaxonomy.cdm.vaadin.component.CollectionRowItemCollection;
52 52
import eu.etaxonomy.cdm.vaadin.event.EditorActionContext;
53 53
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
......
93 93
    @Autowired
94 94
    private ISpecimenTypeDesignationWorkingSetService specimenTypeDesignationWorkingSetService;
95 95

  
96
    @Autowired
97
    protected CdmFilterablePagingProviderFactory pagingProviderFactory;
98

  
99
    @Autowired
100
    protected CdmBeanItemContainerFactory cdmBeanItemContainerFactory;
101

  
96 102
    /**
97 103
     * if not null, this CRUD set is to be used to create a CdmAuthoritiy for the base entitiy which will be
98 104
     * granted to the current use as long this grant is not assigned yet.
......
101 107

  
102 108
    private ICdmEntityUuidCacher cache;
103 109

  
104
    @Autowired
105
    protected CdmFilterablePagingProviderFactory pagingProviderFactory;
106

  
107 110
    SpecimenTypeDesignationWorkingSetDTO<Registration> workingSetDto;
108 111

  
109 112
    private Map<CollectionPopupEditor, SpecimenTypeDesignationDTORow> collectionPopupEditorsRowMap = new HashMap<>();
......
182 185
    @Override
183 186
    public void handleViewEntered() {
184 187

  
185
        CdmBeanItemContainerFactory selectFactory = new CdmBeanItemContainerFactory(getRepo());
186
        getView().getCountrySelectField().setContainerDataSource(selectFactory.buildBeanItemContainer(Country.uuidCountryVocabulary));
188
        getView().getCountrySelectField().setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(Country.uuidCountryVocabulary));
187 189

  
188 190
        CdmFilterablePagingProvider<AgentBase, TeamOrPersonBase> termOrPersonPagingProvider = new CdmFilterablePagingProvider<AgentBase, TeamOrPersonBase>(getRepo().getAgentService(), TeamOrPersonBase.class);
189 191
        CdmFilterablePagingProvider<AgentBase, Person> personPagingProvider = new CdmFilterablePagingProvider<AgentBase, Person>(getRepo().getAgentService(), Person.class);
......
192 194
        getView().getCollectorField().setFilterablePersonPagingProvider(personPagingProvider, this);
193 195
        getView().getCollectorField().setFilterableTeamPagingProvider(termOrPersonPagingProvider, this);
194 196

  
195
        getView().getExactLocationField().getReferenceSystemSelect().setContainerDataSource(selectFactory.buildBeanItemContainer(TermType.ReferenceSystem));
197
        getView().getExactLocationField().getReferenceSystemSelect().setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(TermType.ReferenceSystem));
196 198
        getView().getExactLocationField().getReferenceSystemSelect().setItemCaptionPropertyId("label");
197 199

  
198 200
        getView().getTypeDesignationsCollectionField().addElementRemovedListener(e -> deleteTypeDesignation(e.getElement()));
......
211 213

  
212 214
                SpecimenTypeDesignationDTORow row = new SpecimenTypeDesignationDTORow();
213 215

  
214
                row.kindOfUnit.setContainerDataSource(selectFactory.buildTermItemContainer(
216
                row.kindOfUnit.setContainerDataSource(cdmBeanItemContainerFactory.buildTermItemContainer(
215 217
                        RegistrationTermLists.KIND_OF_UNIT_TERM_UUIDS())
216 218
                        );
217 219
                row.kindOfUnit.setNullSelectionAllowed(false);
218 220

  
219
                row.typeStatus.setContainerDataSource(selectFactory.buildTermItemContainer(
221
                row.typeStatus.setContainerDataSource(cdmBeanItemContainerFactory.buildTermItemContainer(
220 222
                        RegistrationTermLists.SPECIMEN_TYPE_DESIGNATION_STATUS_UUIDS())
221 223
                        );
222 224
                row.typeStatus.setNullSelectionAllowed(false);
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java
44 44
import eu.etaxonomy.cdm.service.TaxonNameStringFilterablePagingProvider;
45 45
import eu.etaxonomy.cdm.service.UserHelperAccess;
46 46
import eu.etaxonomy.cdm.service.initstrategies.AgentBaseInit;
47
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory;
48 47
import eu.etaxonomy.cdm.vaadin.event.EditorActionTypeFilter;
49 48
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
50 49
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
......
120 119

  
121 120
        super.handleViewEntered();
122 121

  
123
        CdmBeanItemContainerFactory selectFieldFactory = new CdmBeanItemContainerFactory(getRepo());
124
        getView().getRankSelect().setContainerDataSource(selectFieldFactory.buildBeanItemContainer(TermType.Rank));
122
        getView().getRankSelect().setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(TermType.Rank));
125 123
        getView().getRankSelect().setItemCaptionPropertyId("label");
126 124

  
127 125
        CdmFilterablePagingProvider<AgentBase, TeamOrPersonBase> termOrPersonPagingProvider = new CdmFilterablePagingProvider<AgentBase, TeamOrPersonBase>(getRepo().getAgentService(), TeamOrPersonBase.class);
......
188 186
        getView().getOrthographicVariantField().getCitatonComboBox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getOrthographicVariantField().getCitatonComboBox(), this));
189 187

  
190 188

  
191
        getView().getAnnotationsField().setAnnotationTypeItemContainer(selectFieldFactory.buildTermItemContainer(
189
        getView().getAnnotationsField().setAnnotationTypeItemContainer(cdmBeanItemContainerFactory.buildTermItemContainer(
192 190
                AnnotationType.EDITORIAL().getUuid(), AnnotationType.TECHNICAL().getUuid()));
193 191
    }
194 192

  
src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferenceEditorPresenter.java
36 36
import eu.etaxonomy.cdm.persistence.dao.common.Restriction.Operator;
37 37
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider;
38 38
import eu.etaxonomy.cdm.service.UserHelperAccess;
39
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory;
40 39
import eu.etaxonomy.cdm.vaadin.event.EditorActionTypeFilter;
41 40
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
42 41
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent.Type;
......
93 92

  
94 93
        });
95 94

  
96
        CdmBeanItemContainerFactory selectFieldFactory = new CdmBeanItemContainerFactory(getRepo());
97 95
        CdmFilterablePagingProvider<Reference, Reference> collectionPagingProvider = pagingProviderFactory.referencePagingProvider();
98 96
        getView().getInReferenceCombobox().loadFrom(collectionPagingProvider, collectionPagingProvider, collectionPagingProvider.getPageSize());
99 97
        getView().getInReferenceCombobox().setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Reference>(getView().getInReferenceCombobox()));
......
111 109
        getView().getSchoolCombobox().getSelect().loadFrom(institutionPagingProvider, institutionPagingProvider, institutionPagingProvider.getPageSize());
112 110
        getView().getSchoolCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<Institution>(getView().getSchoolCombobox(), this));
113 111

  
114
        getView().getAnnotationsField().setAnnotationTypeItemContainer(selectFieldFactory.buildTermItemContainer(
112
        getView().getAnnotationsField().setAnnotationTypeItemContainer(cdmBeanItemContainerFactory.buildTermItemContainer(
115 113
                AnnotationType.EDITORIAL().getUuid(), AnnotationType.TECHNICAL().getUuid()));
116 114
    }
117 115

  
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListPresenter.java
39 39
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
40 40
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
41 41
import eu.etaxonomy.cdm.model.reference.Reference;
42
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory;
42
import eu.etaxonomy.cdm.service.CdmBeanItemContainerFactory;
43 43
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItem;
44 44
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
45 45
import eu.etaxonomy.cdm.vaadin.event.PagingEvent;
......
59 59
@ViewScope
60 60
public class ListPresenter extends AbstractPresenter<ListView> {
61 61

  
62
    /**
63
     *
64
     */
65 62
    private static final String REGISTRATION_LIST_PRESENTER_SEARCH_FILTER = "registration.listPresenter.searchFilter";
66 63

  
67 64
    private static final EnumSet<RegistrationStatus> inProgressStatus = EnumSet.of(
......
77 74
    @Autowired
78 75
    private IRegistrationWorkingSetService workingSetService;
79 76

  
77
    @Autowired
78
    protected CdmBeanItemContainerFactory cdmBeanItemContainerFactory;
79

  
80 80
    private Integer pageIndex = 0;
81 81
    private Integer pageSize = null;
82 82

  
......
108 108
            }
109 109
        }
110 110

  
111
        CdmBeanItemContainerFactory selectFieldFactory = new CdmBeanItemContainerFactory(getRepo());
112

  
113 111
        if(getView().getSubmitterFilter() != null){
114
            getView().getSubmitterFilter().setContainerDataSource(selectFieldFactory.buildBeanItemContainer(User.class));
112
            getView().getSubmitterFilter().setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(User.class));
115 113
            getView().getSubmitterFilter().setItemCaptionPropertyId("username");
116 114
        }
117 115

  
118 116
        List<UUID> typeDesignationStatusUUIDS = new ArrayList<>();
119 117
        typeDesignationStatusUUIDS.addAll(RegistrationTermLists.NAME_TYPE_DESIGNATION_STATUS_UUIDS());
120 118
        typeDesignationStatusUUIDS.addAll(RegistrationTermLists.SPECIMEN_TYPE_DESIGNATION_STATUS_UUIDS());
121
        BeanItemContainer<DefinedTermBase> buildTermItemContainer = selectFieldFactory.buildTermItemContainer(typeDesignationStatusUUIDS);
119
        BeanItemContainer<DefinedTermBase> buildTermItemContainer = cdmBeanItemContainerFactory.buildTermItemContainer(typeDesignationStatusUUIDS);
122 120
        buildTermItemContainer.addItem(NULL_TYPE_STATUS);
123 121
        getView().getStatusTypeFilter().setContainerDataSource(buildTermItemContainer);
124 122
        for(DefinedTermBase dt : buildTermItemContainer.getItemIds()){
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationEditorPresenter.java
23 23
import eu.etaxonomy.cdm.model.name.Registration;
24 24
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
25 25
import eu.etaxonomy.cdm.service.UserHelperAccess;
26
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory;
27 26
import eu.etaxonomy.cdm.vaadin.util.converter.JodaDateTimeConverter;
28 27
import eu.etaxonomy.vaadin.mvp.AbstractCdmEditorPresenter;
29 28
import eu.etaxonomy.vaadin.mvp.AbstractPopupEditor;
......
110 109
    public void handleViewEntered() {
111 110
        super.handleViewEntered();
112 111

  
113
        CdmBeanItemContainerFactory selectFieldFactory = new CdmBeanItemContainerFactory(getRepo());
114

  
115
        getView().getInstitutionField().setContainerDataSource(selectFieldFactory.buildBeanItemContainer(Institution.class));
112
        getView().getInstitutionField().setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(Institution.class));
116 113
        getView().getInstitutionField().setItemCaptionPropertyId("titleCache");
117 114

  
118
        getView().getSubmitterField().setContainerDataSource(selectFieldFactory.buildBeanItemContainer(User.class));
115
        getView().getSubmitterField().setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(User.class));
119 116
        getView().getSubmitterField().setItemCaptionPropertyId("username");
120 117

  
121 118

  
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkingsetPresenter.java
60 60
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
61 61
import eu.etaxonomy.cdm.ref.EntityReference;
62 62
import eu.etaxonomy.cdm.ref.TypedEntityReference;
63
import eu.etaxonomy.cdm.service.CdmBeanItemContainerFactory;
63 64
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider;
64 65
import eu.etaxonomy.cdm.service.CdmFilterablePagingProviderFactory;
65 66
import eu.etaxonomy.cdm.service.CdmStore;
66 67
import eu.etaxonomy.cdm.service.UserHelperAccess;
67
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory;
68 68
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationItem;
69 69
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStatusFieldInstantiator;
70 70
import eu.etaxonomy.cdm.vaadin.component.registration.RegistrationStatusSelect;
......
116 116
    @Autowired
117 117
    private CdmFilterablePagingProviderFactory pagingProviderFactory;
118 118

  
119
    @Autowired
120
    private CdmBeanItemContainerFactory selectFieldFactory;
121

  
119 122

  
120 123
    /**
121 124
     * @return the regWorkingSetService
......
247 250
            @Override
248 251
            public AbstractField<Object> create(RegistrationDTO regDto) {
249 252

  
250
                CdmBeanItemContainerFactory selectFieldFactory = new CdmBeanItemContainerFactory(getRepo());
251 253
                // submitters have GrantedAuthorities like REGISTRATION(PREPARATION).[UPDATE]{ab4459eb-3b96-40ba-bfaa-36915107d59e}
252 254
                UserHelper userHelper = UserHelperAccess.userHelper().withCache(getCache());
253 255
                Set<RegistrationStatus> availableStatus = new HashSet<>();
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmEditorPresenter.java
21 21

  
22 22
    private static final long serialVersionUID = -6315824180341694825L;
23 23

  
24

  
24 25
    @Override
25 26
    protected CDM createDTODecorator(CDM cdmEntitiy) {
26 27
        return cdmEntitiy;
src/main/java/eu/etaxonomy/vaadin/mvp/CdmEditorPresenterBase.java
26 26
import eu.etaxonomy.cdm.model.common.User;
27 27
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
28 28
import eu.etaxonomy.cdm.persistence.hibernate.permission.CdmAuthority;
29
import eu.etaxonomy.cdm.service.CdmBeanItemContainerFactory;
29 30
import eu.etaxonomy.cdm.service.CdmFilterablePagingProviderFactory;
30 31
import eu.etaxonomy.cdm.service.CdmStore;
31 32
import eu.etaxonomy.cdm.service.UserHelperAccess;
......
50 51

  
51 52
    protected BeanInstantiator<DTO> beanInstantiator = null;
52 53

  
54
    @Autowired
55
    protected CdmBeanItemContainerFactory cdmBeanItemContainerFactory;
56

  
57
    @Autowired
58
    protected CdmFilterablePagingProviderFactory pagingProviderFactory;
53 59

  
54 60
    /**
55 61
     * @param beanInstantiator the beanInstantiator to set
......
91 97

  
92 98
    protected CdmAuthority newAuthorityCreated;
93 99

  
94
    @Autowired
95
    protected CdmFilterablePagingProviderFactory pagingProviderFactory;
96 100

  
97 101
    protected CdmStore<CDM, IService<CDM>> getStore() {
98 102
        if(store == null){

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)