← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8704: Added properties opacity and organisationUnitGroupSet to MapView

 

------------------------------------------------------------
revno: 8704
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-10-25 12:22:15 +0200
message:
  Added properties opacity and organisationUnitGroupSet to MapView
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.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/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java
  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/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
  dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.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 09:03:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2012-10-25 10:22:15 +0000
@@ -47,6 +47,7 @@
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
@@ -63,7 +64,7 @@
 
     private User user;
 
-    private String mapValueType;
+    private String valueType;
 
     private IndicatorGroup indicatorGroup;
 
@@ -81,19 +82,17 @@
 
     private OrganisationUnitLevel organisationUnitLevel;
     
-    private String mapLegendType;
+    private String legendType;
 
     private Integer method;
 
     private Integer classes;
 
-    private String bounds;
-
     private String colorLow;
 
     private String colorHigh;
 
-    private MapLegendSet mapLegendSet;
+    private MapLegendSet legendSet;
 
     private Integer radiusLow;
 
@@ -104,20 +103,24 @@
     private String latitude;
 
     private Integer zoom;
+    
+    private Integer opacity;
+    
+    private OrganisationUnitGroupSet organisationUnitGroupSet;
 
     public MapView()
     {
     }
 
-    public MapView( String name, User user, String mapValueType, IndicatorGroup indicatorGroup, Indicator indicator,
+    public MapView( String name, User user, String valueType, IndicatorGroup indicatorGroup, Indicator indicator,
                     DataElementGroup dataElementGroup, DataElement dataElement, PeriodType periodType,
                     Period period, OrganisationUnit parentOrganisationUnit, OrganisationUnitLevel organisationUnitLevel,
-                    String mapLegendType, Integer method, Integer classes, String bounds, String colorLow, String colorHigh,
-                    MapLegendSet mapLegendSet, Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom )
+                    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.name = name;
         this.user = user;
-        this.mapValueType = mapValueType;
+        this.valueType = valueType;
         this.indicatorGroup = indicatorGroup;
         this.indicator = indicator;
         this.dataElementGroup = dataElementGroup;
@@ -126,18 +129,18 @@
         this.period = period;
         this.parentOrganisationUnit = parentOrganisationUnit;
         this.organisationUnitLevel = organisationUnitLevel;
-        this.mapLegendType = mapLegendType;
+        this.legendType = legendType;
         this.method = method;
         this.classes = classes;
-        this.bounds = bounds;
         this.colorLow = colorLow;
         this.colorHigh = colorHigh;
-        this.mapLegendSet = mapLegendSet;
+        this.legendSet = legendSet;
         this.radiusLow = radiusLow;
         this.radiusHigh = radiusHigh;
         this.longitude = longitude;
         this.latitude = latitude;
         this.zoom = zoom;
+        this.opacity = opacity;
     }
 
     // -------------------------------------------------------------------------
@@ -177,7 +180,7 @@
     public String toString()
     {
         return "[Name: " + name + ", indicator: " + indicator + ", org unit: " +
-            parentOrganisationUnit + ", period: " + period + ", value type: " + mapValueType + "]";
+            parentOrganisationUnit + ", period: " + period + ", value type: " + valueType + "]";
     }
 
     // -------------------------------------------------------------------------
@@ -201,14 +204,14 @@
     @JsonProperty
     @JsonView( {DetailedView.class, ExportView.class} )
     @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
-    public String getMapValueType()
+    public String getValueType()
     {
-        return mapValueType;
+        return valueType;
     }
 
-    public void setMapValueType( String mapValueType )
+    public void setValueType( String valueType )
     {
-        this.mapValueType = mapValueType;
+        this.valueType = valueType;
     }
 
     @JsonProperty
@@ -328,14 +331,14 @@
     @JsonProperty
     @JsonView( {DetailedView.class, ExportView.class} )
     @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
