=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorsAction.java' --- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorsAction.java 2011-05-06 10:49:36 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorsAction.java 2011-05-12 16:16:32 +0000 @@ -32,6 +32,9 @@ import java.util.Comparator; import java.util.List; +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.indicator.IndicatorGroup; import org.hisp.dhis.indicator.IndicatorService; @@ -58,6 +61,13 @@ this.indicatorService = indicatorService; } + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + // ------------------------------------------------------------------------- // Comparator // ------------------------------------------------------------------------- @@ -91,6 +101,13 @@ this.id = id; } + private Integer dataSetId; + + public void setDataSetId( Integer dataSetId ) + { + this.dataSetId = dataSetId; + } + private List indicators; public List getIndicators() @@ -105,11 +122,7 @@ public String execute() throws Exception { - if ( id == null || id == ALL ) - { - indicators = new ArrayList( indicatorService.getAllIndicators() ); - } - else + if ( id != null && id != ALL ) { IndicatorGroup indicatorGroup = indicatorService.getIndicatorGroup( id ); @@ -117,11 +130,25 @@ { indicators = new ArrayList( indicatorGroup.getMembers() ); } - else + } + else if ( dataSetId != null ) + { + DataSet dataset = dataSetService.getDataSet( dataSetId ); + + if ( dataset != null ) { - indicators = new ArrayList(); + indicators = new ArrayList( dataset.getIndicators() ); } } + else + { + indicators = new ArrayList( indicatorService.getAllIndicators() ); + } + + if ( indicators == null ) + { + indicators = new ArrayList(); + } Collections.sort( indicators, indicatorComparator ); === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2011-05-06 12:55:00 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2011-05-12 16:16:32 +0000 @@ -395,6 +395,7 @@ +