← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2110: Fixed bug, including boolean values in DHIS 1.4 file import

 

------------------------------------------------------------
revno: 2110
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2010-11-19 16:15:14 +0100
message:
  Fixed bug, including boolean values in DHIS 1.4 file import
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/object/Dhis14RoutineDataValue.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/object/Dhis14SemiPermanentDataValue.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/routineDataValue.sqlmap.xml
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/semiPermanentDataValue.sqlmap.xml


--
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
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java	2010-08-31 07:06:55 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java	2010-11-19 15:15:14 +0000
@@ -111,8 +111,16 @@
         value.setOptionCombo( categoryOptionCombo );
         value.setPeriod( period );
         value.setSource( source );
-        value.setValue( String.valueOf( dhis14Value.getValue() ) );
         value.setStoredBy( dhis14Value.getStoredBy() );
+
+        if ( dhis14Value.getValue() != null )
+        {
+            value.setValue( String.valueOf( dhis14Value.getValue() ) );
+        }
+        else if ( dhis14Value.getYesNo() != null )
+        {
+            value.setValue( String.valueOf( dhis14Value.getYesNo() ) );
+        }   
         
         if ( value.getDataElement() != null && value.getPeriod() != null && value.getSource() != null && value.getValue() != null )
         {

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java	2010-08-31 07:06:55 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java	2010-11-19 15:15:14 +0000
@@ -114,8 +114,16 @@
         value.setOptionCombo( categoryOptionCombo );
         value.setPeriod( period );
         value.setSource( source );
-        value.setValue( String.valueOf( dhis14Value.getValue() ) );
 
+        if ( dhis14Value.getValue() != null )
+        {
+            value.setValue( String.valueOf( dhis14Value.getValue() ) );
+        }
+        else if ( dhis14Value.getYesNo() != null )
+        {
+            value.setValue( String.valueOf( dhis14Value.getYesNo() ) );
+        }   
+        
         if ( value.getDataElement() != null && value.getPeriod() != null && value.getSource() != null && value.getValue() != null )
         {
             importObject( value, params );

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/object/Dhis14RoutineDataValue.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/object/Dhis14RoutineDataValue.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/object/Dhis14RoutineDataValue.java	2010-11-19 15:15:14 +0000
@@ -43,6 +43,8 @@
     
     private Integer value;
     
+    private Integer yesNo;
+    
     private String storedBy;
     
     private Date timeStamp;
@@ -91,16 +93,26 @@
         this.organisationUnitId = organisationUnitId;
     }
 
-    public int getValue()
+    public Integer getValue()
     {
         return value;
     }
 
-    public void setValue( int value )
+    public void setValue( Integer value )
     {
         this.value = value;
     }
 
+    public Integer getYesNo()
+    {
+        return yesNo;
+    }
+
+    public void setYesNo( Integer yesNo )
+    {
+        this.yesNo = yesNo;
+    }
+
     public String getStoredBy()
     {
         return storedBy;

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/object/Dhis14SemiPermanentDataValue.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/object/Dhis14SemiPermanentDataValue.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/object/Dhis14SemiPermanentDataValue.java	2010-11-19 15:15:14 +0000
@@ -47,7 +47,9 @@
     
     private int organisationUnitId;
     
-    private int value;
+    private Integer value;
+
+    private Integer yesNo;
     
     private String storedBy;
     
@@ -117,16 +119,26 @@
         this.organisationUnitId = organisationUnitId;
     }
 
-    public int getValue()
+    public Integer getValue()
     {
         return value;
     }
 
-    public void setValue( int value )
+    public void setValue( Integer value )
     {
         this.value = value;
     }
 
+    public Integer getYesNo()
+    {
+        return yesNo;
+    }
+
+    public void setYesNo( Integer yesNo )
+    {
+        this.yesNo = yesNo;
+    }
+
     public String getStoredBy()
     {
         return storedBy;

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/routineDataValue.sqlmap.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/routineDataValue.sqlmap.xml	2009-12-12 16:21:25 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/routineDataValue.sqlmap.xml	2010-11-19 15:15:14 +0000
@@ -16,18 +16,19 @@
         <result property="dataElementId" column="DataElementID"/>
         <result property="periodId" column="DataPeriodID"/>
         <result property="organisationUnitId" column="OrgUnitID"/>
-        <result property="value" column="EntryNumber" nullValue="0"/> <!-- use double?-->
+        <result property="value" column="EntryNumber"/>
+		<result property="yesNo" column="EntryYesNo"/>
         <result property="storedBy" column="LastUserID"/>
     </resultMap>
 	
     <!-- Statement -->
 	
     <select id="getRoutineDataValues" resultMap="routineDataValueResultMap">
-        SELECT DataElementID, DataPeriodID, OrgUnitID, EntryNumber, LastUserID FROM RoutineData
+        SELECT DataElementID, DataPeriodID, OrgUnitID, EntryNumber, EntryYesNo, LastUserID FROM RoutineData
     </select>
 
     <select id="getRoutineDataValuesLastUpdated" parameterClass="java.util.Date" resultMap="routineDataValueResultMap">
-        SELECT DataElementID, DataPeriodID, OrgUnitID, EntryNumber, LastUserID FROM RoutineData WHERE LastUpdated > #value#
+        SELECT DataElementID, DataPeriodID, OrgUnitID, EntryNumber, EntryYesNo, LastUserID FROM RoutineData WHERE LastUpdated > #value#
     </select>
 
     <select id="getDistinctPeriodIdentifiers" resultClass="java.lang.Integer">

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/semiPermanentDataValue.sqlmap.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/semiPermanentDataValue.sqlmap.xml	2009-12-12 16:21:25 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/sqlmap/semiPermanentDataValue.sqlmap.xml	2010-11-19 15:15:14 +0000
@@ -18,21 +18,22 @@
         <result property="startDate" column="ValidFrom" typeHandler="dateTypeHandler"/>
         <result property="endDate" column="ValidTo" typeHandler="dateTypeHandler"/>
 		<result property="organisationUnitId" column="OrgUnitID"/>
-		<result property="value" column="EntryNumber" nullValue="0"/>
+		<result property="value" column="EntryNumber"/>
+		<result property="yesNo" column="EntryYesNo"/>
     </resultMap>
 	
 	<!-- Statement -->
 	
 	<select id="getSemiPermanentDataValues" resultMap="semiPermanentDataValueResultMap">
 		SELECT SemiPermanentData.DataElementID, SemiPermanentData.ValidFrom, SemiPermanentData.ValidTo, 
-		SemiPermanentData.OrgUnitID, SemiPermanentData.EntryNumber, DataElement.DataPeriodTypeID 
+		SemiPermanentData.OrgUnitID, SemiPermanentData.EntryNumber, SemiPermanentData.EntryYesNo, DataElement.DataPeriodTypeID 
 		FROM SemiPermanentData, DataElement 
         WHERE SemiPermanentData.DataElementID = DataElement.DataElementID
 	</select>
   
     <select id="getSemiPermanentDataValuesLastUpdated" parameterClass="java.util.Date" resultMap="semiPermanentDataValueResultMap">
         SELECT SemiPermanentData.DataElementID, SemiPermanentData.ValidFrom, SemiPermanentData.ValidTo, 
-        SemiPermanentData.OrgUnitID, SemiPermanentData.EntryNumber, DataElement.DataPeriodTypeID 
+        SemiPermanentData.OrgUnitID, SemiPermanentData.EntryNumber, SemiPermanentData.EntryYesNo, DataElement.DataPeriodTypeID 
         FROM SemiPermanentData, DataElement 
         WHERE SemiPermanentData.DataElementID = DataElement.DataElementID 
         AND LastUpdated > #value#