-    public String getMapLegendType()
+    public String getLegendType()
     {
-        return mapLegendType;
+        return legendType;
     }
 
-    public void setMapLegendType( String mapLegendType )
+    public void setLegendType( String legendType )
     {
-        this.mapLegendType = mapLegendType;
+        this.legendType = legendType;
     }
 
     @JsonProperty
@@ -367,19 +370,6 @@
     @JsonProperty
     @JsonView( {DetailedView.class, ExportView.class} )
     @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
-    public String getBounds()
-    {
-        return bounds;
-    }
-
-    public void setBounds( String bounds )
-    {
-        this.bounds = bounds;
-    }
-
-    @JsonProperty
-    @JsonView( {DetailedView.class, ExportView.class} )
-    @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
     public String getColorLow()
     {
         return colorLow;
@@ -407,14 +397,14 @@
     @JsonSerialize( as = BaseIdentifiableObject.class )
     @JsonView( {DetailedView.class, ExportView.class} )
     @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
-    public MapLegendSet getMapLegendSet()
+    public MapLegendSet getLegendSet()
     {
-        return mapLegendSet;
+        return legendSet;
     }
 
-    public void setMapLegendSet( MapLegendSet mapLegendSet )
+    public void setLegendSet( MapLegendSet legendSet )
     {
-        this.mapLegendSet = mapLegendSet;
+        this.legendSet = legendSet;
     }
 
     @JsonProperty
@@ -482,6 +472,33 @@
         this.zoom = zoom;
     }
 
+    @JsonProperty
+    @JsonView( {DetailedView.class, ExportView.class} )
+    @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+    public Integer getOpacity()
+    {
+        return opacity;
+    }
+
+    public void setOpacity( Integer opacity )
+    {
+        this.opacity = opacity;
+    }
+
+    @JsonProperty
+    @JsonSerialize( as = BaseIdentifiableObject.class )
+    @JsonView( {DetailedView.class, ExportView.class} )
+    @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+    public OrganisationUnitGroupSet getOrganisationUnitGroupSet()
+    {
+        return organisationUnitGroupSet;
+    }
+
+    public void setOrganisationUnitGroupSet( OrganisationUnitGroupSet organisationUnitGroupSet )
+    {
+        this.organisationUnitGroupSet = organisationUnitGroupSet;
+    }
+
     @Override
     public void mergeWith( IdentifiableObject other )
     {
@@ -492,7 +509,7 @@
             MapView mapView = (MapView) other;
 
             user = mapView.getUser() == null ? user : mapView.getUser();
-            mapValueType = mapView.getMapValueType() == null ? mapValueType : mapView.getMapValueType();
+            valueType = mapView.getValueType() == null ? valueType : mapView.getValueType();
             indicatorGroup = mapView.getIndicatorGroup() == null ? indicatorGroup : mapView.getIndicatorGroup();
             indicator = mapView.getIndicator() == null ? indicator : mapView.getIndicator();
             dataElementGroup = mapView.getDataElementGroup() == null ? dataElementGroup : mapView.getDataElementGroup();
@@ -501,13 +518,12 @@
             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();
+            legendType = mapView.getLegendType() == null ? legendType : mapView.getLegendType();
             method = mapView.getMethod() == null ? method : mapView.getMethod();
             classes = mapView.getClasses() == null ? classes : mapView.getClasses();
-            bounds = mapView.getBounds() == null ? bounds : mapView.getBounds();
             colorLow = mapView.getColorLow() == null ? colorLow : mapView.getColorLow();
             colorHigh = mapView.getColorHigh() == null ? colorHigh : mapView.getColorHigh();
-            mapLegendSet = mapView.getMapLegendSet() == null ? mapLegendSet : mapView.getMapLegendSet();
+            legendSet = mapView.getLegendSet() == null ? legendSet : mapView.getLegendSet();
             radiusLow = mapView.getRadiusLow() == null ? radiusLow : mapView.getRadiusLow();
             radiusHigh = mapView.getRadiusHigh() == null ? radiusHigh : mapView.getRadiusHigh();
             longitude = mapView.getLongitude() == null ? longitude : mapView.getLongitude();

=== 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 09:03:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2012-10-25 10:22:15 +0000
@@ -441,8 +441,8 @@
         MapLegendSet mapLegendSet = mapLegendSetId != null ? getMapLegendSet( mapLegendSetId ) : null;
 
         addMapView( new MapView( name, user, mapValueType, indicatorGroup, indicator, dataElementGroup, dataElement,
-            periodType, period, parent, level, mapLegendType, method, classes, bounds, colorLow, colorHigh,
-            mapLegendSet, radiusLow, radiusHigh, longitude, latitude, zoom ) );
+            periodType, period, parent, level, mapLegendType, method, classes, colorLow, colorHigh,
+            mapLegendSet, radiusLow, radiusHigh, longitude, latitude, zoom, 1 ) );
     }
 
     public void updateMapView( MapView mapView )
