=== modified file 'dhis-2/dhis-api/pom.xml' --- dhis-2/dhis-api/pom.xml 2015-07-20 02:01:37 +0000 +++ dhis-2/dhis-api/pom.xml 2015-09-04 08:57:35 +0000 @@ -40,7 +40,7 @@ jasperreports - net.sf.jasperreports + net.sf.jasperreports jasperreports-fonts === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 2015-09-03 15:30:38 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 2015-09-04 08:57:35 +0000 @@ -71,9 +71,6 @@ public static final String VAR_VALUE_COUNT = "value_count"; public static final String VAR_ZERO_POS_VALUE_COUNT = "zero_pos_value_count"; - public static final String VALUE_TYPE_DATE = "date"; - public static final String VALUE_TYPE_INT = "int"; - private static final String EXPRESSION_REGEXP = "(" + KEY_DATAELEMENT + "|" + KEY_ATTRIBUTE + "|" + KEY_PROGRAM_VARIABLE + "|" + KEY_CONSTANT + ")\\{(\\w+|" + VAR_INCIDENT_DATE + "|" + VAR_ENROLLMENT_DATE + "|" + VAR_CURRENT_DATE + ")" + SEPARATOR_ID + "?(\\w*)\\}"; private static final String SQL_FUNC_REGEXP = "d2:(.+?)\\(([^,]+)\\,?([^,]*)\\,?([^,]*)\\)"; @@ -91,8 +88,6 @@ private Program program; - private String valueType; - private String expression; private String filter; @@ -106,8 +101,6 @@ private Boolean displayInForm; - private String rootDate; - // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -183,19 +176,6 @@ @JsonProperty @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getValueType() - { - return valueType; - } - - public void setValueType( String valueType ) - { - this.valueType = valueType; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getExpression() { return expression; @@ -258,19 +238,6 @@ this.displayInForm = displayInForm; } - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getRootDate() - { - return rootDate; - } - - public void setRootDate( String rootDate ) - { - this.rootDate = rootDate; - } - @Override public void mergeWith( IdentifiableObject other, MergeStrategy strategy ) { @@ -283,22 +250,18 @@ if ( strategy.isReplace() ) { program = programIndicator.getProgram(); - valueType = programIndicator.getValueType(); expression = programIndicator.getExpression(); filter = programIndicator.getFilter(); decimals = programIndicator.getDecimals(); displayInForm = programIndicator.getDisplayInForm(); - rootDate = programIndicator.getRootDate(); } else if ( strategy.isMerge() ) { program = programIndicator.getProgram() == null ? program : programIndicator.getProgram(); - valueType = programIndicator.getValueType() == null ? valueType : programIndicator.getValueType(); expression = programIndicator.getExpression() == null ? expression : programIndicator.getExpression(); filter = programIndicator.getFilter() == null ? filter : programIndicator.getFilter(); decimals = programIndicator.getDecimals() == null ? decimals : programIndicator.getDecimals(); displayInForm = programIndicator.getDisplayInForm() == null ? displayInForm : programIndicator.getDisplayInForm(); - rootDate = programIndicator.getRootDate() == null ? rootDate : programIndicator.getRootDate(); } } } === 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-08-26 10:20:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java 2015-09-04 08:57:35 +0000 @@ -111,7 +111,7 @@ * @param programInstance ProgramInstance * @return Indicator value */ - String getProgramIndicatorValue( ProgramIndicator programIndicator, ProgramInstance programInstance ); + Double getProgramIndicatorValue( ProgramIndicator programIndicator, ProgramInstance programInstance ); /** * Get indicator values of all program indicators defined for a TrackedEntityInstance @@ -119,7 +119,7 @@ * @param programInstance ProgramInstance * @return a mapping of indicator display name and indicator value. */ - Map getProgramIndicatorValues( ProgramInstance programInstance ); + Map getProgramIndicatorValues( ProgramInstance programInstance ); /** * Get description of an indicator expression. === 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-09-03 08:15:09 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java 2015-09-04 08:57:35 +0000 @@ -28,7 +28,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import com.google.common.collect.ImmutableMap; +import static org.hisp.dhis.i18n.I18nUtils.i18n; + +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; + import org.hisp.dhis.common.ValueType; import org.hisp.dhis.commons.sqlfunc.ConditionalSqlFunction; import org.hisp.dhis.commons.sqlfunc.DaysBetweenSqlFunction; @@ -57,15 +66,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; - -import static org.hisp.dhis.i18n.I18nUtils.i18n; +import com.google.common.collect.ImmutableMap; /** * @author Chau Thu Tran @@ -218,47 +219,168 @@ @Override @Transactional - public String getProgramIndicatorValue( ProgramIndicator programIndicator, ProgramInstance programInstance ) + public Double getProgramIndicatorValue( ProgramIndicator indicator, ProgramInstance programInstance ) { - Double value = getValue( programIndicator, programInstance, null ); - - if ( value != null ) - { - if ( programIndicator.getValueType().equals( ProgramIndicator.VALUE_TYPE_DATE ) ) - { - Date baseDate = new Date(); - - if ( ProgramIndicator.VAR_INCIDENT_DATE.equals( programIndicator.getRootDate() ) ) - { - baseDate = programInstance.getDateOfIncident(); - } - else if ( ProgramIndicator.VAR_ENROLLMENT_DATE.equals( programIndicator.getRootDate() ) ) - { - baseDate = programInstance.getEnrollmentDate(); - } - - Date date = DateUtils.getDateAfterAddition( baseDate, value.intValue() ); - - return DateUtils.getMediumDateString( date ); - } - - return String.valueOf( Math.floor( value ) ); - } - - return null; + StringBuffer buffer = new StringBuffer(); + + String expression = indicator.getExpression(); + + Matcher matcher = ProgramIndicator.EXPRESSION_PATTERN.matcher( expression ); + + int valueCount = 0; + int zeroPosValueCount = 0; + + while ( matcher.find() ) + { + String key = matcher.group( 1 ); + String uid = matcher.group( 2 ); + + if ( ProgramIndicator.KEY_DATAELEMENT.equals( key ) ) + { + String de = matcher.group( 3 ); + ProgramStage programStage = programStageService.getProgramStage( uid ); + DataElement dataElement = dataElementService.getDataElement( de ); + + if ( programStage != null && dataElement != null ) + { + ProgramStageInstance psi = programStageInstanceService.getProgramStageInstance( programInstance, programStage ); + + TrackedEntityDataValue dataValue = dataValueService.getTrackedEntityDataValue( psi, dataElement ); + + if ( dataValue == null ) + { + return null; + } + + String value = dataValue.getValue(); + + if ( dataElement.getType().equals( DataElement.VALUE_TYPE_DATE ) ) + { + value = DateUtils.daysBetween( new Date(), DateUtils.getDefaultDate( value ) ) + " "; + } + + matcher.appendReplacement( buffer, value ); + + valueCount++; + zeroPosValueCount = isZeroOrPositive( value ) ? (zeroPosValueCount + 1) : zeroPosValueCount; + } + else + { + return null; + } + } + else if ( ProgramIndicator.KEY_ATTRIBUTE.equals( key ) ) + { + TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( uid ); + + if ( attribute != null ) + { + TrackedEntityAttributeValue attributeValue = attributeValueService.getTrackedEntityAttributeValue( + programInstance.getEntityInstance(), attribute ); + + if ( attributeValue != null ) + { + String value = attributeValue.getValue(); + + if ( ValueType.DATE == attribute.getValueType() ) + { + value = DateUtils.daysBetween( new Date(), DateUtils.getDefaultDate( value ) ) + " "; + } + + matcher.appendReplacement( buffer, value ); + + valueCount++; + zeroPosValueCount = isZeroOrPositive( value ) ? (zeroPosValueCount + 1) : zeroPosValueCount; + } + else + { + return null; + } + } + else + { + return null; + } + } + else if ( ProgramIndicator.KEY_CONSTANT.equals( key ) ) + { + Constant constant = constantService.getConstant( uid ); + + if ( constant != null ) + { + matcher.appendReplacement( buffer, String.valueOf( constant.getValue() ) ); + } + else + { + return null; + } + } + else if ( ProgramIndicator.KEY_PROGRAM_VARIABLE.equals( key ) ) + { + Date currentDate = new Date(); + Date date = null; + + if ( ProgramIndicator.VAR_ENROLLMENT_DATE.equals( uid ) ) + { + date = programInstance.getEnrollmentDate(); + } + else if ( ProgramIndicator.VAR_INCIDENT_DATE.equals( uid ) ) + { + date = programInstance.getDateOfIncident(); + } + else if ( ProgramIndicator.VAR_CURRENT_DATE.equals( uid ) ) + { + date = currentDate; + } + + // TODO ProgramIndicator.VAR_EXECUTION_DATE; + + if ( date != null ) + { + matcher.appendReplacement( buffer, DateUtils.daysBetween( currentDate, date ) + "" ); + } + } + } + + expression = TextUtils.appendTail( matcher, buffer ); + + // --------------------------------------------------------------------- + // Value count variable + // --------------------------------------------------------------------- + + buffer = new StringBuffer(); + matcher = ProgramIndicator.VALUECOUNT_PATTERN.matcher( expression ); + + while ( matcher.find() ) + { + String var = matcher.group( 1 ); + + if ( ProgramIndicator.VAR_VALUE_COUNT.equals( var ) ) + { + matcher.appendReplacement( buffer, String.valueOf( valueCount ) ); + } + else if ( ProgramIndicator.VAR_ZERO_POS_VALUE_COUNT.equals( var ) ) + { + matcher.appendReplacement( buffer, String.valueOf( zeroPosValueCount ) ); + } + } + + expression = TextUtils.appendTail( matcher, buffer ); + + return MathUtils.calculateExpression( expression ); } @Override @Transactional - public Map getProgramIndicatorValues( ProgramInstance programInstance ) + public Map getProgramIndicatorValues( ProgramInstance programInstance ) { - Map result = new HashMap<>(); + Map result = new HashMap<>(); Set programIndicators = programInstance.getProgram().getProgramIndicators(); for ( ProgramIndicator programIndicator : programIndicators ) { - String value = getProgramIndicatorValue( programIndicator, programInstance ); + Double value = getProgramIndicatorValue( programIndicator, programInstance ); if ( value != null ) { @@ -611,170 +733,6 @@ // ------------------------------------------------------------------------- /** - * Get indicator value for the given arguments. If programStageInstance - * argument is null, the program stage instance will be retrieved based on - * the given program instance in combination with the program stage from the indicator expression. - * - * @param indicator the indicator, must be not null. - * @param programInstance the program instance, can be null. - * @param programStageInstance the program stage instance, can be null. - */ - private Double getValue( ProgramIndicator indicator, ProgramInstance programInstance, ProgramStageInstance programStageInstance ) - { - StringBuffer buffer = new StringBuffer(); - - String expression = indicator.getExpression(); - - Matcher matcher = ProgramIndicator.EXPRESSION_PATTERN.matcher( expression ); - - int valueCount = 0; - int zeroPosValueCount = 0; - - while ( matcher.find() ) - { - String key = matcher.group( 1 ); - String uid = matcher.group( 2 ); - - if ( ProgramIndicator.KEY_DATAELEMENT.equals( key ) ) - { - String de = matcher.group( 3 ); - ProgramStage programStage = programStageService.getProgramStage( uid ); - DataElement dataElement = dataElementService.getDataElement( de ); - - if ( programStage != null && dataElement != null ) - { - ProgramStageInstance psi = programStageInstance != null ? - programStageInstance : - programStageInstanceService.getProgramStageInstance( programInstance, programStage ); - - TrackedEntityDataValue dataValue = dataValueService.getTrackedEntityDataValue( psi, dataElement ); - - if ( dataValue == null ) - { - return null; - } - - String value = dataValue.getValue(); - - if ( dataElement.getType().equals( DataElement.VALUE_TYPE_DATE ) ) - { - value = DateUtils.daysBetween( new Date(), DateUtils.getDefaultDate( value ) ) + " "; - } - - matcher.appendReplacement( buffer, value ); - - valueCount++; - zeroPosValueCount = isZeroOrPositive( value ) ? (zeroPosValueCount + 1) : zeroPosValueCount; - } - else - { - return null; - } - } - else if ( ProgramIndicator.KEY_ATTRIBUTE.equals( key ) ) - { - TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( uid ); - - if ( attribute != null ) - { - TrackedEntityAttributeValue attributeValue = attributeValueService.getTrackedEntityAttributeValue( - programInstance.getEntityInstance(), attribute ); - - if ( attributeValue != null ) - { - String value = attributeValue.getValue(); - - if ( ValueType.DATE == attribute.getValueType() ) - { - value = DateUtils.daysBetween( new Date(), DateUtils.getDefaultDate( value ) ) + " "; - } - - matcher.appendReplacement( buffer, value ); - - valueCount++; - zeroPosValueCount = isZeroOrPositive( value ) ? (zeroPosValueCount + 1) : zeroPosValueCount; - } - else - { - return null; - } - } - else - { - return null; - } - } - else if ( ProgramIndicator.KEY_CONSTANT.equals( key ) ) - { - Constant constant = constantService.getConstant( uid ); - - if ( constant != null ) - { - matcher.appendReplacement( buffer, String.valueOf( constant.getValue() ) ); - } - else - { - return null; - } - } - else if ( ProgramIndicator.KEY_PROGRAM_VARIABLE.equals( key ) ) - { - Date currentDate = new Date(); - Date date = null; - - if ( ProgramIndicator.VAR_ENROLLMENT_DATE.equals( uid ) ) - { - date = programInstance.getEnrollmentDate(); - } - else if ( ProgramIndicator.VAR_INCIDENT_DATE.equals( uid ) ) - { - date = programInstance.getDateOfIncident(); - } - else if ( ProgramIndicator.VAR_EXECUTION_DATE.equals( uid ) ) - { - date = programStageInstance != null ? programStageInstance.getExecutionDate() : null; - } - else if ( ProgramIndicator.VAR_CURRENT_DATE.equals( uid ) ) - { - date = currentDate; - } - - if ( date != null ) - { - matcher.appendReplacement( buffer, DateUtils.daysBetween( currentDate, date ) + "" ); - } - } - } - - expression = TextUtils.appendTail( matcher, buffer ); - - // --------------------------------------------------------------------- - // Value count variable - // --------------------------------------------------------------------- - - buffer = new StringBuffer(); - matcher = ProgramIndicator.VALUECOUNT_PATTERN.matcher( expression ); - - while ( matcher.find() ) - { - String var = matcher.group( 1 ); - - if ( ProgramIndicator.VAR_VALUE_COUNT.equals( var ) ) - { - matcher.appendReplacement( buffer, String.valueOf( valueCount ) ); - } - else if ( ProgramIndicator.VAR_ZERO_POS_VALUE_COUNT.equals( var ) ) - { - matcher.appendReplacement( buffer, String.valueOf( zeroPosValueCount ) ); - } - } - - expression = TextUtils.appendTail( matcher, buffer ); - - return MathUtils.calculateExpression( expression ); - } - - /** * Creates a SQL select clause from the given program indicator variable * based on the given expression. Wraps the count variables with * nullif to avoid potential division by zero. === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java 2015-08-26 11:37:24 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java 2015-09-04 08:57:35 +0000 @@ -306,6 +306,9 @@ executeSql( "ALTER TABLE programindicator ALTER description TYPE text" ); executeSql( "ALTER TABLE programindicator ALTER expression TYPE text" ); + executeSql( "alter table programindicator drop column valuetype" ); + executeSql( "alter table programindicator drop column rootdate" ); + executeSql( "ALTER TABLE programstage ALTER description TYPE text" ); executeSql( "update programindicator set displayinform = false where displayinform is null" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml 2015-08-28 10:23:48 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml 2015-09-04 08:57:35 +0000 @@ -22,8 +22,6 @@ - - @@ -45,9 +43,7 @@ - - - + === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java 2015-09-03 08:15:09 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java 2015-09-04 08:57:35 +0000 @@ -291,7 +291,7 @@ programA.getProgramIndicators().add( indicatorA ); indicatorB = createProgramIndicator( 'B', programA, "70", null ); - indicatorB.setValueType( ProgramIndicator.VALUE_TYPE_DATE ); + //indicatorB.setValueType( ProgramIndicator.VALUE_TYPE_DATE ); programA.getProgramIndicators().add( indicatorB ); indicatorC = createProgramIndicator( 'C', programA, "0", null ); @@ -325,13 +325,13 @@ + KEY_DATAELEMENT + "{" + psA.getUid() + "." + deB.getUid() + "} ) + " + KEY_DATAELEMENT + "{" + psA.getUid() + "." + deA.getUid() + "}"; indicatorI = createProgramIndicator( 'I', programB, expressionI, null ); - indicatorI.setValueType( VALUE_TYPE_DATE ); + //indicatorI.setValueType( VALUE_TYPE_DATE ); String expressionJ = "(" + KEY_ATTRIBUTE + "{" + atC.getUid() + "} - " + KEY_PROGRAM_VARIABLE + "{" + ProgramIndicator.VAR_ENROLLMENT_DATE + "} ) + " + KEY_DATAELEMENT + "{" + psA.getUid() + "." + deA.getUid() + "} * " + ProgramIndicator.KEY_CONSTANT + "{" + constantA.getUid() + "}"; indicatorJ = createProgramIndicator( 'J', programB, expressionJ, null ); - indicatorJ.setValueType( VALUE_TYPE_DATE ); + //indicatorJ.setValueType( VALUE_TYPE_DATE ); } // ------------------------------------------------------------------------- @@ -450,20 +450,17 @@ programIndicatorService.addProgramIndicator( indicatorI ); programIndicatorService.addProgramIndicator( indicatorJ ); - String valueINT = programIndicatorService.getProgramIndicatorValue( indicatorA, programInstance ); - assertEquals( "10.0", valueINT ); - - String valueDATE = programIndicatorService.getProgramIndicatorValue( indicatorB, programInstance ); - assertEquals( DateUtils.getMediumDateString( enrollmentDate ), valueDATE ); - - String valueE = programIndicatorService.getProgramIndicatorValue( indicatorE, programInstance ); - assertEquals( "9.0", valueE ); - - String valueF = programIndicatorService.getProgramIndicatorValue( indicatorF, programInstance ); - assertEquals( "17.0", valueF ); - - String valueG = programIndicatorService.getProgramIndicatorValue( indicatorG, programInstance ); - assertEquals( "29.0", valueG ); + Double valueINT = programIndicatorService.getProgramIndicatorValue( indicatorA, programInstance ); + assertEquals( 10.0, valueINT, 0.01 ); + + Double valueE = programIndicatorService.getProgramIndicatorValue( indicatorE, programInstance ); + assertEquals( 9.0, valueE, 0.01 ); + + Double valueF = programIndicatorService.getProgramIndicatorValue( indicatorF, programInstance ); + assertEquals( 17.0, valueF, 0.01 ); + + Double valueG = programIndicatorService.getProgramIndicatorValue( indicatorG, programInstance ); + assertEquals( 29.0, valueG, 0.01 ); } @Test @@ -471,12 +468,9 @@ { programIndicatorService.addProgramIndicator( indicatorA ); programIndicatorService.addProgramIndicator( indicatorB ); - programIndicatorService.addProgramIndicator( indicatorC ); - Map indicatorMap = programIndicatorService.getProgramIndicatorValues( programInstance ); - assertEquals( 3, indicatorMap.keySet().size() ); - assertEquals( "10.0", indicatorMap.get( "IndicatorA" ) ); - assertEquals( DateUtils.getMediumDateString( enrollmentDate ), indicatorMap.get( "IndicatorB" ) ); + Map indicatorMap = programIndicatorService.getProgramIndicatorValues( programInstance ); + assertEquals( 10.0, indicatorMap.get( "IndicatorA" ), 0.01 ); } @Test === modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java' --- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2015-09-04 05:55:14 +0000 +++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2015-09-04 08:57:35 +0000 @@ -1293,10 +1293,8 @@ indicator.setCode( "IndicatorCode" + uniqueCharacter ); indicator.setDescription( "IndicatorDescription" + uniqueCharacter ); indicator.setProgram( program ); - indicator.setValueType( ProgramIndicator.VALUE_TYPE_INT ); indicator.setExpression( expression ); indicator.setFilter( filter ); - indicator.setRootDate( ProgramIndicator.VAR_INCIDENT_DATE ); return indicator; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2015-04-21 08:42:34 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2015-09-04 08:57:35 +0000 @@ -252,9 +252,9 @@ return latitude; } - private Map programIndicatorsMap = new HashMap<>(); + private Map programIndicatorsMap = new HashMap<>(); - public Map getProgramIndicatorsMap() + public Map getProgramIndicatorsMap() { return programIndicatorsMap; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java 2015-07-02 07:05:55 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/TrackedEntityInstanceDashboardAction.java 2015-09-04 08:57:35 +0000 @@ -107,13 +107,13 @@ private Collection relationships = new HashSet<>(); - private Map programIndicatorsMap = new HashMap<>(); + private Map programIndicatorsMap = new HashMap<>(); // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- - public Map getProgramIndicatorsMap() + public Map getProgramIndicatorsMap() { return programIndicatorsMap; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java 2015-08-28 10:23:48 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java 2015-09-04 08:57:35 +0000 @@ -28,9 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import org.apache.commons.lang3.StringUtils; import org.hisp.dhis.analytics.AggregationType; import org.hisp.dhis.analytics.EventOutputType; @@ -110,13 +107,6 @@ this.description = description; } - private String valueType; - - public void setValueType( String valueType ) - { - this.valueType = valueType; - } - private String expression; public void setExpression( String expression ) @@ -159,13 +149,6 @@ this.displayInForm = displayInForm; } - private String rootDate; - - public void setRootDate( String rootDate ) - { - this.rootDate = rootDate; - } - // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -174,20 +157,6 @@ public String execute() throws Exception { - code = (code == null && code.trim().length() == 0) ? null : code; - expression = expression.trim(); - - if ( valueType.equals( ProgramIndicator.VALUE_TYPE_DATE ) ) - { - Pattern pattern = Pattern.compile( "[(+|-|*|\\)]+" ); - Matcher matcher = pattern.matcher( expression ); - - if ( matcher.find() && matcher.start() != 0 ) - { - expression = "+" + expression; - } - } - Program program = programService.getProgram( programId ); ProgramIndicator indicator = new ProgramIndicator(); @@ -196,18 +165,15 @@ indicator.setCode( StringUtils.trimToNull( code ) ); indicator.setDescription( StringUtils.trimToNull( description ) ); indicator.setProgram( program ); - indicator.setValueType( StringUtils.trimToNull( valueType ) ); indicator.setExpression( StringUtils.trimToNull( expression ) ); indicator.setFilter( StringUtils.trimToNull( filter ) ); indicator.setAggregationType( AggregationType.valueOf( aggregationType ) ); indicator.setEventOutputType( EventOutputType.valueOf( eventOutputType ) ); indicator.setDecimals( decimals ); indicator.setDisplayInForm( displayInForm ); - indicator.setRootDate( StringUtils.trimToNull( rootDate ) ); programIndicatorService.addProgramIndicator( indicator ); return SUCCESS; } - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java 2015-08-28 10:23:48 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java 2015-09-04 08:57:35 +0000 @@ -28,9 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import org.apache.commons.lang.StringUtils; import org.hisp.dhis.analytics.AggregationType; import org.hisp.dhis.analytics.EventOutputType; @@ -96,13 +93,6 @@ this.description = description; } - private String valueType; - - public void setValueType( String valueType ) - { - this.valueType = valueType; - } - private String expression; public void setExpression( String expression ) @@ -145,13 +135,6 @@ this.displayInForm = displayInForm; } - private String rootDate; - - public void setRootDate( String rootDate ) - { - this.rootDate = rootDate; - } - private Integer programId; public Integer getProgramId() @@ -167,34 +150,18 @@ public String execute() throws Exception { - code = (code == null && code.trim().length() == 0) ? null : code; - expression = expression.trim(); - - if ( valueType.equals( ProgramIndicator.VALUE_TYPE_DATE ) ) - { - Pattern pattern = Pattern.compile( "[(+|-|*|\\)]+" ); - Matcher matcher = pattern.matcher( expression ); - - if ( matcher.find() && matcher.start() != 0 ) - { - expression = "+" + expression; - } - } - ProgramIndicator indicator = programIndicatorService.getProgramIndicator( id ); indicator.setName( StringUtils.trimToNull( name ) ); indicator.setShortName( StringUtils.trimToNull( shortName ) ); indicator.setCode( StringUtils.trimToNull( code ) ); indicator.setDescription( StringUtils.trimToNull( description ) ); - indicator.setValueType( StringUtils.trimToNull( valueType ) ); indicator.setExpression( StringUtils.trimToNull( expression ) ); indicator.setFilter( StringUtils.trimToNull( filter ) ); indicator.setAggregationType( AggregationType.valueOf( aggregationType ) ); indicator.setEventOutputType( EventOutputType.valueOf( eventOutputType ) ); indicator.setDecimals( decimals ); indicator.setDisplayInForm( displayInForm ); - indicator.setRootDate( StringUtils.trimToNull( rootDate ) ); programIndicatorService.updateProgramIndicator( indicator ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm 2015-08-28 10:23:48 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm 2015-09-04 08:57:35 +0000 @@ -53,16 +53,6 @@ - - - - - - - - - - - - - -
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm 2015-09-03 08:15:09 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm 2015-09-04 08:57:35 +0000 @@ -53,16 +53,6 @@ - - - - - - - - - - - - - -