← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20317: Removed application usage of _categoryoptioncomboname resource table

 

------------------------------------------------------------
revno: 20317
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-09-23 15:58:30 +0200
message:
  Removed application usage of _categoryoptioncomboname resource table
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsUtils.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.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/HsqlStatementBuilder.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


--
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-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java	2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java	2015-09-23 13:58:30 +0000
@@ -381,7 +381,7 @@
     {
         String sql = 
             "insert into " + CreateCategoryTableStatement.TABLE_NAME + " " +
-            "select coc.categoryoptioncomboid as cocid, con.categoryoptioncomboname as cocname, ";
+            "select coc.categoryoptioncomboid as cocid, coc.name as cocname, ";
         
         for ( DataElementCategory category : categories )
         {
@@ -404,8 +404,7 @@
 
         sql = TextUtils.removeLastComma( sql ) + " ";
         sql += 
-            "from categoryoptioncombo coc " +
-            "inner join _categoryoptioncomboname con on coc.categoryoptioncomboid = con.categoryoptioncomboid";
+            "from categoryoptioncombo coc ";
         
         log.info( "Populate category structure SQL: " + sql );
         

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsUtils.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsUtils.java	2015-09-23 12:27:33 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsUtils.java	2015-09-23 13:58:30 +0000
@@ -71,17 +71,15 @@
         String sql = 
             "select de.name as de_name, de.uid as de_uid, de.dataelementid as de_id, pe.startdate as start_date, pe.enddate as end_date, pt.name as pt_name, " +
             "ou.name as ou_name, ou.uid as ou_uid, ou.organisationunitid as ou_id, " +
-            "cocn.categoryoptioncomboname as coc_name, coc.uid as coc_uid, coc.categoryoptioncomboid as coc_id, " +
-            "aocn.categoryoptioncomboname as aoc_name, aoc.uid as aoc_uid, aoc.categoryoptioncomboid as aoc_id, dv.value as datavalue " +
+            "coc.name as coc_name, coc.uid as coc_uid, coc.categoryoptioncomboid as coc_id, " +
+            "aoc.name as aoc_name, aoc.uid as aoc_uid, aoc.categoryoptioncomboid as aoc_id, dv.value as datavalue " +
             "from datavalue dv " + 
             "inner join dataelement de on dv.dataelementid = de.dataelementid " +
             "inner join period pe on dv.periodid = pe.periodid " +
             "inner join periodtype pt on pe.periodtypeid = pt.periodtypeid " +
             "inner join organisationunit ou on dv.sourceid = ou.organisationunitid " +
             "inner join categoryoptioncombo coc on dv.categoryoptioncomboid = coc.categoryoptioncomboid " +
-            "inner join _categoryoptioncomboname cocn on dv.categoryoptioncomboid = cocn.categoryoptioncomboid " +
             "inner join categoryoptioncombo aoc on dv.attributeoptioncomboid = aoc.categoryoptioncomboid " +
-            "inner join _categoryoptioncomboname aocn on dv.attributeoptioncomboid = aocn.categoryoptioncomboid " +
             "where dv.dataelementid in (" + StringUtils.join( IdentifiableObjectUtils.getIdentifiers( dataElements ), "," ) + ") " +
             "and (";
         

=== 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	2015-09-16 18:31:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java	2015-09-23 13:58:30 +0000
@@ -263,14 +263,14 @@
         String sql =
             "select dv.dataelementid, dv.periodid, dv.sourceid, dv.categoryoptioncomboid, dv.value, " +
             "dv.storedby, dv.lastupdated, dv.created, 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 " +
+            "pe.startdate, pe.enddate, pt.name AS periodtypename, ou.name AS sourcename, cc.name AS categoryoptioncomboname " +
             "from datavalue dv " +
             "left join minmaxdataelement mm on (dv.sourceid = mm.sourceid and dv.dataelementid = mm.dataelementid and dv.categoryoptioncomboid = mm.categoryoptioncomboid) " +
             "join dataelement de on dv.dataelementid = de.dataelementid " +
             "join period pe on dv.periodid = pe.periodid " +
             "join periodtype pt on pe.periodtypeid = pt.periodtypeid " +
             "left join organisationunit ou on ou.organisationunitid = dv.sourceid " +
-            "left join _categoryoptioncomboname cc on dv.categoryoptioncomboid = cc.categoryoptioncomboid " +
+            "join categoryoptioncombo cc on dv.categoryoptioncomboid = cc.categoryoptioncomboid " +
             "inner join _orgunitstructure ous on ous.organisationunitid = dv.sourceid " +
             "where ous." + idLevelColumn + " = " + organisationUnit.getId() + " " +
             "and dv.followup = true " +

=== 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	2015-07-07 03:14:28 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java	2015-09-23 13:58:30 +0000
@@ -164,11 +164,11 @@
     	return "SELECT dv.dataelementid, dv.periodid, dv.sourceid, dv.categoryoptioncomboid, dv.value, dv.storedby, dv.lastupdated, " +
             "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 " +
+            encode( organisationUnitName ) + " AS sourcename, cc.name " +
             "FROM datavalue AS dv " +
             "JOIN period AS pe USING (periodid) " +
             "JOIN periodtype AS pt USING (periodtypeid) " +
-            "LEFT JOIN _categoryoptioncomboname AS cc USING (categoryoptioncomboid) " +
+            "LEFT JOIN categoryoptioncombo AS cc USING (categoryoptioncomboid) " +
             "WHERE dv.dataelementid='" + dataElementId + "' " +
             "AND dv.categoryoptioncomboid='" + categoryOptionComboId + "' " +
             "AND dv.periodid IN (" + periodIds + ") " +
@@ -188,10 +188,10 @@
     {
         StringBuffer sqlsb = new StringBuffer();
         
-        sqlsb.append( "(SELECT DISTINCT de.dataelementid, (de.name || ' ' || cc.categoryoptioncomboname) AS DataElement " );
+        sqlsb.append( "(SELECT DISTINCT de.dataelementid, (de.name || ' ' || cc.name) AS DataElement " );
         sqlsb.append( "FROM dataelement AS de " );
         sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
-        sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
+        sqlsb.append( "INNER JOIN categoryoptioncombo cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
         sqlsb.append( "ORDER BY DataElement) " );
         
         return sqlsb.toString();
@@ -208,12 +208,12 @@
         {
             i++;
 
-            sqlsb.append( "SELECT de.dataelementid, (de.name || ' ' || cc.categoryoptioncomboname) AS DataElement, dv.value AS counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
+            sqlsb.append( "SELECT de.dataelementid, (de.name || ' ' || cc.name) AS DataElement, dv.value AS counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
             sqlsb.append( "FROM dataelement AS de " );
             sqlsb.append( "INNER JOIN datavalue AS dv ON (de.dataelementid = dv.dataelementid) " );
             sqlsb.append( "INNER JOIN period p ON (dv.periodid = p.periodid) " );
             sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
-            sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
+            sqlsb.append( "INNER JOIN categoryoptioncombo cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
             sqlsb.append( "WHERE dv.sourceid = '" + orgUnitId + "' " );
             sqlsb.append( "AND dv.periodid = '" + periodId + "' " );
 

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java	2015-07-07 03:14:28 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/HsqlStatementBuilder.java	2015-09-23 13:58:30 +0000
@@ -164,11 +164,11 @@
         return "SELECT dv.dataelementid, dv.periodid, dv.sourceid, dv.categoryoptioncomboid, dv.value, dv.storedby, dv.lastupdated, " +
             "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 " +
+            encode( organisationUnitName ) + " AS sourcename, cc.name " +
             "FROM datavalue AS dv " +
             "JOIN period AS pe USING (periodid) " +
             "JOIN periodtype AS pt USING (periodtypeid) " +
-            "LEFT JOIN _categoryoptioncomboname AS cc USING (categoryoptioncomboid) " +
+            "LEFT JOIN categoryoptioncombo AS cc USING (categoryoptioncomboid) " +
             "WHERE dv.dataelementid='" + dataElementId + "' " +
             "AND dv.categoryoptioncomboid='" + categoryOptionComboId + "' " +
             "AND dv.periodid IN (" + periodIds + ") " +
@@ -188,10 +188,10 @@
     {
         StringBuffer sqlsb = new StringBuffer();
         
-        sqlsb.append( "(SELECT DISTINCT de.dataelementid, (de.name || ' ' || cc.categoryoptioncomboname) AS DataElement " );
+        sqlsb.append( "(SELECT DISTINCT de.dataelementid, (de.name || ' ' || cc.name) AS DataElement " );
         sqlsb.append( "FROM dataelement AS de " );
         sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
-        sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
+        sqlsb.append( "INNER JOIN categoryoptioncombo cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
         sqlsb.append( "ORDER BY DataElement) " );
         
         return sqlsb.toString();
@@ -208,12 +208,12 @@
         {
             i++;
 
-            sqlsb.append( "SELECT de.dataelementid, (de.name || ' ' || cc.categoryoptioncomboname) AS DataElement, dv.value AS counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
+            sqlsb.append( "SELECT de.dataelementid, (de.name || ' ' || cc.name) AS DataElement, dv.value AS counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
             sqlsb.append( "FROM dataelement AS de " );
             sqlsb.append( "INNER JOIN datavalue AS dv ON (de.dataelementid = dv.dataelementid) " );
             sqlsb.append( "INNER JOIN period p ON (dv.periodid = p.periodid) " );
             sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
-            sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
+            sqlsb.append( "INNER JOIN categoryoptioncombo cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
             sqlsb.append( "WHERE dv.sourceid = '" + orgUnitId + "' " );
             sqlsb.append( "AND dv.periodid = '" + periodId + "' " );
 

=== 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	2015-07-07 03:14:28 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java	2015-09-23 13:58:30 +0000
@@ -170,11 +170,11 @@
     	return "SELECT dv.dataelementid, dv.periodid, dv.sourceid, dv.categoryoptioncomboid, dv.value, dv.storedby, dv.lastupdated, " +
             "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 " +
-            "JOIN period AS pe USING (periodid) " +
-            "JOIN periodtype AS pt USING (periodtypeid) " +
-            "LEFT JOIN _categoryoptioncomboname AS cc USING (categoryoptioncomboid) " +
+            encode( organisationUnitName ) + " AS sourcename, cc.name " +
+            "FROM datavalue dv " +
+            "JOIN period pe USING (periodid) " +
+            "JOIN periodtype pt USING (periodtypeid) " +
+            "LEFT JOIN categoryoptioncombo cc USING (categoryoptioncomboid) " +
             "WHERE dv.dataelementid='" + dataElementId + "' " +
             "AND dv.categoryoptioncomboid='" + categoryOptionComboId + "' " +
             "AND dv.periodid IN (" + periodIds + ") " +
@@ -194,10 +194,10 @@
     {
         StringBuffer sqlsb = new StringBuffer();
         
-        sqlsb.append( "(SELECT DISTINCT de.dataelementid, concat(de.name, \" \", cc.categoryoptioncomboname) AS DataElement " );
+        sqlsb.append( "(SELECT DISTINCT de.dataelementid, concat(de.name, \" \", cc.name) AS DataElement " );
         sqlsb.append( "FROM dataelement AS de " );
         sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
-        sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
+        sqlsb.append( "INNER JOIN categoryoptioncombo cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
         sqlsb.append( "ORDER BY DataElement) " );
         
         return sqlsb.toString();
@@ -214,12 +214,12 @@
         {
             i++;
 
-            sqlsb.append( "SELECT de.dataelementid, concat(de.name, \" \" , cc.categoryoptioncomboname) AS DataElement, dv.value AS counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
+            sqlsb.append( "SELECT de.dataelementid, concat(de.name, \" \" , cc.name) AS DataElement, dv.value AS counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
             sqlsb.append( "FROM dataelement AS de " );
             sqlsb.append( "INNER JOIN datavalue AS dv ON (de.dataelementid = dv.dataelementid) " );
             sqlsb.append( "INNER JOIN period p ON (dv.periodid = p.periodid) " );
             sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
-            sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
+            sqlsb.append( "INNER JOIN categoryoptioncombo cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
             sqlsb.append( "WHERE dv.sourceid = " + orgUnitId + " " );
             sqlsb.append( "AND dv.periodid = " + periodId + " " );
 

=== 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	2015-07-07 03:14:28 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java	2015-09-23 13:58:30 +0000
@@ -188,11 +188,11 @@
    	return "SELECT dv.dataelementid, dv.periodid, dv.sourceid, dv.categoryoptioncomboid, dv.value, dv.storedby, dv.lastupdated, " +
             "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 " +
+            encode( organisationUnitName ) + " AS sourcename, cc.name " +
             "FROM datavalue AS dv " +
             "JOIN period AS pe USING (periodid) " +
             "JOIN periodtype AS pt USING (periodtypeid) " +
-            "LEFT JOIN _categoryoptioncomboname AS cc USING (categoryoptioncomboid) " +
+            "LEFT JOIN categoryoptioncombo AS cc USING (categoryoptioncomboid) " +
             "WHERE dv.dataelementid='" + dataElementId + "' " +
             "AND dv.categoryoptioncomboid='" + categoryOptionComboId + "' " +
             "AND dv.periodid IN (" + periodIds + ") " +
@@ -212,10 +212,10 @@
     {
         StringBuffer sqlsb = new StringBuffer();
         
-        sqlsb.append( "(SELECT DISTINCT de.dataelementid, (de.name || ' ' || cc.categoryoptioncomboname) AS DataElement " );
+        sqlsb.append( "(SELECT DISTINCT de.dataelementid, (de.name || ' ' || cc.name) AS DataElement " );
         sqlsb.append( "FROM dataelement AS de " );
         sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
-        sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
+        sqlsb.append( "INNER JOIN categoryoptioncombo cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
         sqlsb.append( "ORDER BY DataElement) " );
         
         return sqlsb.toString();           
@@ -232,12 +232,12 @@
         {
             i++;
 
-            sqlsb.append( "SELECT de.dataelementid, (de.name || ' ' || cc.categoryoptioncomboname) AS DataElement, dv.value AS counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
+            sqlsb.append( "SELECT de.dataelementid, (de.name || ' ' || cc.name) AS DataElement, dv.value AS counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
             sqlsb.append( "FROM dataelement AS de " );
             sqlsb.append( "INNER JOIN datavalue AS dv ON (de.dataelementid = dv.dataelementid) " );
             sqlsb.append( "INNER JOIN period p ON (dv.periodid = p.periodid) " );
             sqlsb.append( "INNER JOIN categorycombos_optioncombos cat_opts on de.categorycomboid = cat_opts.categorycomboid ");
-            sqlsb.append( "INNER JOIN _categoryoptioncomboname cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
+            sqlsb.append( "INNER JOIN categoryoptioncombo cc on cat_opts.categoryoptioncomboid = cc.categoryoptioncomboid ");
             sqlsb.append( "WHERE dv.sourceid = '" + orgUnitId + "' " );
             sqlsb.append( "AND dv.periodid = '" + periodId + "' " );