@@ -502,7 +502,7 @@
         mapView.setParentOrganisationUnit( unit );
         mapView.setOrganisationUnitLevel( new OrganisationUnitLevel( level, "" ) );
         mapView.setName( indicator.getName() );
-        mapView.setMapValueType( MappingService.MAP_VALUE_TYPE_INDICATOR );
+        mapView.setValueType( MappingService.MAP_VALUE_TYPE_INDICATOR );
 
         return mapView;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java	2012-10-24 16:19:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java	2012-10-25 10:22:15 +0000
@@ -145,7 +145,7 @@
     {
         for ( MapView mapView : mappingService.getAllMapViews() )
         {
-            if ( mapView.getMapLegendSet() != null && mapView.getMapLegendSet().equals( mapLegendSet ) )
+            if ( mapView.getLegendSet() != null && mapView.getLegendSet().equals( mapLegendSet ) )
             {
                 mappingService.deleteMapView( mapView );
             }

=== 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 08:23:30 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-10-25 10:22:15 +0000
@@ -141,15 +141,13 @@
         executeSql( "ALTER TABLE mapview DROP COLUMN mapsource" );
         executeSql( "ALTER TABLE mapview DROP COLUMN mapsourcetype" );
         executeSql( "ALTER TABLE mapview DROP COLUMN mapdatetype" );
-        executeSql( "DROP TABLE map" );
+        executeSql( "ALTER TABLE mapview RENAME COLUMN mapvaluetype TO valuetype" );
+        executeSql( "ALTER TABLE mapview RENAME COLUMN maplegendtype TO legendtype" );
+        executeSql( "ALTER TABLE mapview RENAME COLUMN maplegendsetid TO legendsetid" );
+        
         executeSql( "DELETE FROM systemsetting WHERE name = 'longitude'" );
         executeSql( "DELETE FROM systemsetting WHERE name = 'latitude'" );
         
-        executeSql( "ALTER TABLE map DROP CONSTRAINT fk_map_organisationunitid" );
-        executeSql( "ALTER TABLE map DROP COLUMN organisationunitid" );
-        executeSql( "ALTER TABLE map DROP COLUMN longitude" );
-        executeSql( "ALTER TABLE map DROP COLUMN latitude" );
-        executeSql( "ALTER TABLE map DROP COLUMN zoom" );
         executeSql( "ALTER TABLE maplayer DROP CONSTRAINT maplayer_mapsource_key" );
         executeSql( "ALTER TABLE maplayer DROP COLUMN mapsource" );
         executeSql( "ALTER TABLE maplayer DROP COLUMN mapsourcetype" );

=== 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 09:03:35 +0000
+++ 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
@@ -15,7 +15,7 @@
 
     <many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_mapview_userid" />
 
-    <property name="mapValueType" />
+    <property name="valueType" />
 
     <many-to-one name="indicatorGroup" class="org.hisp.dhis.indicator.IndicatorGroup" column="indicatorgroupid"
       foreign-key="fk_mapview_indicatorgroupid" />
@@ -40,19 +40,17 @@
     <many-to-one name="organisationUnitLevel" class="org.hisp.dhis.organisationunit.OrganisationUnitLevel"
       column="organisationunitlevelid" foreign-key="fk_mapview_organisationunitlevelid" />
 
-    <property name="mapLegendType" />
+    <property name="legendType" />
 
     <property name="method" />
 
     <property name="classes" />
 
-    <property name="bounds" />
-
     <property name="colorLow" />
 
     <property name="colorHigh" />
 
-    <many-to-one name="mapLegendSet" class="org.hisp.dhis.mapping.MapLegendSet" column="maplegendsetid"
+    <many-to-one name="legendSet" class="org.hisp.dhis.mapping.MapLegendSet" column="legendsetid"
       foreign-key="fk_mapview_maplegendsetid" />
 
     <property name="radiusLow" />
@@ -64,6 +62,11 @@
     <property name="latitude" />
 
     <property name="zoom" />
+    
+    <property name="opacity" />
+
+    <many-to-one name="organisationUnitGroupSet" class="org.hisp.dhis.organisationunit.OrganisationUnitGroupSet" 
+        column="orgunitgroupsetid" foreign-key="fk_mapview_orgunitgroupsetid" />
 
   </class>
 </hibernate-mapping>

=== 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 09:03:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java	2012-10-25 10:22:15 +0000
@@ -267,8 +267,8 @@
     {
         MapView mapView = new MapView( "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 );
+            organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B",
+            mapLegendSet, 5, 20, "1", "1", 1, 1 );
 
         int idA = mappingService.addMapView( mapView );
 
@@ -284,8 +284,8 @@
     {
         MapView mapView = new MapView( "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 );
+            organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B",
+            mapLegendSet, 5, 20, "1", "1", 1, 1 );
 
         int id = mappingService.addMapView( mapView );
 
@@ -301,13 +301,13 @@
     {
         MapView mapView1 = new MapView( "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 );
+            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,
             indicator, dataElementGroup, dataElement, periodType, period,
-            organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B",
-            mapLegendSet, 5, 20, "2", "2", 1 );
+            organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B",
+            mapLegendSet, 5, 20, "2", "2", 1, 1 );
 
         mappingService.addMapView( mapView1 );
         mappingService.addMapView( mapView2 );
@@ -322,18 +322,18 @@
     {
         MapView mapView1 = new MapView( "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 );
+            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,
             indicator, dataElementGroup, dataElement, periodType, period,
-            organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B",
-            mapLegendSet, 5, 20, "2", "2", 1 );
+            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,
             indicator, dataElementGroup, dataElement, periodType, period,
-            organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B",
-            mapLegendSet, 5, 20, "3", "3", 1 );
+            organisationUnit, organisationUnitLevel, MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "A", "B",
+            mapLegendSet, 5, 20, "3", "3", 1, 1 );
 
         mappingService.addMapView( mapView1 );
         mappingService.addMapView( mapView2 );

=== modified file 'dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java'
--- dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java	2012-02-11 14:22:20 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java	2012-10-25 10:22:15 +0000
@@ -126,9 +126,9 @@
     private InternalMapLayer buildSingleInternalMapLayer( MapView mapView )
     {
         Assert.isTrue( mapView != null );
-        Assert.isTrue( mapView.getMapValueType() != null );
+        Assert.isTrue( mapView.getValueType() != null );
 
-        boolean isIndicator = MappingService.MAP_VALUE_TYPE_INDICATOR.equals( mapView.getMapValueType() );
+        boolean isIndicator = MappingService.MAP_VALUE_TYPE_INDICATOR.equals( mapView.getValueType() );
 
         Collection<AggregatedMapValue> mapValues;