← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3688: Removed unused method

 

------------------------------------------------------------
revno: 3688
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-05-20 14:53:06 +0200
message:
  Removed unused method
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregationStore.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregationStore.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-api/src/main/java/org/hisp/dhis/aggregation/AggregationStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregationStore.java	2011-01-25 20:50:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregationStore.java	2011-05-20 12:53:06 +0000
@@ -67,12 +67,4 @@
      * @return collection of DataValues for the given parameters.
      */
     Collection<DataValue> getDataValues( Integer sourceId, Integer dataElementId, Integer optionComboId, Collection<Integer> periodIds );
-    
-    /**
-     * Generates a collection of strings on the form <data element id>-<period id>-<source id>
-     * for each data value in the database.
-     * 
-     * @return A collection of strings.
-     */
-    Collection<String> getDataValueIdentifiers();
 }

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregationStore.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregationStore.java	2010-07-10 15:19:02 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregationStore.java	2011-05-20 12:53:06 +0000
@@ -31,7 +31,6 @@
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashSet;
 
 import org.amplecode.quick.StatementHolder;
 import org.amplecode.quick.StatementManager;
@@ -39,6 +38,8 @@
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.period.Period;
 
+import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
+
 /**
  * @author Lars Helge Overland
  * @version $Id: JdbcAggregationStore.java 5942 2008-10-16 15:44:57Z larshelg $
@@ -130,63 +131,10 @@
         
         return new ArrayList<DataValue>();
     }
-    
-    public Collection<String> getDataValueIdentifiers()
-    {
-        int min = 0;
-        
-        final int limit = 10000;
-        
-        Collection<String> identifiers = new HashSet<String>();
-        
-        Collection<String> temp = null;
-        
-        while ( ( temp = getDataValueIdentifiers( min, limit ) ).size() > 0 )
-        {
-            identifiers.addAll( temp );
-            
-            min += limit;
-        }
-        
-        return identifiers;
-    }
 
     // ----------------------------------------------------------------------
     // Supportive methods
     // ----------------------------------------------------------------------
-
-    private Collection<String> getDataValueIdentifiers( int min, int limit )
-    {
-        StatementHolder holder = statementManager.getHolder();
-        
-        try
-        {
-            String sql = 
-                "SELECT dataelementid, periodid, sourceid " +
-                "FROM datavalue " +
-                "ORDER BY dataelementid, periodid, sourceid " +
-                "LIMIT " + min + ", " + limit;
-            
-            ResultSet resultSet = holder.getStatement().executeQuery( sql );
-            
-            Collection<String> identifiers = new HashSet<String>();
-            
-            while ( resultSet.next() )
-            {
-                identifiers.add( resultSet.getInt( 1 ) + "-" + resultSet.getInt( 2 ) + "-" + resultSet.getInt( 3 ) );
-            }
-            
-            return identifiers;
-        }
-        catch ( SQLException ex )
-        {
-            throw new RuntimeException( "Failed to get DataValue identifiers", ex );
-        }
-        finally
-        {
-            holder.close();
-        }
-    }
     
     private Collection<DataValue> getDataValues( ResultSet resultSet )
     {
@@ -214,22 +162,5 @@
         {
             throw new RuntimeException( "Failed to transform resultset into collection", ex );
         }
-    }   
-    
-    private String getCommaDelimitedString( Collection<Integer> elements )
-    {
-        if ( elements != null && elements.size() > 0 )
-        {
-            StringBuffer sourceSqlBuffer = new StringBuffer();        
-        
-            for ( Integer element : elements )
-            {
-                sourceSqlBuffer.append( element.toString() + ", " );
-            }
-            
-            return sourceSqlBuffer.substring( 0, sourceSqlBuffer.length() - ", ".length() );
-        }
-        
-        return null;
     }
 }