← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19809: Removed unused code

 

------------------------------------------------------------
revno: 19809
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-08-20 23:14:08 -0400
message:
  Removed unused code
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.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/program/ProgramIndicatorService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java	2015-07-10 21:08:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java	2015-08-21 03:14:08 +0000
@@ -28,13 +28,11 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import org.hisp.dhis.constant.Constant;
-import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 
 /**
@@ -116,14 +114,6 @@
     String getProgramIndicatorValue( ProgramIndicator programIndicator, ProgramInstance programInstance );
 
     /**
-     * Calculate a program indicator value based on the given arguments.
-     * 
-     * @param valueMap map containing keys for data elements, attributes and 
-     *        constants with corresponding values.
-     */
-    Double getProgramIndicatorValue( ProgramIndicator indicator, Map<String, Double> valueMap );
-    
-    /**
      * Get indicator values of all program indicators defined for a TrackedEntityInstance
      *
      * @param programInstance ProgramInstance
@@ -166,16 +156,7 @@
      *         {@link ProgramIndicator.INVALID_VARIABLES_IN_EXPRESSION}.
      */
     String filterIsValid( String filter );
-    
-    /**
-     * Returns all {@link DataElement} part of the given collection
-     * of {@link ProgramIndicator}.
-     * 
-     * @param indicators the ProgramIndicators.
-     * @return a set of DataElements.
-     */
-    Set<DataElement> getDataElementsInIndicators( Collection<ProgramIndicator> indicators );
-    
+        
     /**
      * Get all {@link ProgramStageDataElement} part of the expression.
      * 
@@ -185,30 +166,12 @@
     Set<ProgramStageDataElement> getProgramStageDataElementsInExpression( String expression );
 
     /**
-     * Returns all {@link TrackedEntityAttribute} part of the given collection
-     * of {@link ProgramIndicator}.
-     * 
-     * @param indicators the ProgramIndicators.
-     * @return a set of TrackedEntityAttributes.
-     */
-    Set<TrackedEntityAttribute> getAttributesInIndicators( Collection<ProgramIndicator> indicators );
-
-    /**
      * Get all {@link TrackedEntityAttribute} part of the expression.
      * 
      * @param expression the expression.
      * @return a set of TrackedEntityAttributes.
      */
     Set<TrackedEntityAttribute> getAttributesInExpression( String expression );
-
-    /**
-     * Returns all {@link Constant} part of the given collection of 
-     * {@link ProgramIndicator}.
-     * 
-     * @param indicators the ProgramIndicators.
-     * @return a set of Constants.
-     */
-    Set<Constant> getConstantsInIndicators( Collection<ProgramIndicator> indicators );
     
     /**
      * Get all {@link Constant} part of the expression of the expression.

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java	2015-08-21 01:47:02 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java	2015-08-21 03:14:08 +0000
@@ -1037,32 +1037,6 @@
     }
     
     /**
-     * Returns a mapping of permutation keys and mappings of data identifiers and values
-     * based on the given mapping of dimension option keys and values.
-     */
-    public static Map<String, Map<String, Double>> getPermutationProgramValueMap( Map<String, Double> valueMap )
-    {
-        MapMap<String, String, Double> permutationMap = new MapMap<>();
-        
-        for ( String key : valueMap.keySet() )
-        {
-            List<String> keys = Lists.newArrayList( key.split( DIMENSION_SEP ) );
-            
-            String dxUid = keys.get( DX_INDEX );
-            
-            keys.remove( DX_INDEX );
-            
-            String permKey = StringUtils.join( keys, DIMENSION_SEP );
-            
-            Double value = valueMap.get( key );
-            
-            permutationMap.putEntry( permKey, dxUid, value );
-        }
-        
-        return permutationMap;
-    }
-
-    /**
      * Returns a mapping of permutations keys (org unit id or null) and mappings
      * of org unit group and counts, based on the given mapping of dimension option
      * keys and counts.

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-07-27 19:10:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-08-21 03:14:08 +0000
@@ -30,7 +30,6 @@
 
 import static org.hisp.dhis.i18n.I18nUtils.i18n;
 
-import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -231,49 +230,6 @@
     }
 
     @Override
-    public Double getProgramIndicatorValue( ProgramIndicator indicator, Map<String, Double> valueMap )
-    {
-        StringBuffer buffer = new StringBuffer();
-
-        String expression = indicator.getExpression();
-        
-        Matcher matcher = ProgramIndicator.EXPRESSION_PATTERN.matcher( expression );
-        
-        while ( matcher.find() )
-        {
-            String key = matcher.group( 1 );
-            
-            Double value = null;
-
-            //TODO query by program stage
-            
-            if ( ProgramIndicator.KEY_DATAELEMENT.equals( key ) )
-            {
-                String de = matcher.group( 3 );
-                
-                value = valueMap.get( de );
-            }
-            else if ( ProgramIndicator.KEY_ATTRIBUTE.equals( key ) || ProgramIndicator.KEY_CONSTANT.equals( key ) )
-            {
-                String uid = matcher.group( 2 );
-                
-                value = valueMap.get( uid );
-            }
-            
-            if ( value == null )
-            {
-                return null;
-            }
-            
-            matcher.appendReplacement( buffer, Matcher.quoteReplacement( String.valueOf( value ) ) );
-        }
-
-        expression = TextUtils.appendTail( matcher, buffer );
-
-        return MathUtils.calculateExpression( expression );
-    }
-    
-    @Override
     @Transactional
     public Map<String, String> getProgramIndicatorValues( ProgramInstance programInstance )
     {
@@ -530,25 +486,6 @@
 
         return expr.toString();
     }
-
-    @Override
-    @Transactional
-    public Set<DataElement> getDataElementsInIndicators( Collection<ProgramIndicator> indicators )
-    {
-        Set<DataElement> dataElements = new HashSet<>();
-        
-        for ( ProgramIndicator indicator : indicators )
-        {
-            Set<ProgramStageDataElement> psds = getProgramStageDataElementsInExpression( indicator.getExpression() );
-            
-            for ( ProgramStageDataElement psd : psds )
-            {
-                dataElements.add( psd.getDataElement() );
-            }
-        }
-        
-        return dataElements;
-    }
     
     @Override
     @Transactional
@@ -574,20 +511,6 @@
         
         return elements;
     }
-
-    @Override
-    @Transactional
-    public Set<TrackedEntityAttribute> getAttributesInIndicators( Collection<ProgramIndicator> indicators )
-    {
-        Set<TrackedEntityAttribute> attributes = new HashSet<>();
-        
-        for ( ProgramIndicator indicator : indicators )
-        {
-            attributes.addAll( getAttributesInExpression( indicator.getExpression() ) );
-        }
-        
-        return attributes;
-    }
     
     @Override
     @Transactional
@@ -614,20 +537,6 @@
 
     @Override
     @Transactional
-    public Set<Constant> getConstantsInIndicators( Collection<ProgramIndicator> indicators )
-    {
-        Set<Constant> constants = new HashSet<>();
-        
-        for ( ProgramIndicator indicator : indicators )
-        {
-            constants.addAll( getConstantsInExpression( indicator.getExpression() ) );
-        }
-        
-        return constants;
-    }
-    
-    @Override
-    @Transactional
     public Set<Constant> getConstantsInExpression( String expression )
     {
         Set<Constant> constants = new HashSet<>();