=== 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 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 getDataElementsInIndicators( Collection indicators ); - + /** * Get all {@link ProgramStageDataElement} part of the expression. * @@ -185,30 +166,12 @@ Set 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 getAttributesInIndicators( Collection indicators ); - - /** * Get all {@link TrackedEntityAttribute} part of the expression. * * @param expression the expression. * @return a set of TrackedEntityAttributes. */ Set 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 getConstantsInIndicators( Collection 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> getPermutationProgramValueMap( Map valueMap ) - { - MapMap permutationMap = new MapMap<>(); - - for ( String key : valueMap.keySet() ) - { - List 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 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 getProgramIndicatorValues( ProgramInstance programInstance ) { @@ -530,25 +486,6 @@ return expr.toString(); } - - @Override - @Transactional - public Set getDataElementsInIndicators( Collection indicators ) - { - Set dataElements = new HashSet<>(); - - for ( ProgramIndicator indicator : indicators ) - { - Set 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 getAttributesInIndicators( Collection indicators ) - { - Set attributes = new HashSet<>(); - - for ( ProgramIndicator indicator : indicators ) - { - attributes.addAll( getAttributesInExpression( indicator.getExpression() ) ); - } - - return attributes; - } @Override @Transactional @@ -614,20 +537,6 @@ @Override @Transactional - public Set getConstantsInIndicators( Collection indicators ) - { - Set constants = new HashSet<>(); - - for ( ProgramIndicator indicator : indicators ) - { - constants.addAll( getConstantsInExpression( indicator.getExpression() ) ); - } - - return constants; - } - - @Override - @Transactional public Set getConstantsInExpression( String expression ) { Set constants = new HashSet<>();