← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1860: Applied patch from Quang. Fixes problem with mandatory column in patientattribute table.

 

------------------------------------------------------------
revno: 1860
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Mon 2010-05-17 16:01:28 +0200
message:
  Applied patch from Quang. Fixes problem with mandatory column in patientattribute table.
renamed:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/OptionsCategoriesDefaultSortOrderPopulator.java => dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== renamed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/OptionsCategoriesDefaultSortOrderPopulator.java' => 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/OptionsCategoriesDefaultSortOrderPopulator.java	2010-04-28 10:36:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2010-05-17 14:01:28 +0000
@@ -1,4 +1,4 @@
-package org.hisp.dhis.dataelement;
+package org.hisp.dhis.startup;
 
 /*
  * Copyright (c) 2004-2010, University of Oslo
@@ -45,10 +45,10 @@
  * @author Lars Helge Overland
  * @version $Id$
  */
-public class OptionsCategoriesDefaultSortOrderPopulator
+public class TableAlteror
     extends AbstractStartupRoutine
 {
-    private static final Log log = LogFactory.getLog( OptionsCategoriesDefaultSortOrderPopulator.class );
+    private static final Log log = LogFactory.getLog( TableAlteror.class );
 
     // -------------------------------------------------------------------------
     // Dependencies
@@ -123,7 +123,13 @@
         executeSql( "ALTER TABLE indicator DROP CONSTRAINT indicator_code_key" );
         executeSql( "ALTER TABLE organisationunit DROP CONSTRAINT organisationunit_code_key" );
         
-        log.info( "Updated Category sort order and primary keys" );
+        //add mandatory boolean field to patientattribute
+        if ( executeSql( "ALTER TABLE patientattribute ADD mandatory bool" ) >= 0 )
+        {
+            executeSql( "UPDATE patientattribute SET mandatory=false" );
+        }
+        
+        log.info( "Tables updated" );
     }
     
     private List<Integer> getDistinctIdList( String table, String col1 )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 02:59:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 14:01:28 +0000
@@ -716,13 +716,6 @@
     <property name="runlevel" value="2"/>
   </bean>
 	  
-  <bean id="org.hisp.dhis.dataelement.OptionsCategoriesDefaultSortOrderPopulator"
-    class="org.hisp.dhis.dataelement.OptionsCategoriesDefaultSortOrderPopulator">
-    <property name="statementManager" ref="statementManager"/>
-    <property name="runlevel" value="1"/>
-	<property name="skipInTests" value="true"/>
-  </bean>
-	
   <bean id="org.hisp.dhis.expression.MultiDimensionExpressionUpgrader"
     class="org.hisp.dhis.expression.MultiDimensionExpressionUpgrader">
     <property name="expressionService"
@@ -764,6 +757,20 @@
     <property name="skipInTests" value="true"/>
   </bean>
     
+  <bean id="org.hisp.dhis.startup.TableCreator"
+    class="org.hisp.dhis.startup.TableCreator">
+    <property name="runlevel" value="3"/>
+    <property name="jdbcTemplate" ref="jdbcTemplate"/>
+    <property name="statementBuilder" ref="statementBuilder"/>
+  </bean>
+    
+  <bean id="org.hisp.dhis.startup.TableAlteror"
+    class="org.hisp.dhis.startup.TableAlteror">
+    <property name="statementManager" ref="statementManager"/>
+    <property name="runlevel" value="1"/>
+	<property name="skipInTests" value="true"/>
+  </bean>
+	
   <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
     <property name="targetObject"
       ref="org.hisp.dhis.system.startup.StartupRoutineExecutor"/>
@@ -771,8 +778,9 @@
     <property name="arguments">
       <list>
         <list>
-          <ref local="org.hisp.dhis.dataelement.OptionsCategoriesDefaultSortOrderPopulator"/>
           <ref local="org.hisp.dhis.period.PeriodTypePopulator"/>
+          <ref local="org.hisp.dhis.startup.TableCreator"/>
+          <ref local="org.hisp.dhis.startup.TableAlteror"/>
           <ref local="org.hisp.dhis.dataelement.DataElementDefaultDimensionPopulator"/>
           <ref local="org.hisp.dhis.expression.MultiDimensionExpressionUpgrader"/>
           <ref local="org.hisp.dhis.dataset.DataSetShortNamePopulator"/>
@@ -1026,26 +1034,6 @@
     </property>
   </bean>
   
-  <!-- Startup -->
-  
-  <bean id="org.hisp.dhis.startup.TableCreator"
-    class="org.hisp.dhis.startup.TableCreator">
-    <property name="runlevel" value="3"/>
-    <property name="jdbcTemplate" ref="jdbcTemplate"/>
-    <property name="statementBuilder" ref="statementBuilder"/>
-  </bean>
-    
-  <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
-    <property name="targetObject"
-      ref="org.hisp.dhis.system.startup.StartupRoutineExecutor"/>
-    <property name="targetMethod" value="addStartupRoutines"/>
-    <property name="arguments">
-      <list>
-        <ref local="org.hisp.dhis.startup.TableCreator"/>
-      </list>
-    </property>
-  </bean>
-  
   <!-- Min/Max validation -->
   
  <bean id="org.hisp.dhis.minmax.validation.MinMaxValuesGenerationService"