=== 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 08:23:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2012-10-25 09:03:35 +0000 @@ -80,6 +80,8 @@ private OrganisationUnit parentOrganisationUnit; private OrganisationUnitLevel organisationUnitLevel; + + private String mapLegendType; private Integer method; @@ -110,7 +112,7 @@ public MapView( String name, User user, String mapValueType, IndicatorGroup indicatorGroup, Indicator indicator, DataElementGroup dataElementGroup, DataElement dataElement, PeriodType periodType, Period period, OrganisationUnit parentOrganisationUnit, OrganisationUnitLevel organisationUnitLevel, - Integer method, Integer classes, String bounds, String colorLow, String colorHigh, + String mapLegendType, Integer method, Integer classes, String bounds, String colorLow, String colorHigh, MapLegendSet mapLegendSet, Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom ) { this.name = name; @@ -124,6 +126,7 @@ this.period = period; this.parentOrganisationUnit = parentOrganisationUnit; this.organisationUnitLevel = organisationUnitLevel; + this.mapLegendType = mapLegendType; this.method = method; this.classes = classes; this.bounds = bounds; @@ -325,6 +328,19 @@ @JsonProperty @JsonView( {DetailedView.class, ExportView.class} ) @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public String getMapLegendType() + { + return mapLegendType; + } + + public void setMapLegendType( String mapLegendType ) + { + this.mapLegendType = mapLegendType; + } + + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) public Integer getMethod() { return method; @@ -485,6 +501,7 @@ period = mapView.getPeriod() == null ? period : mapView.getPeriod(); parentOrganisationUnit = mapView.getParentOrganisationUnit() == null ? parentOrganisationUnit : mapView.getParentOrganisationUnit(); organisationUnitLevel = mapView.getOrganisationUnitLevel() == null ? organisationUnitLevel : mapView.getOrganisationUnitLevel(); + mapLegendType = mapView.getMapLegendType() == null ? mapLegendType : mapView.getMapLegendType(); method = mapView.getMethod() == null ? method : mapView.getMethod(); classes = mapView.getClasses() == null ? classes : mapView.getClasses(); bounds = mapView.getBounds() == null ? bounds : mapView.getBounds(); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2012-10-25 08:23:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2012-10-25 09:03:35 +0000 @@ -60,7 +60,10 @@ final String MAP_LAYER_TYPE_BASELAYER = "baselayer"; final String MAP_LAYER_TYPE_OVERLAY = "overlay"; - + + final String MAPLEGENDSET_TYPE_AUTOMATIC = "automatic"; + final String MAPLEGENDSET_TYPE_PREDEFINED = "predefined"; + // ------------------------------------------------------------------------- // IndicatorMapValue // ------------------------------------------------------------------------- === 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 08:23:30 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2012-10-25 09:03:35 +0000 @@ -441,7 +441,7 @@ MapLegendSet mapLegendSet = mapLegendSetId != null ? getMapLegendSet( mapLegendSetId ) : null; addMapView( new MapView( name, user, mapValueType, indicatorGroup, indicator, dataElementGroup, dataElement, - periodType, period, parent, level, method, classes, bounds, colorLow, colorHigh, + periodType, period, parent, level, mapLegendType, method, classes, bounds, colorLow, colorHigh, mapLegendSet, radiusLow, radiusHigh, longitude, latitude, zoom ) ); } === 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 08:23:30 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml 2012-10-25 09:03:35 +0000 @@ -40,6 +40,8 @@ + + === 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 08:23:30 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2012-10-25 09:03:35 +0000 @@ -31,6 +31,7 @@ import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; +import static org.hisp.dhis.mapping.MappingService.*; import java.util.ArrayList; import java.util.Collection; @@ -266,7 +267,7 @@ { MapView mapView = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, - organisationUnit, organisationUnitLevel, 1, 1, "", "A", "B", + organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 ); int idA = mappingService.addMapView( mapView ); @@ -283,7 +284,7 @@ { MapView mapView = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, - organisationUnit, organisationUnitLevel, 1, 1, "", "A", "B", + organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 ); int id = mappingService.addMapView( mapView ); @@ -300,12 +301,12 @@ { MapView mapView1 = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, - organisationUnit, organisationUnitLevel, 1, 1, "", "A", "B", + organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 ); MapView mapView2 = new MapView( "MapViewB", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, - organisationUnit, organisationUnitLevel, 1, 1, "", "A", "B", + organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "2", "2", 1 ); mappingService.addMapView( mapView1 ); @@ -321,17 +322,17 @@ { MapView mapView1 = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, - organisationUnit, organisationUnitLevel, 1, 1, "", "A", "B", + organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 ); MapView mapView2 = new MapView( "MapViewB", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, - organisationUnit, organisationUnitLevel, 1, 1, "", "A", "B", + organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "2", "2", 1 ); MapView mapView3 = new MapView( "MapViewC", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, indicator, dataElementGroup, dataElement, periodType, period, - organisationUnit, organisationUnitLevel, 1, 1, "", "A", "B", + organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "3", "3", 1 ); mappingService.addMapView( mapView1 );