import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import org.springframework.security.core.context.SecurityContext;
+
import eu.etaxonomy.cdm.api.service.ICommonService;
import eu.etaxonomy.cdm.api.service.IService;
import eu.etaxonomy.cdm.api.service.ITestService;
+import eu.etaxonomy.taxeditor.service.ICachedCommonService;
/**
* @author cmathew
private ICdmDataChangeService dataChangeService;
+ private SecurityContext securityContext;
+
+
public static CdmApplicationState getInstance() {
if(cdmApplicationState == null) {
cdmApplicationState = new CdmApplicationState();
getInstance().setDataChangeService(dataChangeService);
}
+
+
+ /**
+ * @return the securityContext
+ */
+ public SecurityContext getSecurityContext() {
+ return securityContext;
+ }
+
+ /**
+ * @param securityContext the securityContext to set
+ */
+ public void setSecurityContext(SecurityContext securityContext) {
+ this.securityContext = securityContext;
+ }
+
+ /**
+ * @return the securityContext
+ */
+ public static SecurityContext getCurrentSecurityContext() {
+ return getInstance().getSecurityContext();
+ }
+
+ /**
+ * @param securityContext the securityContext to set
+ */
+ public static void setCurrentSecurityContext(SecurityContext securityContext) {
+ getInstance().setSecurityContext(securityContext);
+ }
+
public static void dispose() {
getInstance().setCurrentDataChangeService(null);
getInstance().setAppConfig(null);
+ getInstance().setSecurityContext(null);
}
+
/**
* Generic method that will scan the getters of {@link ICdmApplicationConfiguration} for the given service
* interface. If a matching getter is found the according service implementation is returned by
return service;
}
+
/**
* @see #getService(Class)
* As ICommonService is not extending IService we need a specific request here
}
+ public static ICachedCommonService getCachedCommonService() {
+ ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+
+ return ((CdmApplicationRemoteController)configuration).getCachedCommonService();
+
+ }
+
}