dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17050
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6662: Applied caching to GIS. Coordinates has validation cache, returning 304 if not modified. Values h...
------------------------------------------------------------
revno: 6662
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-04-20 11:52:17 +0200
message:
Applied caching to GIS. Coordinates has validation cache, returning 304 if not modified. Values has expiry cache according to the cache system setting.
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapLegendAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesAction.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/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
--
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-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapLegendAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapLegendAction.java 2011-11-10 20:57:29 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapLegendAction.java 2012-04-20 09:52:17 +0000
@@ -36,11 +36,11 @@
public String execute()
{
- MapLegend mapLegend = this.mappingService.getMapLegend( this.id.intValue() );
+ MapLegend mapLegend = mappingService.getMapLegend( id.intValue() );
if ( mapLegend != null )
{
- this.mappingService.deleteMapLegend( mapLegend );
+ mappingService.deleteMapLegend( mapLegend );
}
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetDataElementMapValuesAction.java 2012-04-20 09:52:17 +0000
@@ -27,9 +27,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.api.utils.ContextUtils.CONTENT_TYPE_JSON;
+
import java.util.Collection;
+import org.apache.struts2.ServletActionContext;
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.mapping.MappingService;
import com.opensymphony.xwork2.Action;
@@ -52,6 +57,13 @@
this.mappingService = mappingService;
}
+ private ContextUtils contextUtils;
+
+ public void setContextUtils( ContextUtils contextUtils )
+ {
+ this.contextUtils = contextUtils;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -103,6 +115,8 @@
throws Exception
{
object = mappingService.getDataElementMapValues( id, periodId, parentId, level );
+
+ contextUtils.configureResponse( ServletActionContext.getResponse(), CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING, null, false );
return SUCCESS;
}
=== 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-02-08 15:15:18 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java 2012-04-20 09:52:17 +0000
@@ -30,11 +30,13 @@
import java.util.ArrayList;
import java.util.Collection;
+import org.apache.struts2.ServletActionContext;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.system.filter.OrganisationUnitWithCoordinatesFilter;
import org.hisp.dhis.system.filter.OrganisationUnitWithValidPointCoordinateFilter;
import org.hisp.dhis.system.util.FilterUtils;
+import org.hisp.dhis.util.ContextUtils;
import com.opensymphony.xwork2.Action;
@@ -121,6 +123,8 @@
}
}
+ ContextUtils.clearIfNotModified( ServletActionContext.getRequest(), ServletActionContext.getResponse(), object );
+
return SUCCESS;
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java 2012-04-20 09:52:17 +0000
@@ -29,11 +29,15 @@
import java.util.Collection;
+import org.apache.struts2.ServletActionContext;
import org.hisp.dhis.aggregation.AggregatedMapValue;
+import org.hisp.dhis.api.utils.ContextUtils;
import org.hisp.dhis.mapping.MappingService;
import com.opensymphony.xwork2.Action;
+import static org.hisp.dhis.api.utils.ContextUtils.*;
+
/**
* @author Jan Henrik Overland
* @version $Id$
@@ -51,6 +55,13 @@
{
this.mappingService = mappingService;
}
+
+ private ContextUtils contextUtils;
+
+ public void setContextUtils( ContextUtils contextUtils )
+ {
+ this.contextUtils = contextUtils;
+ }
// -------------------------------------------------------------------------
// Input
@@ -104,6 +115,8 @@
{
object = mappingService.getIndicatorMapValues( id, periodId, parentId, level );
+ contextUtils.configureResponse( ServletActionContext.getResponse(), CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING, null, false );
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2012-04-19 16:30:39 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2012-04-20 09:52:17 +0000
@@ -92,11 +92,13 @@
<bean id="org.hisp.dhis.mapping.action.GetIndicatorMapValuesAction"
class="org.hisp.dhis.mapping.action.GetIndicatorMapValuesAction" scope="prototype">
<property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+ <property name="contextUtils" ref="contextUtils" />
</bean>
<bean id="org.hisp.dhis.mapping.action.GetDataElementMapValuesAction"
class="org.hisp.dhis.mapping.action.GetDataElementMapValuesAction" scope="prototype">
<property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+ <property name="contextUtils" ref="contextUtils" />
</bean>
<bean id="org.hisp.dhis.mapping.action.GetInfrastructuralDataElementMapValuesAction"