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);
|
dropping InactiveUIException