=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java 2015-08-03 11:33:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java 2015-09-14 10:33:55 +0000
@@ -57,11 +57,7 @@
public static final String TEMPLATE_DIR = "templates";
- public static final String TYPE_JASPER_REPORT_TABLE = "jasperReportTable";
- public static final String TYPE_JASPER_JDBC = "jasperJdbc";
- public static final String TYPE_HTML = "html";
-
- private String type;
+ private ReportType type;
private String designContent;
@@ -81,16 +77,18 @@
{
}
- public Report( String name, String type, String designContent, ReportTable reportTable )
+ public Report( String name, ReportType type, String designContent, ReportTable reportTable )
{
this.name = name;
+ this.type = type;
this.designContent = designContent;
this.reportTable = reportTable;
}
- public Report( String name, String type, String designContent, RelativePeriods relatives, ReportParams reportParams )
+ public Report( String name, ReportType type, String designContent, RelativePeriods relatives, ReportParams reportParams )
{
this.name = name;
+ this.type = type;
this.designContent = designContent;
this.relatives = relatives;
this.reportParams = reportParams;
@@ -102,17 +100,17 @@
public boolean isTypeReportTable()
{
- return type != null && TYPE_JASPER_REPORT_TABLE.equals( type );
+ return type != null && ReportType.JASPER_REPORT_TABLE.equals( type );
}
public boolean isTypeJdbc()
{
- return type != null && TYPE_JASPER_JDBC.equals( type );
+ return type != null && ReportType.JASPER_JDBC.equals( type );
}
public boolean isTypeHtml()
{
- return type != null && TYPE_HTML.equals( type );
+ return type != null && ReportType.HTML.equals( type );
}
public boolean hasReportTable()
@@ -149,12 +147,12 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public String getType()
+ public ReportType getType()
{
return type;
}
- public void setType( String type )
+ public void setType( ReportType type )
{
this.type = type;
}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportType.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportType.java 2015-09-14 10:33:55 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.report;
+
+/*
+ * 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 ReportType
+{
+ JASPER_REPORT_TABLE, JASPER_JDBC, HTML;
+}
=== 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-13 17:45:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-09-14 10:33:55 +0000
@@ -869,6 +869,10 @@
executeSql( "drop table aggregatedorgunitdatavalue_temp" );
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'" );
oauth2();
@@ -1337,22 +1341,6 @@
}
}
- private int executeSql( String sql )
- {
- try
- {
- // TODO use jdbcTemplate
-
- return statementManager.getHolder().executeUpdate( sql );
- }
- catch ( Exception ex )
- {
- log.debug( ex );
-
- return -1;
- }
- }
-
private Integer getDefaultOptionCombo()
{
String sql = "select coc.categoryoptioncomboid from categoryoptioncombo coc "
@@ -1382,4 +1370,20 @@
executeSql( "drop table optionsetmembers" );
}
}
+
+ private int executeSql( String sql )
+ {
+ try
+ {
+ // TODO use jdbcTemplate
+
+ return statementManager.getHolder().executeUpdate( sql );
+ }
+ catch ( Exception ex )
+ {
+ log.debug( ex );
+
+ return -1;
+ }
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/report/hibernate/Report.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/report/hibernate/Report.hbm.xml 2015-07-21 16:46:52 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/report/hibernate/Report.hbm.xml 2015-09-14 10:33:55 +0000
@@ -17,7 +17,12 @@