Revision 6f5e1f0c
Added by Andreas Kohlbecker almost 5 years ago
src/main/java/eu/etaxonomy/cdm/addon/config/CdmVaadinConfiguration.java | ||
---|---|---|
36 | 36 |
import com.vaadin.spring.server.SpringVaadinServlet; |
37 | 37 |
import com.vaadin.ui.UI; |
38 | 38 |
|
39 |
import eu.etaxonomy.cdm.api.application.AbstractDataInserter; |
|
39 | 40 |
import eu.etaxonomy.cdm.api.application.CdmRepository; |
41 |
import eu.etaxonomy.cdm.api.application.DummyDataInserter; |
|
40 | 42 |
import eu.etaxonomy.cdm.common.ConfigFileUtil; |
41 | 43 |
import eu.etaxonomy.cdm.dataInserter.RegistrationRequiredDataInserter; |
42 | 44 |
import eu.etaxonomy.cdm.opt.config.DataSourceConfigurer; |
... | ... | |
159 | 161 |
} |
160 | 162 |
|
161 | 163 |
@Bean |
162 |
public RegistrationRequiredDataInserter registrationRequiredDataInserter() throws BeansException{ |
|
163 |
RegistrationRequiredDataInserter inserter = null; |
|
164 |
public AbstractDataInserter registrationRequiredDataInserter() throws BeansException{ |
|
164 | 165 |
if(isUIEnabled(RegistrationUI.class)){ |
165 |
inserter = new RegistrationRequiredDataInserter(); |
|
166 |
RegistrationRequiredDataInserter inserter = new RegistrationRequiredDataInserter();
|
|
166 | 167 |
inserter.setRunAsAuthenticationProvider((AuthenticationProvider) applicationContext.getBean("runAsAuthenticationProvider")); |
167 | 168 |
inserter.setCdmRepository((CdmRepository) applicationContext.getBean("cdmRepository")); |
169 |
return inserter; |
|
170 |
} else { |
|
171 |
// the return type implements ApplicationListener and thus must not be null, |
|
172 |
// therefore we return a empty dummy implementation. |
|
173 |
return new DummyDataInserter(); |
|
168 | 174 |
} |
169 |
return inserter; |
|
170 | 175 |
} |
171 | 176 |
|
172 | 177 |
@Bean |
src/main/java/eu/etaxonomy/cdm/dataInserter/RegistrationRequiredDataInserter.java | ||
---|---|---|
21 | 21 |
import org.apache.log4j.Logger; |
22 | 22 |
import org.joda.time.DateTime; |
23 | 23 |
import org.joda.time.format.DateTimeFormatter; |
24 |
import org.springframework.context.ApplicationListener; |
|
25 | 24 |
import org.springframework.context.event.ContextRefreshedEvent; |
26 | 25 |
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; |
27 | 26 |
import org.springframework.security.core.GrantedAuthority; |
... | ... | |
31 | 30 |
import com.fasterxml.jackson.databind.JsonMappingException; |
32 | 31 |
import com.fasterxml.jackson.databind.ObjectMapper; |
33 | 32 |
|
33 |
import eu.etaxonomy.cdm.api.application.AbstractDataInserter; |
|
34 | 34 |
import eu.etaxonomy.cdm.api.application.CdmRepository; |
35 |
import eu.etaxonomy.cdm.api.application.RunAsAuthenticator; |
|
36 | 35 |
import eu.etaxonomy.cdm.api.service.pager.Pager; |
37 | 36 |
import eu.etaxonomy.cdm.model.agent.AgentBase; |
38 | 37 |
import eu.etaxonomy.cdm.model.agent.Institution; |
... | ... | |
53 | 52 |
* @since May 9, 2017 |
54 | 53 |
* |
55 | 54 |
*/ |
56 |
public class RegistrationRequiredDataInserter extends RunAsAuthenticator implements ApplicationListener<ContextRefreshedEvent>{
|
|
55 |
public class RegistrationRequiredDataInserter extends AbstractDataInserter {
|
|
57 | 56 |
|
58 | 57 |
protected static final String PARAM_NAME_CREATE = "registrationCreate"; |
59 | 58 |
|
src/main/java/org/springframework/context/event/README | ||
---|---|---|
1 |
This package contains the PojoEventListenerManager which manages the event lsiterner methodfs in mvp popup presenter instances.
|
|
1 |
This package contains the PojoEventListenerManager which manages the event listerner methods in mvp popup presenter instances.
|
|
2 | 2 |
Presenter instances are created in turn of the calls to NavigationManagerBean.findPopupView() |
3 | 3 |
The PojoEventListenerManager creates ApplicationListener instances for each method annotated with @EventListner |
4 | 4 |
and adds them to the EventMulticaster. |
Also available in: Unified diff
ref #6852 using the DummyDataInserter to avoid NPEs in the Spring ApplicationListener intitialization