← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20164: Event chart, chart, enum for type

 

------------------------------------------------------------
revno: 20164
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-09-15 13:21:39 +0200
message:
  Event chart, chart, enum for type
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/analytics/EventDataType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartType.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/BaseChart.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/eventchart/EventChart.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/eventchart/EventChartServiceTest.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml
  dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/analytics/EventDataType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/analytics/EventDataType.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/analytics/EventDataType.java	2015-09-15 11:21:39 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.analytics;
+
+/*
+ * Copyright (c) 2004-2015, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @author Lars Helge Overland
+ */
+public enum EventDataType
+{
+    AGGREGATED_VALUES, EVENTS
+}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/BaseChart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/BaseChart.java	2015-09-14 10:39:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/BaseChart.java	2015-09-15 11:21:39 +0000
@@ -63,22 +63,12 @@
 @JacksonXmlRootElement( localName = "baseChart", namespace = DxfNamespaces.DXF_2_0 )
 public abstract class BaseChart
     extends BaseAnalyticalObject
-{    
-    public static final String TYPE_COLUMN = "column";
-    public static final String TYPE_STACKED_COLUMN = "stackedcolumn";
-    public static final String TYPE_BAR = "bar";
-    public static final String TYPE_STACKED_BAR = "stackedbar";
-    public static final String TYPE_LINE = "line";
-    public static final String TYPE_AREA = "area";
-    public static final String TYPE_PIE = "pie";
-    public static final String TYPE_RADAR = "radar";
-    public static final String TYPE_METER = "gauge";
-
+{
     protected String domainAxisLabel;
 
     protected String rangeAxisLabel;
 
-    protected String type;
+    protected ChartType type;
 
     protected boolean hideLegend;
 
@@ -146,9 +136,9 @@
     // Logic
     // -------------------------------------------------------------------------
 
-    public boolean isType( String type )
+    public boolean isType( ChartType type )
     {
-        return this.type != null && this.type.equalsIgnoreCase( type );
+        return this.type != null && this.type.equals( type );
     }
 
     public boolean isTargetLine()
@@ -279,12 +269,12 @@
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public String getType()
+    public ChartType getType()
     {
         return type;
     }
 
-    public void setType( String type )
+    public void setType( ChartType type )
     {
         this.type = type;
     }

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartType.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartType.java	2015-09-15 11:21:39 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.chart;
+
+/*
+ * Copyright (c) 2004-2015, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @author Lars Helge Overland
+ */
+public enum ChartType
+{
+    COLUMN, STACKED_COLUMN, BAR, STACKED_BAR, LINE, AREA, PIE, RADAR, GAUGE;
+}

=== 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 11:02:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-09-15 11:21:39 +0000
@@ -871,33 +871,8 @@
         executeSql( "drop table aggregatedorgunitindicatorvalue" );
         executeSql( "drop table aggregatedorgunitindicatorvalue_temp" );
         
-        executeSql( "update report set type='JASPER_REPORT_TABLE' where type='jasperReportTable'" );
-        executeSql( "update report set type='JASPER_JDBC' where type='jasperJdbc'" );
-        executeSql( "update report set type='HTML' where type='html'" );
-        
-        executeSql( "update dashboarditem set shape='NORMAL' where shape ='normal'" );
-        executeSql( "update dashboarditem set shape='DOUBLE_WIDTH' where shape ='double_width'" );
-        executeSql( "update dashboarditem set shape='FULL_WIDTH' where shape ='full_width'" );
-        
-        executeSql( "update reporttable set displaydensity='COMFORTABLE' where displaydensity='comfortable'" );
-        executeSql( "update reporttable set displaydensity='NORMAL' where displaydensity='normal'" );
-        executeSql( "update reporttable set displaydensity='COMPACT' where displaydensity='compact'" );
-
-        executeSql( "update eventreport set displaydensity='COMFORTABLE' where displaydensity='comfortable'" );
-        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 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'" );
-
+        updateEnums();
+        
         oauth2();
 
         upgradeDataValuesWithAttributeOptionCombo();
@@ -940,6 +915,60 @@
             ")" );
     }
 
