Project

General

Profile

Revision 56432bdd

ID56432bdd018d92bebb99ecfdaeca8721d7927416
Parent ead6f0f6
Child dcd8a4c1

Added by Andreas Kohlbecker about 3 years ago

fix #7533 typeStatus filter for registration list view

View differences:

src/main/java/eu/etaxonomy/cdm/service/IRegistrationWorkingSetService.java
17 17
import eu.etaxonomy.cdm.api.service.pager.Pager;
18 18
import eu.etaxonomy.cdm.model.common.User;
19 19
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
20
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
20 21
import eu.etaxonomy.cdm.vaadin.model.registration.RegistrationWorkingSet;
21 22

  
22 23
/**
......
37 38
    public Pager<RegistrationDTO> pageDTOs(Integer pageSize, Integer pageIndex);
38 39

  
39 40
    public Pager<RegistrationDTO> pageDTOs(User submitter, Collection<RegistrationStatus> includedStatus,
40
            String identifierFilterPattern, String taxonNameFilterPattern,
41
            String identifierFilterPattern, String taxonNameFilterPattern, Set<TypeDesignationStatusBase> typeStatusFilter,
41 42
            Integer pageSize, Integer pageIndex);
42 43

  
43 44
    /**
src/main/java/eu/etaxonomy/cdm/service/RegistrationWorkingSetService.java
35 35
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
36 36
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
37 37
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
38
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
38 39
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
39 40
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
40 41
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
......
177 178
    @Override
178 179
    public Pager<RegistrationDTO> pageDTOs(Integer pageSize, Integer pageIndex) {
179 180

  
180
        return pageDTOs(null, null, null, null, pageSize, pageIndex);
181
        return pageDTOs(null, null, null, null, null, pageSize, pageIndex);
181 182
    }
182 183

  
183 184
    /**
......
185 186
     */
186 187
    @Override
187 188
    public Pager<RegistrationDTO> pageDTOs(User submitter, Collection<RegistrationStatus> includedStatus,
188
            String identifierFilterPattern, String taxonNameFilterPattern,
189
            String identifierFilterPattern, String taxonNameFilterPattern, Set<TypeDesignationStatusBase> typeStatusFilter,
189 190
            Integer pageSize, Integer pageIndex) {
190 191

  
191 192
        if(pageSize == null){
......
195 196
        List<OrderHint> orderHints = Arrays.asList(new OrderHint("identifier", SortOrder.ASCENDING));
196 197

  
197 198
        Pager<Registration> pager = repo.getRegistrationService().page(submitter, includedStatus, identifierFilterPattern, taxonNameFilterPattern,
198
                PAGE_SIZE, pageIndex, orderHints , REGISTRATION_INIT_STRATEGY);
199
                typeStatusFilter, PAGE_SIZE, pageIndex , orderHints, REGISTRATION_INIT_STRATEGY);
199 200
        List<Registration> registrations = pager.getRecords();
200 201
        Pager<RegistrationDTO> dtoPager = new DefaultPagerImpl(pager.getCurrentIndex(), pager.getCount(), pager.getPageSize(), makeDTOs(registrations));
201 202
        if(logger.isDebugEnabled()){
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListPresenter.java
20 20
import org.vaadin.spring.events.EventScope;
21 21
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
22 22

  
23
import com.vaadin.data.util.BeanItemContainer;
23 24
import com.vaadin.navigator.Navigator;
24 25
import com.vaadin.spring.annotation.SpringComponent;
25 26
import com.vaadin.spring.annotation.ViewScope;
......
27 28

  
28 29
import eu.etaxonomy.cdm.api.service.dto.RegistrationDTO;
29 30
import eu.etaxonomy.cdm.api.service.pager.Pager;
31
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
30 32
import eu.etaxonomy.cdm.model.common.User;
31 33
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
34
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
35
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
32 36
import eu.etaxonomy.cdm.model.reference.Reference;
33 37
import eu.etaxonomy.cdm.service.IRegistrationWorkingSetService;
34 38
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory;
......
37 41
import eu.etaxonomy.cdm.vaadin.event.PagingEvent;
38 42
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent;
39 43
import eu.etaxonomy.cdm.vaadin.event.UpdateResultsEvent;
44
import eu.etaxonomy.cdm.vaadin.model.registration.RegistrationTermLists;
40 45
import eu.etaxonomy.vaadin.mvp.AbstractPresenter;
41 46
import eu.etaxonomy.vaadin.ui.navigation.NavigationEvent;
42 47

  
......
99 104
            getView().getSubmitterFilter().setItemCaptionPropertyId("username");
100 105
        }
101 106

  
107
        List<UUID> typeDesignationStatusUUIDS = new ArrayList<>();
108
        typeDesignationStatusUUIDS.addAll(RegistrationTermLists.NAME_TYPE_DESIGNATION_STATUS_UUIDS());
109
        typeDesignationStatusUUIDS.addAll(RegistrationTermLists.SPECIMEN_TYPE_DESIGNATION_STATUS_UUIDS());
110
        BeanItemContainer<DefinedTermBase> buildTermItemContainer = selectFieldFactory.buildTermItemContainer(typeDesignationStatusUUIDS);
111
        getView().getStatusTypeFilter().setContainerDataSource(buildTermItemContainer);
112
        for(DefinedTermBase dt : buildTermItemContainer.getItemIds()){
113
            String classAbbreviation = dt instanceof SpecimenTypeDesignationStatus ? "ST" : "NT";
114
            getView().getStatusTypeFilter().setItemCaption(dt, classAbbreviation + " - " + dt.getLabel());
115
        }
116

  
102 117
        getView().populate(pageRegistrations(null, null));
103 118
    }
