← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16767: Fixed use of deprecated methods

 

------------------------------------------------------------
revno: 16767
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-09-22 11:56:45 +0200
message:
  Fixed use of deprecated methods
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsTable.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java
  dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MetaDataController.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/AnalyticsTable.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsTable.java	2014-09-22 05:21:44 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsTable.java	2014-09-22 09:56:45 +0000
@@ -28,13 +28,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.calendar.DateTimeUnit;
+import java.util.List;
+
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.program.Program;
 
-import java.util.List;
-
 /**
  * @author Lars Helge Overland
  */

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java	2014-09-22 05:21:44 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java	2014-09-22 09:56:45 +0000
@@ -28,9 +28,14 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
 import org.apache.commons.lang.StringUtils;
 import org.hisp.dhis.analytics.Partitions;
-import org.hisp.dhis.calendar.DateTimeUnit;
 import org.hisp.dhis.common.ListMap;
 import org.hisp.dhis.common.NameableObject;
 import org.hisp.dhis.period.Cal;
@@ -39,12 +44,6 @@
 import org.hisp.dhis.period.YearlyPeriodType;
 import org.hisp.dhis.system.util.UniqueArrayList;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
 /**
  * @author Lars Helge Overland
  */

=== modified file 'dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java	2014-09-08 14:40:15 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java	2014-09-22 09:56:45 +0000
@@ -327,17 +327,20 @@
         try
         {
             int periodId = 0;
-            periodId = jdbcTemplate.queryForInt(  "select periodid from period where periodtypeid = ( select periodtypeid from periodtype where name='"
-                    + period.getPeriodType().getName()
-                    + "' )"
-                    + " and startdate='"
-                    + DateUtils.getMediumDateString( period.getStartDate() )
-                    + "' and enddate='"
-                    + DateUtils.getMediumDateString( period.getEndDate() ) + "'" );
+            
+            final String selectSql = "select periodid from period where periodtypeid = ( select periodtypeid from periodtype where name='"
+                + period.getPeriodType().getName()
+                + "' )"
+                + " and startdate='"
+                + DateUtils.getMediumDateString( period.getStartDate() )
+                + "' and enddate='"
+                + DateUtils.getMediumDateString( period.getEndDate() ) + "'";
+            
+            periodId = jdbcTemplate.queryForObject( selectSql, Integer.class );
             
             if ( periodId == 0 )
             {
-                String insertSql = "insert into period (periodid, periodtypeid,startdate,enddate) " + " VALUES " + "("
+                final String insertSql = "insert into period (periodid, periodtypeid,startdate,enddate) " + " VALUES " + "("
                     + statementBuilder.getAutoIncrementValue() + ","+ period.getPeriodType().getId() + ",'" + DateUtils.getMediumDateString( period.getStartDate() )
                     + "','" + DateUtils.getMediumDateString( period.getEndDate() ) + "' )";
                 
@@ -345,7 +348,7 @@
             }
             else
             {
-                String deleteDataValueSql = "delete from datavalue where dataelementid=" + dataElementId
+                final String deleteDataValueSql = "delete from datavalue where dataelementid=" + dataElementId
                     + " and categoryoptioncomboid=" + optionComboId + " and sourceid in ("
                     + TextUtils.getCommaDelimitedString( orgunitIds ) + ") "
                         + "and periodid = " + periodId;
@@ -482,15 +485,15 @@
             orgunitIds.retainAll( _orgunitIds );
         }
         
-        if(orgunitIds.size() > 0 )
+        if ( orgunitIds.size() > 0 )
         {
             String sql = "select caseaggregationconditionid, aggregationdataelementid, optioncomboid, "
-                + " cagg.aggregationexpression as caseexpression, cagg.operator as caseoperator, cagg.desum as desumid "
-                + "     from caseaggregationcondition cagg inner join datasetmembers dm "
-                + "             on cagg.aggregationdataelementid=dm.dataelementid inner join dataset ds "
-                + "             on ds.datasetid = dm.datasetid inner join periodtype pt "
-                + "             on pt.periodtypeid=ds.periodtypeid inner join dataelement de "
-                + "             on de.dataelementid=dm.dataelementid where ds.datasetid = " + dataSet.getDataSetId();
+                + "cagg.aggregationexpression as caseexpression, cagg.operator as caseoperator, cagg.desum as desumid "
+                + "from caseaggregationcondition cagg inner join datasetmembers dm "
+                + "on cagg.aggregationdataelementid=dm.dataelementid inner join dataset ds "
+                + "on ds.datasetid = dm.datasetid inner join periodtype pt "
+                + "on pt.periodtypeid=ds.periodtypeid inner join dataelement de "
+                + "on de.dataelementid=dm.dataelementid where ds.datasetid = " + dataSet.getDataSetId();
     
             SqlRowSet rs = jdbcTemplate.queryForRowSet( sql );
     
@@ -1175,6 +1178,7 @@
                 String insertSql = "insert into period (periodid, periodtypeid,startdate,enddate) " + " VALUES " + "("
                     + statementBuilder.getAutoIncrementValue() + "," + periodTypeId + ",'" + start + "','" + end
                     + "' )";
+                
                 jdbcTemplate.execute( insertSql );
 
                 period.setId( jdbcTemplate.queryForObject( sql, Integer.class ) );
@@ -1253,7 +1257,6 @@
 
         return false;
     }
-
    
     private String replacePeriodSql( String sql, Period period )
     {
@@ -1264,6 +1267,5 @@
         sql = sql.replaceAll( PARAM_PERIOD_ISO_DATE, period.getIsoDate() );
 
         return sql;
-    }
-    
+    }    
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MetaDataController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MetaDataController.java	2014-09-16 05:18:47 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MetaDataController.java	2014-09-22 09:56:45 +0000
@@ -28,8 +28,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import java.io.IOException;
+import java.util.Map;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import org.hisp.dhis.dxf2.metadata.ExportService;
 import org.hisp.dhis.dxf2.metadata.ImportOptions;
 import org.hisp.dhis.dxf2.metadata.ImportService;
@@ -42,26 +51,17 @@
 import org.hisp.dhis.scheduling.TaskId;
 import org.hisp.dhis.system.scheduling.Scheduler;
 import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.webapi.utils.ContextUtils;
+import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
 import org.hisp.dhis.webapi.webdomain.WebOptions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Map;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */