=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/FilteredMetaDataController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/FilteredMetaDataController.java 2013-10-31 10:29:22 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/FilteredMetaDataController.java 2013-11-04 16:58:07 +0000 @@ -27,11 +27,25 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.zip.GZIPOutputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import net.sf.json.JSONObject; + import org.hisp.dhis.api.utils.ContextUtils; import org.hisp.dhis.common.view.ExportView; -import org.hisp.dhis.dxf2.metadata.*; +import org.hisp.dhis.dxf2.metadata.ExportService; +import org.hisp.dhis.dxf2.metadata.FilterOptions; +import org.hisp.dhis.dxf2.metadata.ImportOptions; +import org.hisp.dhis.dxf2.metadata.ImportService; +import org.hisp.dhis.dxf2.metadata.MetaData; import org.hisp.dhis.dxf2.metadata.tasks.ImportMetaDataTask; import org.hisp.dhis.dxf2.utils.JacksonUtils; import org.hisp.dhis.filter.MetaDataFilter; @@ -47,16 +61,13 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.*; -import java.util.List; -import java.util.Map; -import java.util.zip.GZIPOutputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; +import com.fasterxml.jackson.databind.ObjectMapper; /** * @author Ovidiu Rosu @@ -109,7 +120,7 @@ @RequestMapping( value = FilteredMetaDataController.RESOURCE_PATH, headers = "Accept=application/json" ) @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" ) - public String detailedExport( @RequestParam Map parameters, Model model ) throws IOException + public String detailedExport( @RequestParam Map parameters, Model model ) { WebOptions options = new WebOptions( parameters ); MetaData metaData = exportService.getMetaData( options ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java 2013-11-04 06:18:11 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java 2013-11-04 16:58:07 +0000 @@ -260,8 +260,6 @@ public void getEntitiesWithinRange( @RequestParam Map parameters, Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception { - List entityList; - WebOptions options = new WebOptions( parameters ); Double longitude = Double.parseDouble( options.getOptions().get( "longitude" ) ); @@ -269,46 +267,41 @@ Double distance = Double.parseDouble( options.getOptions().get( "distance" ) ); String orgUnitGroupSetId = options.getOptions().get( "orgUnitGroupSetId" ); - entityList = new ArrayList( organisationUnitService.getWithinCoordinateArea( longitude, latitude, distance ) ); - - if ( entityList != null ) - { - for( OrganisationUnit orgunit : entityList ) + List entityList = new ArrayList( organisationUnitService.getWithinCoordinateArea( longitude, latitude, distance ) ); + + for( OrganisationUnit orgunit : entityList ) + { + Set attributeValues = orgunit.getAttributeValues(); + attributeValues.clear(); + + if ( orgUnitGroupSetId != null ) // Add org unit group symbol into attr { - Set attributeValues = orgunit.getAttributeValues(); - attributeValues.clear(); - - // Add OrgUnit Group Symbol into attributes - if( orgUnitGroupSetId != null ) + for ( OrganisationUnitGroup orgunitGroup : orgunit.getGroups() ) { - for ( OrganisationUnitGroup orgunitGroup : orgunit.getGroups() ) + if ( orgunitGroup.getGroupSet() != null ) { - if( orgunitGroup.getGroupSet() != null ) - { - OrganisationUnitGroupSet orgunitGroupSet = orgunitGroup.getGroupSet(); - - if( orgunitGroupSet.getUid().compareTo( orgUnitGroupSetId ) == 0 ) - { - AttributeValue attributeValue = new AttributeValue(); - attributeValue.setAttribute( new Attribute( "OrgUnitGroupSymbol", "OrgUnitGroupSymbol" ) ); - attributeValue.setValue( orgunitGroup.getSymbol() ); - - attributeValues.add( attributeValue ); - } + OrganisationUnitGroupSet orgunitGroupSet = orgunitGroup.getGroupSet(); + + if ( orgunitGroupSet.getUid().compareTo( orgUnitGroupSetId ) == 0 ) + { + AttributeValue attributeValue = new AttributeValue(); + attributeValue.setAttribute( new Attribute( "OrgUnitGroupSymbol", "OrgUnitGroupSymbol" ) ); + attributeValue.setValue( orgunitGroup.getSymbol() ); + + attributeValues.add( attributeValue ); } } } - - orgunit.setAttributeValues( attributeValues ); - - // Clear out all data not needed for this task - orgunit.removeAllDataSets(); - orgunit.removeAllUsers(); - orgunit.removeAllOrganisationUnitGroups(); } + + orgunit.setAttributeValues( attributeValues ); + + // Clear out all data not needed for this task + orgunit.removeAllDataSets(); + orgunit.removeAllUsers(); + orgunit.removeAllOrganisationUnitGroups(); } JacksonUtils.toJson( response.getOutputStream(), entityList ); - } - + } }