=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2012-10-25 10:22:15 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2012-10-25 11:02:23 +0000 @@ -60,8 +60,16 @@ public class MapView extends BaseIdentifiableObject { + public static final String LAYER_BOUNDARY = "boundary"; + public static final String LAYER_THEMATIC1 = "thematic1"; + public static final String LAYER_THEMATIC2 = "thematic2"; + public static final String LAYER_FACILITY = "facility"; + public static final String LAYER_SYMBOL = "symbol"; + private static final long serialVersionUID = 1866358818802275436L; + private String layer; + private User user; private String valueType; @@ -112,12 +120,13 @@ { } - public MapView( String name, User user, String valueType, IndicatorGroup indicatorGroup, Indicator indicator, + public MapView( String layer, String name, User user, String valueType, IndicatorGroup indicatorGroup, Indicator indicator, DataElementGroup dataElementGroup, DataElement dataElement, PeriodType periodType, Period period, OrganisationUnit parentOrganisationUnit, OrganisationUnitLevel organisationUnitLevel, String legendType, Integer method, Integer classes, String colorLow, String colorHigh, MapLegendSet legendSet, Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom, int opacity ) { + this.layer = layer; this.name = name; this.user = user; this.valueType = valueType; @@ -188,6 +197,19 @@ // ------------------------------------------------------------------------- @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public String getLayer() + { + return layer; + } + + public void setLayer( String layer ) + { + this.layer = layer; + } + + @JsonProperty @JsonSerialize( as = BaseIdentifiableObject.class ) @JsonView( {DetailedView.class, ExportView.class} ) @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2012-10-25 10:22:15 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2012-10-25 11:02:23 +0000 @@ -440,7 +440,7 @@ MapLegendSet mapLegendSet = mapLegendSetId != null ? getMapLegendSet( mapLegendSetId ) : null; - addMapView( new MapView( name, user, mapValueType, indicatorGroup, indicator, dataElementGroup, dataElement, + addMapView( new MapView( MapView.LAYER_THEMATIC1, name, user, mapValueType, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, parent, level, mapLegendType, method, classes, colorLow, colorHigh, mapLegendSet, radiusLow, radiusHigh, longitude, latitude, zoom, 1 ) ); } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2012-10-25 10:22:15 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2012-10-25 11:02:23 +0000 @@ -145,6 +145,8 @@ executeSql( "ALTER TABLE mapview RENAME COLUMN maplegendtype TO legendtype" ); executeSql( "ALTER TABLE mapview RENAME COLUMN maplegendsetid TO legendsetid" ); + executeSql( "UPDATE mapview SET layer = 'thematic1' WHERE layer IS NULL" ); + executeSql( "DELETE FROM systemsetting WHERE name = 'longitude'" ); executeSql( "DELETE FROM systemsetting WHERE name = 'latitude'" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml 2012-10-25 10:22:15 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml 2012-10-25 11:02:23 +0000 @@ -13,6 +13,8 @@ &identifiableProperties; + + === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2012-10-25 10:22:15 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2012-10-25 11:02:23 +0000 @@ -32,6 +32,7 @@ import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; import static org.hisp.dhis.mapping.MappingService.*; +import static org.hisp.dhis.mapping.MapView.*; import java.util.ArrayList; import java.util.Collection; @@ -265,7 +266,7 @@ @Test public void testAddGetMapView() { - MapView mapView = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, + MapView mapView = new MapView( LAYER_THEMATIC1, "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B", mapLegendSet, 5, 20, "1", "1", 1, 1 ); @@ -282,7 +283,7 @@ @Test public void testGetDeleteMapViewByName() { - MapView mapView = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, + MapView mapView = new MapView( LAYER_THEMATIC1, "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B", mapLegendSet, 5, 20, "1", "1", 1, 1 ); @@ -299,12 +300,12 @@ @Test public void testGetAllMapViews() { - MapView mapView1 = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, + MapView mapView1 = new MapView( LAYER_THEMATIC1, "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B", mapLegendSet, 5, 20, "1", "1", 1, 1 ); - MapView mapView2 = new MapView( "MapViewB", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, + MapView mapView2 = new MapView( LAYER_THEMATIC1, "MapViewB", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B", mapLegendSet, 5, 20, "2", "2", 1, 1 ); @@ -320,17 +321,17 @@ // TODO public void testGetMapViewsByFeatureType() { - MapView mapView1 = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, + MapView mapView1 = new MapView( LAYER_THEMATIC1, "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B", mapLegendSet, 5, 20, "1", "1", 1, 1 ); - MapView mapView2 = new MapView( "MapViewB", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, + MapView mapView2 = new MapView( LAYER_THEMATIC1, "MapViewB", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B", mapLegendSet, 5, 20, "2", "2", 1, 1 ); - MapView mapView3 = new MapView( "MapViewC", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, + MapView mapView3 = new MapView( LAYER_THEMATIC1, "MapViewC", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B", mapLegendSet, 5, 20, "3", "3", 1, 1 );