Revision: 4127
Author:   solomax666
Date:     Mon Aug 29 08:34:37 2011
Log: - DefaultIndex servlet is modified to work even if accessed too early
http://code.google.com/p/openmeetings/source/detail?r=4127

Modified:
/branches/dev/injection/WebContent/WEB-INF/openmeetings-applicationContext.xml /branches/dev/injection/src/app/org/openmeetings/app/data/basic/Configurationmanagement.java /branches/dev/injection/src/app/org/openmeetings/servlet/outputhandler/DefaultIndex.java

=======================================
--- /branches/dev/injection/WebContent/WEB-INF/openmeetings-applicationContext.xml Sun Aug 28 09:53:59 2011 +++ /branches/dev/injection/WebContent/WEB-INF/openmeetings-applicationContext.xml Mon Aug 29 08:34:37 2011
@@ -15,7 +15,6 @@
        </bean>

<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /> - <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>

<bean id="jpaTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
                <property name="entityManagerFactory" ref="entityManagerFactory" 
/>
@@ -266,6 +265,7 @@

        <tx:annotation-driven transaction-manager="jpaTransactionManager"/>

-       <context:annotation-config/>
+       <context:annotation-config />
+       <context:component-scan base-package="org.openmeetings"/>

 </beans>
=======================================
--- /branches/dev/injection/src/app/org/openmeetings/app/data/basic/Configurationmanagement.java Mon Aug 15 11:47:14 2011 +++ /branches/dev/injection/src/app/org/openmeetings/app/data/basic/Configurationmanagement.java Mon Aug 29 08:34:37 2011
@@ -33,11 +33,28 @@

        @PersistenceContext
        private EntityManager em;
-       @Autowired
+
        private UsersDaoImpl usersDao;
-       @Autowired
        private AuthLevelmanagement authLevelManagement;

+       private static int autowiredComplete = 0;
+
+       public static boolean autowiredComplete() {
+               return autowiredComplete > 1;
+       }
+
+       @Autowired
+       public void setUsersDao(UsersDaoImpl usersDao) {
+               autowiredComplete ++;
+               this.usersDao = usersDao;
+       }
+
+       @Autowired
+ public void setAuthLevelmanagement(AuthLevelmanagement authLevelmanagement) {
+               autowiredComplete ++;
+               this.authLevelManagement = authLevelmanagement;
+       }
+
        public Configuration getConfKey(long user_level, String CONF_KEY) {
                try {
                        if (authLevelManagement.checkUserLevel(user_level)) {
@@ -47,6 +64,7 @@
                                query.setParameter("conf_key", CONF_KEY);
                                query.setParameter("deleted", "false");

+                               @SuppressWarnings("unchecked")
                                List<Configuration> configs = 
query.getResultList();

                                if (configs != null && configs.size() > 0) {
@@ -148,7 +166,8 @@
                        // get all users
                        Query query = em
.createQuery("select count(c.configuration_id) from Configuration c where c.deleted = 'false'");
-                       List ll = query.getResultList();
+                       @SuppressWarnings("unchecked")
+                       List<Long> ll = query.getResultList();
                        log.debug("selectMaxFromConfigurations" + ll.get(0));
                        return (Long) ll.get(0);
                } catch (Exception ex2) {
=======================================
--- /branches/dev/injection/src/app/org/openmeetings/servlet/outputhandler/DefaultIndex.java Sun Aug 28 09:53:59 2011 +++ /branches/dev/injection/src/app/org/openmeetings/servlet/outputhandler/DefaultIndex.java Mon Aug 29 08:34:37 2011
@@ -24,9 +24,11 @@

        private Configurationmanagement getConfigurationmanagement() {
                try {
-                       ApplicationContext context = WebApplicationContextUtils
-                                       
.getWebApplicationContext(getServletContext());
-                       return (Configurationmanagement) 
context.getBean("cfgManagement");
+                       if (Configurationmanagement.autowiredComplete()) {
+                               ApplicationContext context = 
WebApplicationContextUtils
+                                               
.getWebApplicationContext(getServletContext());
+                               return (Configurationmanagement) 
context.getBean("cfgManagement");
+                       }
                } catch (Exception err) {
                        log.error("[getConfigurationmanagement]", err);
                }
@@ -135,7 +137,8 @@

                        // Load params from URL and set into wrapper code
                        if (httpServletRequest.getParameterMap() != null) {
-                               for (Iterator<String> iter = httpServletRequest
+                               for (@SuppressWarnings("unchecked")
+                               Iterator<String> iter = httpServletRequest
                                                
.getParameterMap().keySet().iterator(); iter.hasNext();) {
                                        String paramKey = iter.next();
                                        SWF_FLASHVARS += paramKey

--
You received this message because you are subscribed to the Google Groups 
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/openmeetings-dev?hl=en.

Reply via email to