104 119

  
......
119 134
        } else {
120 135
            identifierFilter = getView().getIdentifierFilter().getValue();
121 136
        }
137

  
122 138
        String nameFilter;
123 139
        if(textFieldOverride != null && textFieldOverride == getView().getTaxonNameFilter()){
124 140
            nameFilter = alternativeText;
125 141
        } else {
126 142
            nameFilter = getView().getTaxonNameFilter().getValue();
127 143
        }
144

  
128 145
        User submitter = null;
129 146
        if(getView().getSubmitterFilter() != null){
130 147
            Object o = getView().getSubmitterFilter().getValue();
......
134 151
        } else {
135 152
            submitter = (User) authentication.getPrincipal();
136 153
        }
154

  
155
        Set<TypeDesignationStatusBase> typeStatusFilter = (Set<TypeDesignationStatusBase>) getView().getStatusTypeFilter().getValue();
156
        if(typeStatusFilter.isEmpty()){
157
            typeStatusFilter = null;
158
        }
159

  
137 160
        EnumSet<RegistrationStatus> includeStatus = inProgressStatus;
138 161
        if(getView().getViewMode().equals(ListView.Mode.all)){
139 162
            includeStatus = null;
......
148 171
                includeStatus,
149 172
                StringUtils.trimToNull(identifierFilter),
150 173
                StringUtils.trimToNull(nameFilter),
174
                typeStatusFilter ,
151 175
                pageSize,
152 176
                pageIndex);
153 177
        return dtoPager;
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListView.java
11 11
import java.util.List;
12 12
import java.util.UUID;
13 13

  
14
import com.vaadin.ui.AbstractSelect;
14 15
import com.vaadin.ui.ListSelect;
15 16
import com.vaadin.ui.TextField;
16 17

  
......
78 79

  
79 80
    public RegistrationItem getRegistrationItem(UUID registrationUuid);
80 81

  
82
    AbstractSelect getStatusTypeFilter();
83

  
81 84

  
82 85
}
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListViewBean.java
24 24
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
25 25
import com.vaadin.server.Page;
26 26
import com.vaadin.spring.annotation.SpringView;
27
import com.vaadin.ui.AbstractSelect;
27 28
import com.vaadin.ui.Alignment;
28 29
import com.vaadin.ui.Component;
29 30
import com.vaadin.ui.CssLayout;
......
72 73

  
73 74
    private Label filterInstructionLabel = new Label("Filter the registrations by");
74 75

  
75
    private ListSelect statusFilter = null;
76
    private ListSelect registrationStatusFilter = null;
76 77

  
77 78
    private ListSelect submitterFilter = null; // must be null, the presenter relies on this
78 79

  
......
82 83

  
83 84
    private TextField referenceFilter = new TextFieldNFix("Publication");
84 85

  
86
    private AbstractSelect statusTypeFilter;
87

  
85 88
    public ListViewBean() {
86 89
        super();
87 90
    }
......
103 106
        }
104 107

  
105 108
        if(viewMode.equals(Mode.all)){
106
            statusFilter = new ListSelect("Status", Arrays.asList(RegistrationStatus.values()));
107
            statusFilter.setNullSelectionAllowed(true);
108
            statusFilter.setRows(1);
109
            statusFilter.addValueChangeListener(e -> updateResults(null, null));
110
            toolBar.addComponent(statusFilter);
109
            registrationStatusFilter = new ListSelect("Registration status", Arrays.asList(RegistrationStatus.values()));
110
            registrationStatusFilter.setNullSelectionAllowed(true);
111
            registrationStatusFilter.setRows(1);
112
            registrationStatusFilter.addValueChangeListener(e -> updateResults(null, null));
113
            toolBar.addComponent(registrationStatusFilter);
111 114
        }
112 115

  
113
        toolBar.addComponents(identifierFilter, taxonNameFilter);
116
        statusTypeFilter = new ListSelect("Type Status");
117
        ((ListSelect)statusTypeFilter).setRows(3);
118
        statusTypeFilter.setMultiSelect(true);
119
        statusTypeFilter.setNullSelectionAllowed(true);
120
        statusTypeFilter.addValueChangeListener(e -> updateResults(null, null));
121

  
122
        toolBar.addComponents(identifierFilter, taxonNameFilter, statusTypeFilter);
114 123
        int textChangeTimeOut = 200;
115 124
        identifierFilter.addTextChangeListener(e -> updateResults(identifierFilter, e.getText()));
116 125
        identifierFilter.setTextChangeTimeout(textChangeTimeOut);
......
268 277
    }
269 278

  
270 279
    /**
271
     * @return the statusFilter
280
     * @return the registrationStatusFilter
272 281
     */
273 282
    @Override
274 283
    public ListSelect getStatusFilter() {
275
        return statusFilter;
284
        return registrationStatusFilter;
276 285
    }
277 286

  
278 287
    /**
......
309 318
        return null;
310 319
    }
311 320

  
321
    /**
322
     * @return the statusTypeFilter
323
     */
324
    @Override
325
    public AbstractSelect getStatusTypeFilter() {
326
        return statusTypeFilter;
327
    }
328

  
312 329

  
313 330

  
314 331

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)