+    private void updateEnums()
+    {
+        executeSql( "update report set type='JASPER_REPORT_TABLE' where type='jasperReportTable'" );
+        executeSql( "update report set type='JASPER_JDBC' where type='jasperJdbc'" );
+        executeSql( "update report set type='HTML' where type='html'" );
+        
+        executeSql( "update dashboarditem set shape='NORMAL' where shape ='normal'" );
+        executeSql( "update dashboarditem set shape='DOUBLE_WIDTH' where shape ='double_width'" );
+        executeSql( "update dashboarditem set shape='FULL_WIDTH' where shape ='full_width'" );
+        
+        executeSql( "update reporttable set displaydensity='COMFORTABLE' where displaydensity='comfortable'" );
+        executeSql( "update reporttable set displaydensity='NORMAL' where displaydensity='normal'" );
+        executeSql( "update reporttable set displaydensity='COMPACT' where displaydensity='compact'" );
+
+        executeSql( "update eventreport set displaydensity='COMFORTABLE' where displaydensity='comfortable'" );
+        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 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'" );
+
+        executeSql( "update chart set type='COLUMN' where type='column'" );
+        executeSql( "update chart set type='STACKED_COLUMN' where type='stackedcolumn'" );
+        executeSql( "update chart set type='STACKED_COLUMN' where type='stackedColumn'" );
+        executeSql( "update chart set type='BAR' where type='bar'" );
+        executeSql( "update chart set type='STACKED_BAR' where type='stackedbar'" );
+        executeSql( "update chart set type='STACKED_BAR' where type='stackedBar'" );
+        executeSql( "update chart set type='LINE' where type='line'" );
+        executeSql( "update chart set type='AREA' where type='area'" );
+        executeSql( "update chart set type='PIE' where type='pie'" );
+        executeSql( "update chart set type='RADAR' where type='radar'" );
+        executeSql( "update chart set type='GAUGE' where type='gauge'" );
+
+        executeSql( "update eventchart set type='COLUMN' where type='column'" );
+        executeSql( "update eventchart set type='STACKED_COLUMN' where type='stackedcolumn'" );
+        executeSql( "update eventchart set type='STACKED_COLUMN' where type='stackedColumn'" );
+        executeSql( "update eventchart set type='BAR' where type='bar'" );
+        executeSql( "update eventchart set type='STACKED_BAR' where type='stackedbar'" );
+        executeSql( "update eventchart set type='STACKED_BAR' where type='stackedBar'" );
+        executeSql( "update eventchart set type='LINE' where type='line'" );
+        executeSql( "update eventchart set type='AREA' where type='area'" );
+        executeSql( "update eventchart set type='PIE' where type='pie'" );
+        executeSql( "update eventchart set type='RADAR' where type='radar'" );
+        executeSql( "update eventchart set type='GAUGE' where type='gauge'" );
+    }
+    
     private void upgradeAggregationType( String table )
     {
         executeSql( "update " + table + " set aggregationtype='SUM' where aggregationtype='sum'" );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml	2015-09-10 11:56:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml	2015-09-15 11:21:39 +0000
@@ -104,8 +104,13 @@
 
     <property name="completedOnly" column="completedonly" />
 	
-    <property name="type" not-null="true" />
-
+    <property name="type" length="40" not-null="true">
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.chart.ChartType</param>
+        <param name="type">12</param>
+      </type> 
+	</property>
+	
     <list name="columnDimensions" table="eventchart_columns">
       <cache usage="read-write" />
       <key column="eventchartid" foreign-key="fk_eventchart_columns_eventchartid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/eventchart/EventChartServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/eventchart/EventChartServiceTest.java	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/eventchart/EventChartServiceTest.java	2015-09-15 11:21:39 +0000
@@ -31,6 +31,7 @@
 import static org.junit.Assert.*;
 
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.chart.ChartType;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
 import org.junit.Test;
@@ -62,13 +63,13 @@
     {
         EventChart ecA = new EventChart( "ecA" );
         ecA.setProgram( prA );
-        ecA.setType( EventChart.TYPE_COLUMN );
+        ecA.setType( ChartType.COLUMN );
         EventChart ecB = new EventChart( "ecB" );
         ecB.setProgram( prA );
-        ecB.setType( EventChart.TYPE_COLUMN );
+        ecB.setType( ChartType.COLUMN );
         EventChart ecC = new EventChart( "ecC" );
         ecC.setProgram( prA );
-        ecC.setType( EventChart.TYPE_COLUMN );
+        ecC.setType( ChartType.COLUMN );
 
         int idA = eventChartService.saveEventChart( ecA );
         int idB = eventChartService.saveEventChart( ecB );
@@ -84,13 +85,13 @@
     {
         EventChart ecA = new EventChart( "ecA" );
         ecA.setProgram( prA );
-        ecA.setType( EventChart.TYPE_COLUMN );
+        ecA.setType( ChartType.COLUMN );
         EventChart ecB = new EventChart( "ecB" );
         ecB.setProgram( prA );
-        ecB.setType( EventChart.TYPE_COLUMN );
+        ecB.setType( ChartType.COLUMN );
         EventChart ecC = new EventChart( "ecC" );
         ecC.setProgram( prA );
-        ecC.setType( EventChart.TYPE_COLUMN );
+        ecC.setType( ChartType.COLUMN );
 
         int idA = eventChartService.saveEventChart( ecA );
         int idB = eventChartService.saveEventChart( ecB );

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java	2015-07-03 01:33:37 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java	2015-09-15 11:21:39 +0000
@@ -28,15 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.chart.BaseChart.TYPE_AREA;
-import static org.hisp.dhis.chart.BaseChart.TYPE_BAR;
-import static org.hisp.dhis.chart.BaseChart.TYPE_COLUMN;
-import static org.hisp.dhis.chart.BaseChart.TYPE_LINE;
-import static org.hisp.dhis.chart.BaseChart.TYPE_PIE;
-import static org.hisp.dhis.chart.BaseChart.TYPE_RADAR;
-import static org.hisp.dhis.chart.BaseChart.TYPE_STACKED_BAR;
-import static org.hisp.dhis.chart.BaseChart.TYPE_STACKED_COLUMN;
-import static org.hisp.dhis.chart.BaseChart.TYPE_METER;
 import static org.hisp.dhis.common.DimensionalObject.DIMENSION_SEP;
 import static org.hisp.dhis.commons.collection.ListUtils.getArray;
 
@@ -62,6 +53,7 @@
 import org.hisp.dhis.chart.BaseChart;
 import org.hisp.dhis.chart.Chart;
 import org.hisp.dhis.chart.ChartService;
+import org.hisp.dhis.chart.ChartType;
 import org.hisp.dhis.common.AnalyticalObjectStore;
 import org.hisp.dhis.common.AnalyticsType;
 import org.hisp.dhis.common.BaseAnalyticalObject;
@@ -271,7 +263,7 @@
             chart.setName( indicator.getName() );
         }
 
-        chart.setType( TYPE_LINE );
+        chart.setType( ChartType.LINE );
         chart.setDimensions( DimensionalObject.DATA_X_DIM_ID, DimensionalObject.PERIOD_DIM_ID, DimensionalObject.ORGUNIT_DIM_ID );
         chart.setHideLegend( true );
         chart.addDataDimensionItem( indicator );
@@ -297,7 +289,7 @@
             chart.setName( indicator.getName() );
         }
 
-        chart.setType( TYPE_COLUMN );
+        chart.setType( ChartType.COLUMN );
         chart.setDimensions( DimensionalObject.DATA_X_DIM_ID, DimensionalObject.ORGUNIT_DIM_ID, DimensionalObject.PERIOD_DIM_ID );
         chart.setHideLegend( true );
         chart.addDataDimensionItem( indicator );
@@ -557,47 +549,47 @@
 
         CategoryPlot plot = null;
 
-        if ( chart.isType( TYPE_LINE ) )
+        if ( chart.isType( ChartType.LINE ) )
         {
             plot = new CategoryPlot( dataSet, new CategoryAxis(), new NumberAxis(), lineRenderer );
             plot.setOrientation( PlotOrientation.VERTICAL );
         }
-        else if ( chart.isType( TYPE_COLUMN ) )
+        else if ( chart.isType( ChartType.COLUMN ) )
         {
             plot = new CategoryPlot( dataSet, new CategoryAxis(), new NumberAxis(), barRenderer );
             plot.setOrientation( PlotOrientation.VERTICAL );
         }
-        else if ( chart.isType( TYPE_BAR ) )
+        else if ( chart.isType( ChartType.BAR ) )
         {
             plot = new CategoryPlot( dataSet, new CategoryAxis(), new NumberAxis(), barRenderer );
             plot.setOrientation( PlotOrientation.HORIZONTAL );
         }
-        else if ( chart.isType( TYPE_AREA ) )
+        else if ( chart.isType( ChartType.AREA ) )
         {
             return getStackedAreaChart( chart, dataSet );
         }
-        else if ( chart.isType( TYPE_PIE ) )
+        else if ( chart.isType( ChartType.PIE ) )
         {
             return getMultiplePieChart( chart, dataSets );
         }
-        else if ( chart.isType( TYPE_STACKED_COLUMN ) )
+        else if ( chart.isType( ChartType.STACKED_COLUMN ) )
         {
             return getStackedBarChart( chart, dataSet, false );
         }
-        else if ( chart.isType( TYPE_STACKED_BAR ) )
+        else if ( chart.isType( ChartType.STACKED_BAR ) )
         {
             return getStackedBarChart( chart, dataSet, true );
         }
-        else if ( chart.isType( TYPE_RADAR ) )
+        else if ( chart.isType( ChartType.RADAR ) )
         {
             return getRadarChart( chart, dataSet );
         }
-        else if ( chart.isType( TYPE_METER ) )
+        else if ( chart.isType( ChartType.GAUGE ) )
         {
             Number number = dataSet.getValue( 0, 0 );
             ValueDataset valueDataSet = new DefaultValueDataset( number );
             
-            return getMeterChart( chart, valueDataSet );
+            return getGaugeChart( chart, valueDataSet );
         }
         else
         {
@@ -728,7 +720,7 @@
         return multiplePieChart;
     }
     
-    private JFreeChart getMeterChart( BaseChart chart, ValueDataset dataSet )
+    private JFreeChart getGaugeChart( BaseChart chart, ValueDataset dataSet )
     {
         MeterPlot meterPlot = new MeterPlot( dataSet );
 

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml	2015-09-10 11:56:07 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml	2015-09-15 11:21:39 +0000
@@ -21,8 +21,13 @@
 
     <property name="rangeAxisLabel" />
 
-    <property name="type" />
-
+    <property name="type" length="40" not-null="true">
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.chart.ChartType</param>
+        <param name="type">12</param>
+      </type> 
+	</property>
+	
     <property name="series" />
 
     <property name="category" />
@@ -136,10 +141,10 @@
     <property name="userOrganisationUnitGrandChildren" />
 
     <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> 
+      <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" />

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java	2015-09-15 11:21:39 +0000
@@ -147,13 +147,13 @@
         units.add( unitB );
 
         chartA = createChart( 'A', indicators, periods, units );
-        chartA.setType( Chart.TYPE_BAR );
+        chartA.setType( ChartType.BAR );
 
         chartB = createChart( 'B', indicators, periods, units );
-        chartB.setType( Chart.TYPE_BAR );
+        chartB.setType( ChartType.BAR );
 
         chartC = createChart( 'C', indicators, periods, units );
-        chartC.setType( Chart.TYPE_BAR );
+        chartC.setType( ChartType.BAR );
     }
 
     // -------------------------------------------------------------------------