← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10477: Renamed columns minvalue -> minimumvalue and maxvalue -> maximumvalue for tabe minmaxvalue in ord...

 

------------------------------------------------------------
revno: 10477
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-04-04 16:30:43 +0200
message:
  Renamed columns minvalue -> minimumvalue and maxvalue -> maximumvalue for tabe minmaxvalue in order to avoid reserved words in mysql
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.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/minmax/hibernate/MinMaxDataElement.hbm.xml
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MinMaxDataElementBatchHandler.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/DeflatedDataValueNameMinMaxRowMapper.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
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2013-03-24 18:41:05 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2013-04-04 14:30:43 +0000
@@ -382,7 +382,7 @@
         
         List<DataQueryParams> queries = queryPlanner.planQuery( params, optimalQueries, tableName );
         
-        t.getSplitTime( "Planned query" );
+        t.getSplitTime( "Planned query, got: " + queries.size() + " for optimal: " + optimalQueries );
         
         List<Future<Map<String, Double>>> futures = new ArrayList<Future<Map<String, Double>>>();
         

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisService.java	2012-09-19 16:14:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisService.java	2013-04-04 14:30:43 +0000
@@ -103,7 +103,7 @@
             categoryOptionCombos.addAll( dataElement.getCategoryCombo().getOptionCombos() );
         }
 
-        log.debug( "Starting min-max analysis, no of data elements: " + elements.size() + ", no of org units: " + organisationUnits.size() );
+        log.info( "Starting min-max analysis, no of data elements: " + elements.size() + ", no of org units: " + organisationUnits.size() );
         
         return dataAnalysisStore.getMinMaxViolations( elements, categoryOptionCombos, periods, organisationUnits, MAX_OUTLIERS );
     }
@@ -111,7 +111,7 @@
     public void generateMinMaxValues( Collection<OrganisationUnit> organisationUnits,
         Collection<DataElement> dataElements, Double stdDevFactor )
     {
-        log.debug( "Starting min-max value generation, no of data elements: " + dataElements.size() + ", no of org units: " + organisationUnits.size() );
+        log.info( "Starting min-max value generation, no of data elements: " + dataElements.size() + ", no of org units: " + organisationUnits.size() );
 
         Set<Integer> orgUnitIds = new HashSet<Integer>( ConversionUtils.getIdentifiers( OrganisationUnit.class, organisationUnits ) ); 
 
@@ -153,6 +153,8 @@
             }
         }
         
+        log.info( "Min-max value generation done" );
+        
         batchHandler.flush();
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java	2013-01-09 17:01:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java	2013-04-04 14:30:43 +0000
@@ -164,7 +164,7 @@
         
         String sql = 
             "select dv.dataelementid, dv.periodid, dv.sourceid, dv.categoryoptioncomboid, dv.value, dv.storedby, dv.lastupdated, " +
-            "dv.comment, dv.followup, ou.name as sourcename, de.name as dataelementname, pt.name as periodtypename, pe.startdate, pe.enddate, mm.minvalue, mm.maxvalue " + 
+            "dv.comment, dv.followup, ou.name as sourcename, de.name as dataelementname, pt.name as periodtypename, pe.startdate, pe.enddate, mm.minimumvalue, mm.maximumvalue " + 
             "from datavalue dv " +
             "join minmaxdataelement mm on ( dv.dataelementid = mm.dataelementid and dv.categoryoptioncomboid = mm.categoryoptioncomboid and dv.sourceid = mm.sourceid ) " +
             "join dataelement de on dv.dataelementid = de.dataelementid " +
@@ -175,8 +175,8 @@
             "and dv.categoryoptioncomboid in (" + categoryOptionComboIds + ") " +
             "and dv.periodid in (" + periodIds + ") " + 
             "and dv.sourceid in (" + organisationUnitIds + ") and ( " +
