← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20163: Event report, enum for dataType

 

------------------------------------------------------------
revno: 20163
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-09-15 13:02:35 +0200
message:
  Event report, enum for dataType
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.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/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.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-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java	2015-09-15 10:40:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java	2015-09-15 11:02:35 +0000
@@ -32,6 +32,7 @@
 import java.util.Date;
 import java.util.List;
 
+import org.hisp.dhis.analytics.EventDataType;
 import org.hisp.dhis.analytics.EventOutputType;
 import org.hisp.dhis.common.BaseAnalyticalObject;
 import org.hisp.dhis.common.BaseDimensionalObject;
@@ -107,7 +108,7 @@
     /**
      * Type of data, can be aggregated values and individual cases.
      */
-    private String dataType;
+    private EventDataType dataType;
 
     /**
      * Dimensions to crosstabulate / use as columns.
@@ -335,12 +336,12 @@
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public String getDataType()
+    public EventDataType getDataType()
     {
         return dataType;
     }
 
-    public void setDataType( String dataType )
+    public void setDataType( EventDataType dataType )
     {
         this.dataType = dataType;
     }

=== modified file '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/startup/TableAlteror.java	2015-09-15 10:40:23 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-09-15 11:02:35 +0000
@@ -887,13 +887,16 @@
         executeSql( "update eventreport set displaydensity='NORMAL' where displaydensity='normal'" );
         executeSql( "update eventreport set displaydensity='COMPACT' where displaydensity='compact'" );
 
-        executeSql( "update reporttable set fontsize='LARGE' where displaydensity='large'" );
-        executeSql( "update reporttable set fontsize='NORMAL' where displaydensity='normal'" );
-        executeSql( "update reporttable set fontsize='SMALL' where displaydensity='small'" );
-
-        executeSql( "update eventreport set fontsize='LARGE' where displaydensity='large'" );
-        executeSql( "update eventreport set fontsize='NORMAL' where displaydensity='normal'" );
-        executeSql( "update eventreport set fontsize='SMALL' where displaydensity='small'" );
+        executeSql( "update reporttable set fontsize='LARGE' where fontsize='large'" );
+        executeSql( "update reporttable set fontsize='NORMAL' where fontsize='normal'" );
+        executeSql( "update reporttable set fontsize='SMALL' where fontsize='small'" );
+
+        executeSql( "update eventreport set fontsize='LARGE' where fontsize='large'" );
+        executeSql( "update eventreport set fontsize='NORMAL' where fontsize='normal'" );
+        executeSql( "update eventreport set fontsize='SMALL' where fontsize='small'" );
+
+        executeSql( "update eventreport set datatype='AGGREGATED_VALUES' where datatype='aggregated_values'" );
+        executeSql( "update eventreport set datatype='EVENTS' where datatype='individual_cases'" );
 
         oauth2();
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml	2015-09-15 10:40:23 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml	2015-09-15 11:02:35 +0000
@@ -104,7 +104,12 @@
 
     <property name="completedOnly" column="completedonly" />
 	
-    <property name="dataType" not-null="true" />
+    <property name="dataType" length="40">
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.analytics.EventDataType</param>
+        <param name="type">12</param>
+      </type> 
+    </property>
 
     <list name="columnDimensions" table="eventreport_columns">
       <cache usage="read-write" />
@@ -142,10 +147,10 @@
     <property name="showHierarchy" />
 
     <property name="outputType" length="30">
-		<type name="org.hibernate.type.EnumType">
-			<param name="enumClass">org.hisp.dhis.analytics.EventOutputType</param>
-			<param name="type">12</param>
-		</type> 
+	  <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.analytics.EventOutputType</param>
+        <param name="type">12</param>
+      </type> 
 	</property>
 
 	<property name="collapseDataDimensions" />
@@ -155,18 +160,18 @@
     <property name="digitGroupSeparator" />
 
     <property name="displayDensity" length="40">
-		<type name="org.hibernate.type.EnumType">
-			<param name="enumClass">org.hisp.dhis.common.DisplayDensity</param>
-			<param name="type">12</param>
-		</type> 
-	</property>
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.common.DisplayDensity</param>
+        <param name="type">12</param>
+      </type> 
+    </property>
 
     <property name="fontSize" length="40">
-		<type name="org.hibernate.type.EnumType">
-			<param name="enumClass">org.hisp.dhis.common.FontSize</param>
-			<param name="type">12</param>
-		</type> 
-	</property>
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.common.FontSize</param>
+        <param name="type">12</param>
+      </type> 
+    </property>
 
     <property name="sortOrder" />
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java	2015-09-15 11:02:35 +0000
@@ -31,6 +31,7 @@
 import static org.junit.Assert.*;
 
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.analytics.EventDataType;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.junit.Test;
@@ -62,13 +63,13 @@
     {
         EventReport erA = new EventReport( "erA" );
         erA.setProgram( prA );
-        erA.setDataType( EventReport.DATA_TYPE_AGGREGATED_VALUES );
+        erA.setDataType( EventDataType.AGGREGATED_VALUES );
         EventReport erB = new EventReport( "erB" );
         erB.setProgram( prA );
-        erB.setDataType( EventReport.DATA_TYPE_AGGREGATED_VALUES );
+        erB.setDataType( EventDataType.AGGREGATED_VALUES );
         EventReport erC = new EventReport( "erC" );
         erC.setProgram( prA );
-        erC.setDataType( EventReport.DATA_TYPE_AGGREGATED_VALUES );
+        erC.setDataType( EventDataType.AGGREGATED_VALUES );
 
         int idA = eventReportService.saveEventReport( erA );
         int idB = eventReportService.saveEventReport( erB );
@@ -84,13 +85,13 @@
     {
         EventReport erA = new EventReport( "erA" );
         erA.setProgram( prA );
-        erA.setDataType( EventReport.DATA_TYPE_AGGREGATED_VALUES );
+        erA.setDataType( EventDataType.AGGREGATED_VALUES );
         EventReport erB = new EventReport( "erB" );
         erB.setProgram( prA );
-        erB.setDataType( EventReport.DATA_TYPE_AGGREGATED_VALUES );
+        erB.setDataType( EventDataType.AGGREGATED_VALUES );
         EventReport erC = new EventReport( "erC" );
         erC.setProgram( prA );
-        erC.setDataType( EventReport.DATA_TYPE_AGGREGATED_VALUES );
+        erC.setDataType( EventDataType.AGGREGATED_VALUES );
 
         int idA = eventReportService.saveEventReport( erA );
         int idB = eventReportService.saveEventReport( erB );

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml	2015-09-15 10:40:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml	2015-09-15 11:02:35 +0000
@@ -141,29 +141,29 @@
     <property name="hideEmptyRows" />
     
     <property name="aggregationType" length="40">
-		<type name="org.hibernate.type.EnumType">
-			<param name="enumClass">org.hisp.dhis.analytics.AggregationType</param>
-			<param name="type">12</param>
-		</type> 
-	</property>
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.analytics.AggregationType</param>
+        <param name="type">12</param>
+      </type> 
+    </property>
 
     <property name="completedOnly" column="completedonly" />
 	
     <property name="digitGroupSeparator" />
 
     <property name="displayDensity" length="40">
-		<type name="org.hibernate.type.EnumType">
-			<param name="enumClass">org.hisp.dhis.common.DisplayDensity</param>
-			<param name="type">12</param>
-		</type> 
-	</property>
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.common.DisplayDensity</param>
+        <param name="type">12</param>
+      </type> 
+    </property>
 
     <property name="fontSize" length="40">
-		<type name="org.hibernate.type.EnumType">
-			<param name="enumClass">org.hisp.dhis.common.FontSize</param>
-			<param name="type">12</param>
-		</type> 
-	</property>
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.common.FontSize</param>
+        <param name="type">12</param>
+      </type> 
+    </property>
 
     <property name="userOrganisationUnit" />