=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java 2014-06-16 19:51:38 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java 2014-06-24 11:30:23 +0000 @@ -37,12 +37,16 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; +import org.hisp.dhis.common.DimensionalObjectUtils; import org.hisp.dhis.setting.SystemSettingManager; import org.hisp.dhis.system.util.DateUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -275,6 +279,36 @@ return new ArrayList( Arrays.asList( values ) ); } + + /** + * Returns a mapping of dimension identifiers and dimension option identifiers + * based on the given set of dimension strings. Splits the strings using : as + * separator. Returns null of dimensions are null or empty. + * + * @param dimensions the set of strings on format dimension:dimension-option. + * @return a map of dimensions and dimension options. + */ + public static Map getDimensionsAndOptions( Set dimensions ) + { + if ( dimensions == null || dimensions.isEmpty() ) + { + return null; + } + + Map map = new HashMap(); + + for ( String dim : dimensions ) + { + String[] dims = dim.split( DimensionalObjectUtils.DIMENSION_NAME_SEP ); + + if ( dims.length == 2 && dims[0] != null && dims[1] != null ) + { + map.put( dims[0], dims[1] ); + } + } + + return map; + } /** * Adds basic authentication by adding an Authorization header to the === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTreeSelect.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTreeSelect.js 2013-11-06 10:41:43 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTreeSelect.js 2014-06-24 11:30:23 +0000 @@ -10,17 +10,10 @@ { selectedOrganisationUnitList__.empty(); - if( ids && ids.length > 0 ) { + if ( ids && ids.length > 0 ) { selectedOrganisationUnitList__.append(''); } - /* - jQuery.each(ids, function( i, item ) - { - selectedOrganisationUnitList__.append(''); - }); - */ - byId('treeSelectedId').selectedIndex = 0; } === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java 2014-06-23 21:31:31 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java 2014-06-24 11:30:23 +0000 @@ -32,7 +32,6 @@ import static org.hisp.dhis.dataset.DataSet.TYPE_SECTION; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -40,10 +39,6 @@ import javax.servlet.http.HttpServletResponse; import org.apache.struts2.ServletActionContext; -import org.hisp.dhis.webapi.utils.ContextUtils; -import org.hisp.dhis.webapi.utils.InputUtils; -import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy; -import org.hisp.dhis.common.DimensionalObjectUtils; import org.hisp.dhis.common.Grid; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataset.CompleteDataSetRegistration; @@ -58,6 +53,9 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.period.PeriodType; +import org.hisp.dhis.webapi.utils.ContextUtils; +import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy; +import org.hisp.dhis.webapi.utils.InputUtils; import org.springframework.beans.factory.annotation.Autowired; import com.opensymphony.xwork2.Action; @@ -269,20 +267,7 @@ selectedOrgunit = organisationUnitService.getOrganisationUnit( ou ); - Map dimensions = new HashMap(); - - if ( dimension != null ) - { - for ( String dim : dimension ) - { - String[] dims = dim.split( DimensionalObjectUtils.DIMENSION_NAME_SEP ); - - if ( dims.length == 2 && dims[0] != null && dims[1] != null ) - { - dimensions.put( dims[0], dims[1] ); - } - } - } + Map dimensions = ContextUtils.getDimensionsAndOptions( dimension ); String dataSetType = selectedDataSet.getDataSetType();