-                "cast( dv.value as " + statementBuilder.getDoubleColumnType() + " ) < mm.minvalue " +
-                "or cast( dv.value as " + statementBuilder.getDoubleColumnType() + " ) > mm.maxvalue )" +
+                "cast( dv.value as " + statementBuilder.getDoubleColumnType() + " ) < mm.minimumvalue " +
+                "or cast( dv.value as " + statementBuilder.getDoubleColumnType() + " ) > mm.maximumvalue )" +
             statementBuilder.limitRecord( 0, limit );
         
         return jdbcTemplate.query( sql, new DeflatedDataValueNameMinMaxRowMapper( null, null, optionComboMap ) );
@@ -221,7 +221,7 @@
     {
         final String sql =
             "select dv.dataelementid, dv.periodid, dv.sourceid, dv.categoryoptioncomboid, dv.value, " +
-            "dv.storedby, dv.lastupdated, dv.comment, dv.followup, mm.minvalue, mm.maxvalue, de.name as dataelementname, " +
+            "dv.storedby, dv.lastupdated, dv.comment, dv.followup, mm.minimumvalue, mm.maximumvalue, de.name as dataelementname, " +
             "pe.startdate, pe.enddate, pt.name AS periodtypename, ou.name AS sourcename, cc.categoryoptioncomboname " +
             "from datavalue dv " +
             "left join minmaxdataelement mm on (dv.sourceid = mm.sourceid and dv.dataelementid = mm.dataelementid and dv.categoryoptioncomboid = mm.categoryoptioncomboid) " +

=== 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	2013-03-21 06:43:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2013-04-04 14:30:43 +0000
@@ -243,6 +243,9 @@
         executeSql( "ALTER TABLE translation ALTER value TYPE text" );
         executeSql( "ALTER TABLE organisationunit ALTER comment TYPE text" );
 
+        executeSql( "ALTER TABLE minmaxdataelement RENAME minvalue TO minimumvalue" );
+        executeSql( "ALTER TABLE minmaxdataelement RENAME maxvalue TO maximumvalue" );
+        
         // orgunit shortname uniqueness
         executeSql( "ALTER TABLE organisationunit DROP CONSTRAINT organisationunit_shortname_key" );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/minmax/hibernate/MinMaxDataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/minmax/hibernate/MinMaxDataElement.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/minmax/hibernate/MinMaxDataElement.hbm.xml	2013-04-04 14:30:43 +0000
@@ -17,8 +17,8 @@
     <many-to-one name="optionCombo" class="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" column="categoryoptioncomboid"
       foreign-key="fk_minmaxdataelement_categoryoptioncomboid" index="index_minmaxdataelement" />
 
-    <property name="min" column="minvalue" not-null="true" />
-    <property name="max" column="maxvalue" not-null="true" />
+    <property name="min" column="minimumvalue" not-null="true" />
+    <property name="max" column="maximumvalue" not-null="true" />
     <property name="generated" not-null="true" />
 
   </class>

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MinMaxDataElementBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MinMaxDataElementBatchHandler.java	2012-07-25 13:18:48 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/MinMaxDataElementBatchHandler.java	2013-04-04 14:30:43 +0000
@@ -92,8 +92,8 @@
         statementBuilder.setColumn( "sourceid" );
         statementBuilder.setColumn( "dataelementid" );
         statementBuilder.setColumn( "categoryoptioncomboid" );
-        statementBuilder.setColumn( "minvalue" );
-        statementBuilder.setColumn( "maxvalue" );
+        statementBuilder.setColumn( "minimumvalue" );
+        statementBuilder.setColumn( "maximumvalue" );
         statementBuilder.setColumn( "generated" );
     }
 

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java	2013-03-15 11:28:58 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java	2013-04-04 14:30:43 +0000
@@ -127,7 +127,7 @@
     		String periodIds, int organisationUnitId, String organisationUnitName, int lowerBound, int upperBound )
     {	
     	return "SELECT dv.dataelementid, dv.periodid, dv.sourceid, dv.categoryoptioncomboid, dv.value, dv.storedby, dv.lastupdated, " +
-            "dv.comment, dv.followup, '" + lowerBound + "' AS minvalue, '" + upperBound + "' AS maxvalue, " +
+            "dv.comment, dv.followup, '" + lowerBound + "' AS minimumvalue, '" + upperBound + "' AS maximumvalue, " +
             encode( dataElementName ) + " AS dataelementname, pt.name AS periodtypename, pe.startdate, pe.enddate, " + 
             encode( organisationUnitName ) + " AS sourcename, cc.categoryoptioncomboname " +
             "FROM datavalue AS dv " +

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java	2013-03-15 11:28:58 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java	2013-04-04 14:30:43 +0000
@@ -130,7 +130,7 @@
     		String periodIds, int organisationUnitId, String organisationUnitName, int lowerBound, int upperBound )
     {    	
     	return "SELECT dv.dataelementid, dv.periodid, dv.sourceid, dv.categoryoptioncomboid, dv.value, dv.storedby, dv.lastupdated, " +
-            "dv.comment, dv.followup, '" + lowerBound + "' AS minvalue, '" + upperBound + "' AS maxvalue, " +
+            "dv.comment, dv.followup, '" + lowerBound + "' AS minimumvalue, '" + upperBound + "' AS maximumvalue, " +
             encode( dataElementName ) + " AS dataelementname, pt.name AS periodtypename, pe.startdate, pe.enddate, " + 
             encode( organisationUnitName ) + " AS sourcename, cc.categoryoptioncomboname " +
             "FROM datavalue AS dv " +

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java	2013-03-15 11:28:58 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java	2013-04-04 14:30:43 +0000
@@ -130,7 +130,7 @@
         String periodIds, int organisationUnitId, String organisationUnitName, int lowerBound, int upperBound )
     {
    	return "SELECT dv.dataelementid, dv.periodid, dv.sourceid, dv.categoryoptioncomboid, dv.value, dv.storedby, dv.lastupdated, " +
-            "dv.comment, dv.followup, '" + lowerBound + "' AS minvalue, '" + upperBound + "' AS maxvalue, " +
+            "dv.comment, dv.followup, '" + lowerBound + "' AS minimumvalue, '" + upperBound + "' AS maximumvalue, " +
             encode( dataElementName ) + " AS dataelementname, pt.name AS periodtypename, pe.startdate, pe.enddate, " + 
             encode( organisationUnitName ) + " AS sourcename, cc.categoryoptioncomboname " +
             "FROM datavalue AS dv " +

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/DeflatedDataValueNameMinMaxRowMapper.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/DeflatedDataValueNameMinMaxRowMapper.java	2012-07-25 13:18:48 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/objectmapper/DeflatedDataValueNameMinMaxRowMapper.java	2013-04-04 14:30:43 +0000
@@ -47,8 +47,8 @@
  * <li>7: lastupdated - date</li>
  * <li>8: comment - String</li>
  * <li>9: followup - Boolean</li>
- * <li>10: minvalue - int</li>
- * <li>11: maxvalue - int</li>
+ * <li>10: minimumvalue - int</li>
+ * <li>11: maximumvalue - int</li>
  * <li>12: dataelementname - String</li>
  * <li>13: periodtypename - String</li>
  * <li>14: startdate - String</li>
@@ -91,8 +91,8 @@
         value.setTimestamp( resultSet.getDate( "lastupdated" ) );
         value.setComment( resultSet.getString( "comment" ) );
         value.setFollowup( resultSet.getBoolean( "followup" ) );
-        value.setMin( minMap != null ? minMap.get( value.getSourceId() ) : resultSet.getInt( "minvalue" ) );
-        value.setMax( maxMap != null ? maxMap.get( value.getSourceId() ) : resultSet.getInt( "maxvalue" ) );
+        value.setMin( minMap != null ? minMap.get( value.getSourceId() ) : resultSet.getInt( "minimumvalue" ) );
+        value.setMax( maxMap != null ? maxMap.get( value.getSourceId() ) : resultSet.getInt( "maximumvalue" ) );
         value.setDataElementName( resultSet.getString( "dataelementname" ) );
         value.setPeriod( 
             resultSet.getString( "periodtypename" ),