← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8703: Minor revert, put back MapView.mapLegendType

 

------------------------------------------------------------
revno: 8703
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-10-25 11:03:35 +0200
message:
  Minor revert, put back MapView.mapLegendType
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
  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/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== 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 @@
     <many-to-one name="organisationUnitLevel" class="org.hisp.dhis.organisationunit.OrganisationUnitLevel"
       column="organisationunitlevelid" foreign-key="fk_mapview_organisationunitlevelid" />
 
+    <property name="mapLegendType" />
+
     <property name="method" />
 
     <property name="classes" />

=== 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 );