=== 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-10-11 21:39:47 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml 2015-11-14 19:06:53 +0000 @@ -34,9 +34,12 @@ 12 - + + + === 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-10-04 20:41:27 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/AddProgramIndicatorAction.java 2015-11-14 19:06:53 +0000 @@ -30,10 +30,13 @@ import org.apache.commons.lang3.StringUtils; import org.hisp.dhis.analytics.AggregationType; +import org.hisp.dhis.legend.LegendService; +import org.hisp.dhis.legend.LegendSet; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramIndicator; import org.hisp.dhis.program.ProgramIndicatorService; import org.hisp.dhis.program.ProgramService; +import org.springframework.beans.factory.annotation.Autowired; import com.opensymphony.xwork2.Action; @@ -61,6 +64,9 @@ { this.programIndicatorService = programIndicatorService; } + + @Autowired + private LegendService legendService; // ------------------------------------------------------------------------- // Setters @@ -134,6 +140,13 @@ this.decimals = decimals; } + private Integer legendSetId; + + public void setLegendSetId( Integer legendSetId ) + { + this.legendSetId = legendSetId; + } + private Boolean displayInForm; public void setDisplayInForm( Boolean displayInForm ) @@ -151,6 +164,8 @@ { Program program = programService.getProgram( programId ); + LegendSet legendSet = legendService.getLegendSet( legendSetId ); + ProgramIndicator indicator = new ProgramIndicator(); indicator.setName( StringUtils.trimToNull( name ) ); indicator.setShortName( StringUtils.trimToNull( shortName ) ); @@ -161,6 +176,7 @@ indicator.setFilter( StringUtils.trimToNull( filter ) ); indicator.setAggregationType( AggregationType.valueOf( aggregationType ) ); indicator.setDecimals( decimals ); + indicator.setLegendSet( legendSet ); indicator.setDisplayInForm( displayInForm ); programIndicatorService.addProgramIndicator( indicator ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/GetProgramIndicatorAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/GetProgramIndicatorAction.java 2015-10-19 14:29:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/GetProgramIndicatorAction.java 2015-11-14 19:06:53 +0000 @@ -35,6 +35,8 @@ import org.hisp.dhis.constant.Constant; import org.hisp.dhis.constant.ConstantService; +import org.hisp.dhis.legend.LegendService; +import org.hisp.dhis.legend.LegendSet; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramIndicator; import org.hisp.dhis.program.ProgramIndicatorService; @@ -67,6 +69,9 @@ @Autowired private ProgramService programService; + + @Autowired + private LegendService legendService; // ------------------------------------------------------------------------- // Setters @@ -134,6 +139,13 @@ { return constants; } + + private List legendSets = new ArrayList<>(); + + public List getLegendSets() + { + return legendSets; + } // ------------------------------------------------------------------------- // Action implementation @@ -157,13 +169,15 @@ } expressionAttributes = new ArrayList<>( program.getTrackedEntityAttributes() ); - constants = new ArrayList<>( constantService.getAllConstants() ); + constants = constantService.getAllConstants(); + legendSets = legendService.getAllLegendSets(); expressionAttributes = expressionAttributes.stream().filter( ArithmeticValueTypeTrackedEntityAttributeFilter.INSTANCE ).collect( Collectors.toList() ); Collections.sort( expressionAttributes ); Collections.sort( constants ); - + Collections.sort( legendSets ); + 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-10-04 20:41:27 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/UpdateProgramIndicatorAction.java 2015-11-14 19:06:53 +0000 @@ -30,8 +30,11 @@ import org.apache.commons.lang3.StringUtils; import org.hisp.dhis.analytics.AggregationType; +import org.hisp.dhis.legend.LegendService; +import org.hisp.dhis.legend.LegendSet; import org.hisp.dhis.program.ProgramIndicator; import org.hisp.dhis.program.ProgramIndicatorService; +import org.springframework.beans.factory.annotation.Autowired; import com.opensymphony.xwork2.Action; @@ -53,6 +56,9 @@ this.programIndicatorService = programIndicatorService; } + @Autowired + private LegendService legendService; + // ------------------------------------------------------------------------- // Setters // ------------------------------------------------------------------------- @@ -120,6 +126,13 @@ this.decimals = decimals; } + private Integer legendSetId; + + public void setLegendSetId( Integer legendSetId ) + { + this.legendSetId = legendSetId; + } + private Boolean displayInForm; public void setDisplayInForm( Boolean displayInForm ) @@ -144,6 +157,8 @@ { ProgramIndicator indicator = programIndicatorService.getProgramIndicator( id ); + LegendSet legendSet = legendService.getLegendSet( legendSetId ); + indicator.setName( StringUtils.trimToNull( name ) ); indicator.setShortName( StringUtils.trimToNull( shortName ) ); indicator.setCode( StringUtils.trimToNull( code ) ); @@ -152,6 +167,7 @@ indicator.setFilter( StringUtils.trimToNull( filter ) ); indicator.setAggregationType( AggregationType.valueOf( aggregationType ) ); indicator.setDecimals( decimals ); + indicator.setLegendSet( legendSet ); indicator.setDisplayInForm( displayInForm ); 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-10-04 20:41:27 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramIndicator.vm 2015-11-14 19:06:53 +0000 @@ -78,6 +78,17 @@ + + + + + + === 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-10-04 20:41:27 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramIndicator.vm 2015-11-14 19:06:53 +0000 @@ -77,6 +77,17 @@ + + + + + +