Project

General

Profile

« Previous | Next » 

Revision b10dc109

Added by Andreas Kohlbecker over 6 years ago

dropping InactiveUIException

View differences:

src/main/java/eu/etaxonomy/cdm/addon/config/CdmVaadinConfiguration.java
44 44
import eu.etaxonomy.cdm.vaadin.server.CdmSpringVaadinServletService;
45 45
import eu.etaxonomy.cdm.vaadin.ui.ConceptRelationshipUI;
46 46
import eu.etaxonomy.cdm.vaadin.ui.DistributionStatusUI;
47
import eu.etaxonomy.cdm.vaadin.ui.InactiveUIException;
48 47
import eu.etaxonomy.cdm.vaadin.ui.RegistrationUI;
49 48
import eu.etaxonomy.cdm.vaadin.ui.StatusEditorUI;
50 49
import eu.etaxonomy.vaadin.ui.annotation.EnableVaadinSpringNavigation;
......
125 124

  
126 125
                        @Override
127 126
                        public void error(ErrorEvent errorEvent) {
128
                            if(errorEvent.getThrowable() instanceof InactiveUIException){
129
                                //TODO redirect to an ErrorUI or show and error Page
130
                                // better use Spring MVC Error handlers instead?
131
                            } else {
132
                                doDefault(errorEvent);
133
                            }
127
                            // ...
134 128
                        }
135 129

  
136 130
                    });
......
148 142

  
149 143
    @Bean
150 144
    @UIScope
151
    public ConceptRelationshipUI conceptRelationshipUI() throws InactiveUIException {
145
    public ConceptRelationshipUI conceptRelationshipUI() {
152 146
        if(isUIEnabled(ConceptRelationshipUI.class)){
153 147
            return new ConceptRelationshipUI();
154 148
        }
......
157 151

  
158 152
    @Bean
159 153
    @UIScope
160
    public RegistrationUI registrationUI() throws InactiveUIException {
154
    public RegistrationUI registrationUI() {
161 155
        if(isUIEnabled(RegistrationUI.class)){
162 156
            return new RegistrationUI();
163 157
        }
......
165 159
    }
166 160

  
167 161
    @Bean
168
    public RegistrationRequiredDataInserter registrationRequiredDataInserter() throws BeansException, InactiveUIException{
162
    public RegistrationRequiredDataInserter registrationRequiredDataInserter() throws BeansException{
169 163
        RegistrationRequiredDataInserter inserter = null;
170 164
        if(isUIEnabled(RegistrationUI.class)){
171 165
            inserter = new RegistrationRequiredDataInserter();
......
177 171

  
178 172
    @Bean
179 173
    @UIScope
180
    public DistributionStatusUI distributionStatusUI() throws InactiveUIException {
174
    public DistributionStatusUI distributionStatusUI() {
181 175
        if(isUIEnabled(DistributionStatusUI.class)){
182 176
            return new DistributionStatusUI();
183 177
        }
......
186 180

  
187 181
    @Bean
188 182
    @UIScope
189
    public StatusEditorUI statusEditorUI() throws InactiveUIException {
183
    public StatusEditorUI statusEditorUI() {
190 184
        if(isUIEnabled(StatusEditorUI.class)){
191 185
            return new StatusEditorUI();
192 186
        }
......
221 215
     *
222 216
     * @param type
223 217
     * @return
224
     * @throws InactiveUIException
225 218
     */
226
    private boolean isUIEnabled(Class<? extends UI>uiClass) throws InactiveUIException {
219
    private boolean isUIEnabled(Class<? extends UI>uiClass) {
227 220

  
228 221
        String path = uiClass.getAnnotation(SpringUI.class).path().trim();
229 222

  
......
240 233
                    return true;
241 234
                }
242 235
            }
243
            throw new InactiveUIException(path); // FIXME should return false instead
236
            return false;
244 237
        } catch (IOException e) {
245 238
            logger.error("Error reading the vaadin ui properties file. File corrupted?. Stopping instance ...");
246 239
            throw new RuntimeException(e);
src/main/java/eu/etaxonomy/cdm/vaadin/ui/InactiveUIException.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.ui;
10

  
11
/**
12
 * @author a.kohlbecker
13
 * @since May 8, 2017
14
 *
15
 */
16
public class InactiveUIException extends Exception {
17

  
18

  
19
    private static final long serialVersionUID = 3225226104624596439L;
20

  
21
    String viewName;
22

  
23
    public InactiveUIException(String viewName){
24
        super("The requested view '" + viewName + "' is not active for this web application instance.");
25
        this.viewName = viewName;
26
    }
27

  
28
    public String getViewName() {
29
        return viewName;
30
    }
31

  
32

  
33

  
34
}

Also available in: Unified diff