dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19914
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8889: GIS, impl caching for geojson and data requests
------------------------------------------------------------
revno: 8889
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-11-05 22:23:01 +0300
message:
GIS, impl caching for geojson and data requests
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapValueController.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic1.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic2.js
--
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/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2012-10-24 20:50:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2012-11-05 19:23:01 +0000
@@ -652,13 +652,13 @@
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public MapLegendSet getLegendSet()
{
- return legendSet;
- }
+ return legendSet;
+ }
- public void setLegendSet( MapLegendSet legendSet )
- {
- this.legendSet = legendSet;
- }
+ public void setLegendSet( MapLegendSet legendSet )
+ {
+ this.legendSet = legendSet;
+ }
@Override
public void mergeWith( IdentifiableObject other )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2012-10-24 20:50:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2012-11-05 19:23:01 +0000
@@ -367,15 +367,15 @@
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public MapLegendSet getLegendSet()
{
- return legendSet;
- }
-
- public void setLegendSet( MapLegendSet legendSet )
- {
- this.legendSet = legendSet;
- }
-
- @Override
+ return legendSet;
+ }
+
+ public void setLegendSet( MapLegendSet legendSet )
+ {
+ this.legendSet = legendSet;
+ }
+
+ @Override
public void mergeWith( IdentifiableObject other )
{
super.mergeWith( other );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java 2012-11-03 20:54:57 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java 2012-11-05 19:23:01 +0000
@@ -43,7 +43,6 @@
import org.hisp.dhis.interpretation.Interpretation;
import org.hisp.dhis.interpretation.InterpretationService;
import org.hisp.dhis.mapping.Map;
-import org.hisp.dhis.mapping.MapView;
import org.hisp.dhis.mapping.MappingService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapValueController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapValueController.java 2012-10-31 12:40:43 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapValueController.java 2012-11-05 19:23:01 +0000
@@ -33,6 +33,7 @@
import org.hisp.dhis.aggregation.AggregatedMapValue;
import org.hisp.dhis.api.utils.ContextUtils;
+import org.hisp.dhis.api.utils.ContextUtils.CacheStrategy;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.indicator.Indicator;
@@ -75,6 +76,9 @@
@Autowired
private OrganisationUnitService organisationUnitService;
+ @Autowired
+ private ContextUtils contextUtils;
+
@RequestMapping( value = "/in", method = RequestMethod.GET )
public String getIndicatorMapValues(
@RequestParam String in,
@@ -122,6 +126,8 @@
model.addAttribute( "model", mapValues );
+ contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
+
return "mapValues";
}
@@ -171,6 +177,8 @@
Collection<AggregatedMapValue> mapValues = mappingService.getDataElementMapValues( dataElement.getId(), period.getId(), organisationUnit.getId(), level.getLevel() );
model.addAttribute( "model", mapValues );
+
+ contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
return "mapValues";
}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java 2012-10-31 12:40:43 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java 2012-11-05 19:23:01 +0000
@@ -98,8 +98,6 @@
// Action implementation
// -------------------------------------------------------------------------
-
-
public String execute()
throws Exception
{
@@ -128,23 +126,25 @@
FilterUtils.filter( organisationUnits, new OrganisationUnitWithValidCoordinatesFilter() );
boolean modified = !clearIfNotModified( ServletActionContext.getRequest(), ServletActionContext.getResponse(), organisationUnits );
-
- if ( modified )
- {
- for ( OrganisationUnit unit : organisationUnits )
+
+ if ( !modified )
+ {
+ return SUCCESS;
+ }
+
+ for ( OrganisationUnit unit : organisationUnits )
+ {
+ if ( !unit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) )
{
- if ( !unit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) )
- {
- object.add( unit );
- }
+ object.add( unit );
}
-
- for ( OrganisationUnit unit : organisationUnits )
+ }
+
+ for ( OrganisationUnit unit : organisationUnits )
+ {
+ if ( unit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) )
{
- if ( unit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) )
- {
- object.add( unit );
- }
+ object.add( unit );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js 2012-11-05 09:24:07 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js 2012-11-05 19:23:01 +0000
@@ -554,6 +554,7 @@
level: this.tmpView.organisationUnitLevel.id
},
scope: this,
+ disableCaching: false,
success: function(r) {
var geojson = GIS.util.geojson.decode(r.responseText, this),
format = new OpenLayers.Format.GeoJSON(),
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js 2012-11-05 09:24:07 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js 2012-11-05 19:23:01 +0000
@@ -830,6 +830,7 @@
level: this.tmpView.organisationUnitLevel.id
},
scope: this,
+ disableCaching: false,
success: function(r) {
var geojson = this.decode(r.responseText),
format = new OpenLayers.Format.GeoJSON(),
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic1.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic1.js 2012-11-05 09:24:07 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic1.js 2012-11-05 19:23:01 +0000
@@ -1613,6 +1613,7 @@
level: this.tmpView.organisationUnitLevel.id
},
scope: this,
+ disableCaching: false,
success: function(r) {
var geojson = GIS.util.geojson.decode(r.responseText, this),
format = new OpenLayers.Format.GeoJSON(),
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic2.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic2.js 2012-11-05 09:24:07 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic2.js 2012-11-05 19:23:01 +0000
@@ -1613,6 +1613,7 @@
level: this.tmpView.organisationUnitLevel.id
},
scope: this,
+ disableCaching: false,
success: function(r) {
var geojson = GIS.util.geojson.decode(r.responseText, this),
format = new OpenLayers.Format.GeoJSON(),