← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19692: Externalized CacheStrategy and added Cacheable interface plus implementation thereof in Cacheable...

 

Merge authors:
  Halvdan Hoem Grelland (halvdanhg)
------------------------------------------------------------
revno: 19692 [merge]
committer: Halvdan Hoem Grelland <halvdanhg@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-07-31 14:37:41 +0200
message:
  Externalized CacheStrategy and added Cacheable interface plus implementation thereof in CacheableBaseIdentifiableObject. Made Report and SqlView extends Cacheable, allowing web request caching to be set on a per object basis. Also made changes in Report and SqlView web UIs to set the cacheStrategy property on object creation or update. Any other object which should have the option of detailed cache control can extend CacheableBaseIdentifiableObject or implement Cacheable, as well as making sure the CacheStrategy is honored in the respective controllers.
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/CacheStrategy.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/Cacheable.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/CacheableBaseIdentifiableObject.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java
  dhis-2/dhis-services/dhis-service-administration/src/main/resources/org/hisp/dhis/sqlview/hibernate/SqlView.hbm.xml
  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/i18n_global.properties
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/report/hibernate/Report.hbm.xml
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DocumentController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FileController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FilteredMetaDataController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MetaDataController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SqlViewController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SvgConversionController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityInstanceController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapViewController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/GetMessageRecipientsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/AddSqlViewAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/UpdateSqlViewAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addSqlViewForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateSqlViewForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/AddReportAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ExportTableAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addReportForm.vm


--
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
=== added directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache'
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/CacheStrategy.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/CacheStrategy.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/CacheStrategy.java	2015-07-31 11:29:52 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.common.cache;
+
+/*
+ * Copyright (c) 2004-2015, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * CacheStrategies express web request caching settings.
+ * Note that {@link #RESPECT_SYSTEM_SETTING} should only be used on a
+ * per-object-basis (i.e. never as a system wide setting, for obvious reasons).
+ *
+ * @author Halvdan Hoem Grelland
+ */
+public enum CacheStrategy
+{
+    NO_CACHE,
+    CACHE_1_HOUR,
+    CACHE_6AM_TOMORROW,
+    CACHE_TWO_WEEKS,
+    RESPECT_SYSTEM_SETTING
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/Cacheable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/Cacheable.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/Cacheable.java	2015-07-31 11:45:17 +0000
@@ -0,0 +1,47 @@
+package org.hisp.dhis.common.cache;
+
+/*
+ * Copyright (c) 2004-2015, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Inheritors of this interface gain the cacheStrategy property which allows
+ * specifically setting and persisting the CacheStrategy for that particular object.
+ * The chosen CacheStrategy should be honored on a per-object-basis for any Cacheable
+ * and will ultimately decide the cache parameters of any web request returning the object.
+ *
+ * @author Halvdan Hoem Grelland
+ */
+public interface Cacheable
+{
+    /**
+     * Returns the CacheStrategy for this Cacheable. Should never return null.
+     *
+     * @return the CacheStrategy of this object.
+     */
+    CacheStrategy getCacheStrategy();
+}

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/CacheableBaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/CacheableBaseIdentifiableObject.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/cache/CacheableBaseIdentifiableObject.java	2015-07-31 11:45:17 +0000
@@ -0,0 +1,57 @@
+package org.hisp.dhis.common.cache;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.MergeStrategy;
+import org.hisp.dhis.common.view.DetailedView;
+import org.hisp.dhis.common.view.ExportView;
+
+/**
+ * @author Halvdan Hoem Grelland
+ */
+public class CacheableBaseIdentifiableObject
+    extends BaseIdentifiableObject
+    implements Cacheable
+{
+    public static final CacheStrategy DEFAULT_CACHE_STRATEGY = CacheStrategy.RESPECT_SYSTEM_SETTING;
+
+    private CacheStrategy cacheStrategy = CacheStrategy.RESPECT_SYSTEM_SETTING;
+
+    public void setCacheStrategy( CacheStrategy cacheStrategy )
+    {
+        this.cacheStrategy = cacheStrategy;
+    }
+
+    @Override
+    public void mergeWith( IdentifiableObject other, MergeStrategy strategy )
+    {
+        super.mergeWith( other, strategy );
+
+        if ( other.getClass().isInstance( this ) )
+        {
+            Cacheable cacheable = (Cacheable) other;
+
+            if ( strategy.isReplace() )
+            {
+                cacheStrategy = cacheable.getCacheStrategy();
+            }
+            else if ( strategy.isMerge() )
+            {
+                cacheStrategy = cacheable.getCacheStrategy() == null ? cacheStrategy : cacheable.getCacheStrategy();
+            }
+        }
+    }
+
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @Override
+    public CacheStrategy getCacheStrategy()
+    {
+        return cacheStrategy;
+    }
+}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java	2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java	2015-07-31 11:45:17 +0000
@@ -37,6 +37,7 @@
 import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.MergeStrategy;
+import org.hisp.dhis.common.cache.CacheableBaseIdentifiableObject;
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.period.RelativePeriods;
@@ -48,7 +49,7 @@
  */
 @JacksonXmlRootElement( localName = "report", namespace = DxfNamespaces.DXF_2_0 )
 public class Report
-    extends BaseIdentifiableObject
+    extends CacheableBaseIdentifiableObject
 {
     private static final long serialVersionUID = 7880117720157807526L;
 
@@ -225,6 +226,7 @@
             {
                 designContent = report.getDesignContent() == null ? designContent : report.getDesignContent();
                 reportTable = report.getReportTable() == null ? reportTable : report.getReportTable();
+
             }
         }
     }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java	2015-07-14 14:50:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java	2015-07-31 11:45:17 +0000
@@ -28,38 +28,37 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
-
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import com.google.common.collect.Sets;
 import org.apache.commons.lang3.StringUtils;
-import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.MergeStrategy;
+import org.hisp.dhis.common.cache.CacheableBaseIdentifiableObject;
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.schema.annotation.PropertyRange;
 
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-import com.google.common.collect.Sets;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
 
 /**
  * @author Dang Duy Hieu
  */
 @JacksonXmlRootElement( localName = "sqlView", namespace = DxfNamespaces.DXF_2_0 )
 public class SqlView
-    extends BaseIdentifiableObject
+    extends CacheableBaseIdentifiableObject
 {
     public static final String PREFIX_VIEWNAME = "_view";
 
     public static final Set<String> PROTECTED_TABLES = Sets.newHashSet( "users", "userinfo", 
         "trackedentityattribute", "trackedentityattributevalue" );
-    
+
     public static final Set<String> ILLEGAL_KEYWORDS = Sets.newHashSet( "delete", "alter", "update", 
         "create", "drop", "commit", "createdb", "createuser", "insert", "rename", "replace", "restore", "write" );
 

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/resources/org/hisp/dhis/sqlview/hibernate/SqlView.hbm.xml'
--- dhis-2/dhis-services/dhis-service-administration/src/main/resources/org/hisp/dhis/sqlview/hibernate/SqlView.hbm.xml	2015-03-10 11:36:58 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/resources/org/hisp/dhis/sqlview/hibernate/SqlView.hbm.xml	2015-07-21 16:46:52 +0000
@@ -20,11 +20,18 @@
     <property name="sqlQuery" not-null="true" type="text" />
     
     <property name="type" length="40">
-		<type name="org.hibernate.type.EnumType">
-			<param name="enumClass">org.hisp.dhis.sqlview.SqlViewType</param>
-			<param name="type">12</param>
-		</type> 
-	</property>
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.sqlview.SqlViewType</param>
+        <param name="type">12</param>
+      </type>
+    </property>
+
+    <property name="cacheStrategy" length="40">
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.common.cache.CacheStrategy</param>
+        <param name="type">12</param>
+      </type>
+    </property>
 
     <!-- Access properties -->
     <property name="externalAccess" />

=== 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	2015-07-07 14:54:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-07-31 12:31:12 +0000
@@ -826,6 +826,10 @@
         executeSql( "alter table version alter column versionkey set not null" );
         executeSql( "alter table version add constraint version_versionkey_key unique(versionkey)" );
 
+        // Cacheable
+        executeSql( "UPDATE report set cachestrategy='RESPECT_SYSTEM_SETTING' where cachestrategy is null" );
+        executeSql( "UPDATE sqlview set cachestrategy='RESPECT_SYSTEM_SETTING' where cachestrategy is null" );
+
         oauth2();
 
         upgradeDataValuesWithAttributeOptionCombo();

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties	2015-07-22 05:41:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties	2015-07-31 10:03:58 +0000
@@ -990,3 +990,12 @@
 email_invite_2_1st_paragraph_after_application_title=user account.
 email_invite_2_2nd_paragraph=You have been sent two emails, where this is the second one. Please read the first email and follow the instructions. Please use the code below to complete the new account form.
 email_invite_2_3rd_paragraph=You must respond to this invitation within 3 months. If you take no action, the invitation will expire at that time.
+
+#-- Cache strategy display strings -------------------------------------------------------------#
+
+cache_strategy=Cache strategy
+respect_system_setting=Respect system setting
+no_cache=No cache
+cache_until_6am_tomorrow=Cache until 6 AM tomorrow
+cache_for_two_weeks=Cache for two weeks
+cache_for_one_hour=Cache for one hour
\ No newline at end of file

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/report/hibernate/Report.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/report/hibernate/Report.hbm.xml	2013-08-23 20:59:09 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/report/hibernate/Report.hbm.xml	2015-07-21 16:46:52 +0000
@@ -32,6 +32,13 @@
       <property name="paramOrganisationUnit" />
     </component>
 
+    <property name="cacheStrategy" length="40">
+      <type name="org.hibernate.type.EnumType">
+        <param name="enumClass">org.hisp.dhis.common.cache.CacheStrategy</param>
+        <param name="type">12</param>
+      </type>
+    </property>
+
     <!-- Access properties -->
     <property name="externalAccess" />
 

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2015-07-10 21:08:24 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2015-07-21 14:07:09 +0000
@@ -53,6 +53,7 @@
 import org.hisp.dhis.chart.Chart;
 import org.hisp.dhis.common.CodeGenerator;
 import org.hisp.dhis.common.DimensionalObject;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.constant.Constant;
 import org.hisp.dhis.dataelement.CategoryOptionGroup;
 import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
@@ -1414,6 +1415,7 @@
         sqlView.setDescription( "Description" + uniqueCharacter );
         sqlView.setSqlQuery( sql );
         sqlView.setType( SqlViewType.VIEW );
+        sqlView.setCacheStrategy( CacheStrategy.RESPECT_SYSTEM_SETTING );
 
         return sqlView;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java	2015-07-10 19:12:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java	2015-07-21 13:47:18 +0000
@@ -44,7 +44,7 @@
 import org.hisp.dhis.i18n.I18nManager;
 import org.hisp.dhis.system.grid.GridUtils;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java	2015-07-13 15:28:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java	2015-07-21 13:47:18 +0000
@@ -59,7 +59,7 @@
 import org.hisp.dhis.schema.descriptors.ChartSchemaDescriptor;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.jfree.chart.ChartUtilities;
 import org.jfree.chart.JFreeChart;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DocumentController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DocumentController.java	2015-07-09 06:44:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DocumentController.java	2015-07-15 15:49:39 +0000
@@ -36,7 +36,7 @@
 import org.hisp.dhis.external.location.LocationManagerException;
 import org.hisp.dhis.schema.descriptors.DocumentSchemaDescriptor;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java	2015-07-10 19:12:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java	2015-07-21 13:47:18 +0000
@@ -45,7 +45,7 @@
 import org.hisp.dhis.i18n.I18nManager;
 import org.hisp.dhis.system.grid.GridUtils;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FileController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FileController.java	2015-07-10 03:07:16 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FileController.java	2015-07-15 15:49:39 +0000
@@ -32,7 +32,7 @@
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.webapi.service.WebMessageService;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FilteredMetaDataController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FilteredMetaDataController.java	2015-07-14 07:33:21 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/FilteredMetaDataController.java	2015-07-15 15:49:39 +0000
@@ -45,6 +45,7 @@
 import org.hisp.dhis.system.scheduling.Scheduler;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.user.User;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.ContextUtils;
 import org.hisp.dhis.webapi.webdomain.WebOptions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -133,7 +134,7 @@
         FilterOptions filterOptions = new FilterOptions( JSONObject.fromObject( exportJsonValue ) );
         MetaData metaData = exportService.getFilteredMetaData( filterOptions );
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, ContextUtils.CacheStrategy.NO_CACHE, "metaData.xml", true );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.NO_CACHE, "metaData.xml", true );
         JacksonUtils.toXmlWithView( response.getOutputStream(), metaData, ExportView.class );
     }
 
@@ -144,7 +145,7 @@
         FilterOptions filterOptions = new FilterOptions( JSONObject.fromObject( exportJsonValue ) );
         MetaData metaData = exportService.getFilteredMetaData( filterOptions );
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, ContextUtils.CacheStrategy.NO_CACHE, "metaData.json", true );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.NO_CACHE, "metaData.json", true );
         JacksonUtils.toJsonWithView( response.getOutputStream(), metaData, ExportView.class );
     }
 
@@ -155,7 +156,7 @@
         FilterOptions filterOptions = new FilterOptions( JSONObject.fromObject( exportJsonValue ) );
         MetaData metaData = exportService.getFilteredMetaData( filterOptions );
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_ZIP, ContextUtils.CacheStrategy.NO_CACHE, "metaData.xml.zip", true );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_ZIP, CacheStrategy.NO_CACHE, "metaData.xml.zip", true );
         response.addHeader( ContextUtils.HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
 
         ZipOutputStream zip = new ZipOutputStream( response.getOutputStream() );
@@ -171,7 +172,7 @@
         FilterOptions filterOptions = new FilterOptions( JSONObject.fromObject( exportJsonValue ) );
         MetaData metaData = exportService.getFilteredMetaData( filterOptions );
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_ZIP, ContextUtils.CacheStrategy.NO_CACHE, "metaData.json.zip", true );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_ZIP, CacheStrategy.NO_CACHE, "metaData.json.zip", true );
         response.addHeader( ContextUtils.HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
 
         ZipOutputStream zip = new ZipOutputStream( response.getOutputStream() );
@@ -187,7 +188,7 @@
         FilterOptions filterOptions = new FilterOptions( JSONObject.fromObject( exportJsonValue ) );
         MetaData metaData = exportService.getFilteredMetaData( filterOptions );
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_GZIP, ContextUtils.CacheStrategy.NO_CACHE, "metaData.xml.gz", true );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_GZIP, CacheStrategy.NO_CACHE, "metaData.xml.gz", true );
         response.addHeader( ContextUtils.HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
 
         GZIPOutputStream gzip = new GZIPOutputStream( response.getOutputStream() );
@@ -201,7 +202,7 @@
         FilterOptions filterOptions = new FilterOptions( JSONObject.fromObject( exportJsonValue ) );
         MetaData metaData = exportService.getFilteredMetaData( filterOptions );
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_GZIP, ContextUtils.CacheStrategy.NO_CACHE, "metaData.json.gz", true );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_GZIP, CacheStrategy.NO_CACHE, "metaData.json.gz", true );
         response.addHeader( ContextUtils.HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
 
         GZIPOutputStream gzip = new GZIPOutputStream( response.getOutputStream() );
@@ -217,7 +218,7 @@
     public @ResponseBody String getFilters( HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
         List<MetaDataFilter> metaDataFilters = exportService.getFilters();
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, ContextUtils.CacheStrategy.NO_CACHE );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.NO_CACHE );
         return JacksonUtils.toJsonAsString( metaDataFilters );
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MetaDataController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MetaDataController.java	2015-07-08 05:42:56 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MetaDataController.java	2015-07-15 15:49:39 +0000
@@ -41,7 +41,7 @@
 import org.hisp.dhis.system.scheduling.Scheduler;
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.webdomain.WebOptions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java	2015-07-10 04:20:57 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java	2015-07-15 15:49:39 +0000
@@ -50,7 +50,7 @@
 import org.hisp.dhis.user.CurrentUserService;
 import org.hisp.dhis.webapi.service.WebMessageService;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.PdfDataEntryFormImportUtil;
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.springframework.beans.factory.annotation.Autowired;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportController.java	2015-07-08 07:18:13 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportController.java	2015-07-15 16:07:15 +0000
@@ -43,7 +43,7 @@
 import org.hisp.dhis.report.ReportService;
 import org.hisp.dhis.schema.descriptors.ReportSchemaDescriptor;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -204,7 +204,7 @@
 
         if ( report.isTypeHtml() )
         {
-            contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
+            contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, report.getCacheStrategy() );
 
             reportService.renderHtmlReport( response.getWriter(), uid, date, organisationUnitUid, format );
         }
@@ -216,7 +216,7 @@
 
             String filename = CodecUtils.filenameEncode( report.getName() ) + "." + type;
 
-            contextUtils.configureResponse( response, contentType, CacheStrategy.RESPECT_SYSTEM_SETTING, filename, attachment );
+            contextUtils.configureResponse( response, contentType, report.getCacheStrategy(), filename, attachment );
 
             JasperPrint print = reportService.renderReport( response.getOutputStream(), uid, period, organisationUnitUid, type, format );
 

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java	2015-07-13 15:28:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java	2015-07-21 13:47:18 +0000
@@ -45,7 +45,7 @@
 import org.hisp.dhis.schema.descriptors.ReportTableSchemaDescriptor;
 import org.hisp.dhis.system.grid.GridUtils;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SqlViewController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SqlViewController.java	2015-07-14 14:50:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SqlViewController.java	2015-07-15 16:07:15 +0000
@@ -36,7 +36,6 @@
 import org.hisp.dhis.sqlview.SqlViewService;
 import org.hisp.dhis.system.grid.GridUtils;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -82,7 +81,7 @@
         model.addAttribute( "model", grid );
         model.addAttribute( "viewClass", "detailed" );
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, sqlView.getCacheStrategy() );
 
         return grid != null ? "sqlView" : null;
     }
@@ -101,7 +100,7 @@
 
         Grid grid = sqlViewService.getSqlViewGrid( sqlView, SqlView.getCriteria( criteria ), SqlView.getCriteria( var ) );
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, sqlView.getCacheStrategy() );
 
         GridUtils.toXml( grid, response.getOutputStream() );
     }
@@ -122,7 +121,7 @@
 
         String filename = CodecUtils.filenameEncode( grid.getTitle() ) + ".csv";
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, filename, true );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, sqlView.getCacheStrategy(), filename, true );
 
         GridUtils.toCsv( grid, response.getWriter() );
     }
@@ -143,7 +142,7 @@
 
         String filename = CodecUtils.filenameEncode( grid.getTitle() ) + ".xls";
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, filename, true );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, sqlView.getCacheStrategy(), filename, true );
 
         GridUtils.toXls( grid, response.getOutputStream() );
     }
@@ -162,7 +161,7 @@
 
         Grid grid = sqlViewService.getSqlViewGrid( sqlView, SqlView.getCriteria( criteria ), SqlView.getCriteria( var ) );
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, sqlView.getCacheStrategy() );
 
         GridUtils.toHtml( grid, response.getWriter() );
     }
@@ -181,7 +180,7 @@
 
         Grid grid = sqlViewService.getSqlViewGrid( sqlView, SqlView.getCriteria( criteria ), SqlView.getCriteria( var ) );
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, sqlView.getCacheStrategy() );
 
         GridUtils.toHtmlCss( grid, response.getWriter() );
     }
@@ -200,7 +199,7 @@
 
         Grid grid = sqlViewService.getSqlViewGrid( sqlView, SqlView.getCriteria( criteria ), SqlView.getCriteria( var ) );
 
-        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, CacheStrategy.RESPECT_SYSTEM_SETTING );
+        contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, sqlView.getCacheStrategy() );
 
         GridUtils.toPdf( grid, response.getOutputStream() );
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SvgConversionController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SvgConversionController.java	2015-07-08 05:42:56 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SvgConversionController.java	2015-07-15 15:49:39 +0000
@@ -36,7 +36,7 @@
 import org.apache.fop.svg.PDFTranscoder;
 import org.hisp.dhis.commons.util.CodecUtils;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java	2015-07-08 08:21:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java	2015-07-15 15:49:39 +0000
@@ -46,7 +46,7 @@
 import org.hisp.dhis.schema.descriptors.EventChartSchemaDescriptor;
 import org.hisp.dhis.webapi.controller.AbstractCrudController;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.jfree.chart.ChartUtilities;
 import org.jfree.chart.JFreeChart;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityInstanceController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityInstanceController.java	2015-07-08 04:33:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityInstanceController.java	2015-07-15 15:49:39 +0000
@@ -52,7 +52,7 @@
 import org.hisp.dhis.webapi.service.ContextService;
 import org.hisp.dhis.webapi.service.WebMessageService;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java	2015-07-08 08:27:27 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java	2015-07-15 15:49:39 +0000
@@ -48,7 +48,7 @@
 import org.hisp.dhis.user.UserService;
 import org.hisp.dhis.webapi.controller.AbstractCrudController;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapViewController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapViewController.java	2015-07-08 08:27:27 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapViewController.java	2015-07-15 15:49:39 +0000
@@ -39,7 +39,7 @@
 import org.hisp.dhis.schema.descriptors.MapViewSchemaDescriptor;
 import org.hisp.dhis.webapi.controller.AbstractCrudController;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.WebMessageUtils;
 import org.hisp.dhis.webapi.webdomain.WebMetaData;
 import org.hisp.dhis.webapi.webdomain.WebOptions;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java	2015-07-15 09:45:45 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java	2015-07-15 15:49:39 +0000
@@ -65,7 +65,7 @@
 import org.hisp.dhis.webapi.controller.exception.NotAuthenticatedException;
 import org.hisp.dhis.webapi.service.ContextService;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.webapi.utils.FormUtils;
 import org.hisp.dhis.webapi.webdomain.FormDataSet;
 import org.hisp.dhis.webapi.webdomain.FormOrganisationUnit;
@@ -92,7 +92,6 @@
 import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java	2015-07-13 03:22:44 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java	2015-07-15 15:49:39 +0000
@@ -32,6 +32,7 @@
 import org.hisp.dhis.common.DimensionalObjectUtils;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.IdentifiableObjectUtils;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.commons.util.CodecUtils;
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.system.util.DateUtils;
@@ -90,15 +91,6 @@
     @Autowired
     private SystemSettingManager systemSettingManager;
 
-    public enum CacheStrategy
-    {
-        NO_CACHE,
-        CACHE_1_HOUR,
-        CACHE_6AM_TOMORROW,
-        CACHE_TWO_WEEKS,
-        RESPECT_SYSTEM_SETTING
-    }
-
     public void configureResponse( HttpServletResponse response, String contentType, CacheStrategy cacheStrategy )
     {
         configureResponse( response, contentType, cacheStrategy, null, false );

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/GetMessageRecipientsAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/GetMessageRecipientsAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/GetMessageRecipientsAction.java	2015-07-15 15:49:39 +0000
@@ -35,7 +35,7 @@
 import org.apache.commons.lang3.StringUtils;
 import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserGroup;
 import org.hisp.dhis.user.UserGroupService;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/AddSqlViewAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/AddSqlViewAction.java	2015-03-10 11:36:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/AddSqlViewAction.java	2015-07-31 10:51:43 +0000
@@ -28,6 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.lang3.EnumUtils;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.sqlview.SqlView;
 import org.hisp.dhis.sqlview.SqlViewService;
 import org.hisp.dhis.sqlview.SqlViewType;
@@ -83,6 +85,13 @@
         this.type = type;
     }
 
+    private String cacheStrategy;
+
+    public void setCacheStrategy( String cacheStrategy )
+    {
+        this.cacheStrategy = cacheStrategy;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -97,6 +106,16 @@
         sqlView.setSqlQuery( sqlquery );
         sqlView.setType( SqlViewType.valueOf( type ) );
 
+        if ( cacheStrategy != null )
+        {
+            CacheStrategy strategy = EnumUtils.getEnum( CacheStrategy.class, cacheStrategy );
+            sqlView.setCacheStrategy( strategy != null ? strategy : SqlView.DEFAULT_CACHE_STRATEGY );
+        }
+        else
+        {
+            sqlView.setCacheStrategy( SqlView.DEFAULT_CACHE_STRATEGY );
+        }
+
         sqlViewService.saveSqlView( sqlView.cleanSqlQuery() );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/UpdateSqlViewAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/UpdateSqlViewAction.java	2015-02-12 09:51:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/UpdateSqlViewAction.java	2015-07-31 10:51:43 +0000
@@ -29,6 +29,8 @@
  */
 
 import com.opensymphony.xwork2.Action;
+import org.apache.commons.lang3.EnumUtils;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.sqlview.SqlView;
 import org.hisp.dhis.sqlview.SqlViewService;
 
@@ -76,6 +78,13 @@
         this.sqlquery = sqlquery;
     }
 
+    private String cacheStrategy;
+
+    public void setCacheStrategy( String cacheStrategy )
+    {
+        this.cacheStrategy = cacheStrategy;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -88,6 +97,12 @@
         sqlView.setDescription( description.replaceAll( "\\s+", " " ).trim() );
         sqlView.setSqlQuery( sqlquery );
 
+        if ( cacheStrategy != null )
+        {
+            CacheStrategy strategy = EnumUtils.getEnum( CacheStrategy.class, cacheStrategy );
+            sqlView.setCacheStrategy( strategy != null ? strategy : SqlView.DEFAULT_CACHE_STRATEGY );
+        }
+
         sqlViewService.updateSqlView( sqlView.cleanSqlQuery() );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2015-07-14 14:50:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2015-07-31 10:03:58 +0000
@@ -387,4 +387,3 @@
 user_account_invitations=User account invitations
 pending_invitations=Pending invitations
 expired_invitations=Expired invitations
-refresh=Refresh
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addSqlViewForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addSqlViewForm.vm	2015-06-12 08:51:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addSqlViewForm.vm	2015-07-31 10:51:43 +0000
@@ -32,6 +32,18 @@
 			<td><textarea type="text" id="sqlquery" name="sqlquery" style="width:80em;height:20em">select </textarea></td>
 		</tr>
 		<tr>
+			<td><label>$encoder.htmlEncode( $i18n.getString( "cache_strategy" ) )</label></td>
+			<td>
+				<select id="cacheStrategy" name="cacheStrategy">
+					<option value="RESPECT_SYSTEM_SETTING" selected="selected">$i18n.getString( "respect_system_setting" )</option>
+					<option value="NO_CACHE">$i18n.getString( "no_cache" )</option>
+					<option value="CACHE_1_HOUR">$i18n.getString( "cache_for_one_hour" )</option>
+					<option value="CACHE_6AM_TOMORROW">$i18n.getString( "cache_until_6am_tomorrow" )</option>
+					<option value="CACHE_TWO_WEEKS">$i18n.getString( "cache_for_two_weeks" )</option>
+				</select>
+			</td>
+		</tr>
+		<tr>
 			<td></td>
 			<td>
 				<input type="submit" value="$i18n.getString( 'save' )" style="width:10em" />

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateSqlViewForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateSqlViewForm.vm	2015-03-10 11:36:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateSqlViewForm.vm	2015-07-31 10:51:43 +0000
@@ -10,6 +10,8 @@
 #set( $type = $i18n.getString( "sql_query_type" ) )
 #end
 
+#set( $cacheStrategy = $sqlViewObject.cacheStrategy.name() )
+
 <form id="updateSqlViewForm" action="updateSqlViewInstance.action" method="post" class="inputForm">
 
 	<div>
@@ -44,7 +46,18 @@
 				<textarea type="text" id="sqlquery" name="sqlquery" style="width:80em;height:20em">$!encoder.htmlEncode( $!sqlViewObject.sqlQuery )</textarea>
 			</td>
 		</tr>
-
+		<tr>
+			<td><label>$encoder.htmlEncode( $i18n.getString( "cache_strategy" ) )</label></td>
+			<td>
+			<select id="cacheStrategy" name="cacheStrategy">
+				<option value="RESPECT_SYSTEM_SETTING" #if( $cacheStrategy == "RESPECT_SYSTEM_SETTING" )selected="selected"#end>$i18n.getString( "respect_system_setting" )</option>
+				<option value="NO_CACHE" #if( $cacheStrategy == "NO_CACHE" )selected="selected"#end>$i18n.getString( "no_cache" )</option>
+				<option value="CACHE_1_HOUR" #if( $cacheStrategy == "CACHE_1_HOUR" )selected="selected"#end>$i18n.getString( "cache_for_one_hour" )</option>
+				<option value="CACHE_6AM_TOMORROW" #if( $cacheStrategy == "CACHE_6AM_TOMORROW" )selected="selected"#end>$i18n.getString( "cache_until_6am_tomorrow" )</option>
+				<option value="CACHE_TWO_WEEKS" #if( $cacheStrategy == "CACHE_TWO_WEEKS" )selected="selected"#end>$i18n.getString( "cache_for_two_weeks" )</option>
+			</select>
+			</td>
+		</tr>
 		<tr>
 			<td></td>
 			<td>
@@ -53,6 +66,4 @@
 			</td>
 		</tr>
 	</table>
-
 </form>
-

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm	2015-05-08 20:26:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm	2015-07-31 11:29:52 +0000
@@ -36,6 +36,7 @@
 <div class="setting">
 <select id="cacheStrategy" name="cacheStrategy">
     <option value="NO_CACHE" #if( $keyCacheStrategy == "NO_CACHE" )selected="selected"#end>$i18n.getString( "no_cache" )</option>
+    <option value="CACHE_1_HOUR" #if( $keyCacheStrategy == "CACHE_1_HOUR" )selected="selected" #end>$i18n.getString( "cache_for_one_hour" )</option>
     <option value="CACHE_6AM_TOMORROW" #if( $keyCacheStrategy == "CACHE_6AM_TOMORROW" )selected="selected"#end>$i18n.getString( "cache_until_6am_tomorrow" )</option>
     <option value="CACHE_TWO_WEEKS" #if( $keyCacheStrategy == "CACHE_TWO_WEEKS" )selected="selected"#end>$i18n.getString( "cache_for_two_weeks" )</option>
 </select>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java	2015-07-15 15:49:39 +0000
@@ -54,7 +54,7 @@
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/AddReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/AddReportAction.java	2015-06-18 06:57:14 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/AddReportAction.java	2015-07-31 10:51:43 +0000
@@ -31,8 +31,10 @@
 import java.io.File;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.EnumUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.commons.action.AbstractRelativePeriodsAction;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.report.Report;
@@ -128,7 +130,7 @@
     
     public void setUploadContentType( String contentType )
     {
-    	this.contentType = contentType;
+        this.contentType = contentType;
     }
     
     private String currentDesign;
@@ -152,6 +154,13 @@
         this.paramOrganisationUnit = paramOrganisationUnit;
     }
 
+    private String cacheStrategy;
+
+    public void setCacheStrategy( String cacheStrategy )
+    {
+        this.cacheStrategy = cacheStrategy;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -172,6 +181,12 @@
         throws Exception
     {
         // ---------------------------------------------------------------------
+        // New report or update existing object?
+        // ---------------------------------------------------------------------
+
+        boolean isNewReport = id == null;
+
+        // ---------------------------------------------------------------------
         // Set fileName to the current design file name in case of update
         // ---------------------------------------------------------------------
 
@@ -193,7 +208,7 @@
         // Create report
         // ---------------------------------------------------------------------
 
-        Report report = ( id == null ) ? new Report() : reportService.getReport( id );
+        Report report = isNewReport ? new Report() : reportService.getReport( id );
         
         ReportTable reportTable = reportTableService.getReportTable( reportTableId );
         
@@ -215,6 +230,20 @@
         {
             report.setDesignContent( FileUtils.readFileToString( file ) );
         }
+
+        // ---------------------------------------------------------------------
+        // Cache strategy
+        // ---------------------------------------------------------------------
+
+        if ( cacheStrategy != null )
+        {
+            CacheStrategy strategy = EnumUtils.getEnum( CacheStrategy.class, cacheStrategy );
+            report.setCacheStrategy( strategy != null ? strategy : Report.DEFAULT_CACHE_STRATEGY );
+        }
+        else if ( isNewReport )
+        {
+            report.setCacheStrategy( CacheStrategy.RESPECT_SYSTEM_SETTING );
+        }
         
         reportService.saveReport( report );
         

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ExportTableAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ExportTableAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ExportTableAction.java	2015-07-15 15:49:39 +0000
@@ -37,7 +37,7 @@
 import org.apache.commons.lang3.StringUtils;
 import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
+import org.hisp.dhis.common.cache.CacheStrategy;
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.constant.ConstantService;
 import org.hisp.dhis.i18n.I18nFormat;

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2014-12-29 02:30:26 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2015-07-31 10:03:58 +0000
@@ -273,4 +273,4 @@
 approval_entity=Approval entity
 approval_status=Approval status
 please_make_selection=Please make a selection below
-data_criteria=Data criteria
+data_criteria=Data criteria
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addReportForm.vm	2014-04-22 16:33:23 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addReportForm.vm	2015-07-31 10:51:43 +0000
@@ -3,7 +3,7 @@
 	var i18n_specify_name = '$encoder.jsEscape( $i18n.getString( "specify_name" ) , "'")';
 
 	jQuery( document ).ready( function() {
-        setReportType();
+		setReportType();
 	} );
 </script>
 
@@ -19,23 +19,23 @@
 <table>
 	<col width="120"/>
 	<col width="400"/>
-    <tr>
-        <th colspan="2">$i18n.getString( "details" )</th>
-    </tr>
-    <tr>
-        <td><label for="name">$i18n.getString( "name" )</label></td>
-        <td><input type="text" id="name" name="name" value="$!{report.name}"></td>
-    </tr>
-    <tr>
-    	<td><label for="type">$i18n.getString( "type" )</label></td>
-    	<td>
-    		<select id="type" name="type" onchange="setReportType()">
-    			<option value="jasperReportTable"#if( ${report.type} == "jasperReportTable" ) selected="selected"#end>$i18n.getString( "jasper_report_report_table_data_source" )</option>
-    			<option value="jasperJdbc"#if( ${report.type} == "jasperJdbc" ) selected="selected"#end>$i18n.getString( "jasper_report_jdbc_data_source" )</option>
-    			<option value="html"#if( ${report.type} == "html" ) selected="selected"#end>$i18n.getString( "html_report" )</option>
+	<tr>
+		<th colspan="2">$i18n.getString( "details" )</th>
+	</tr>
+	<tr>
+		<td><label for="name">$i18n.getString( "name" )</label></td>
+		<td><input type="text" id="name" name="name" value="$!{report.name}"></td>
+	</tr>
+	<tr>
+		<td><label for="type">$i18n.getString( "type" )</label></td>
+		<td>
+			<select id="type" name="type" onchange="setReportType()">
+				<option value="jasperReportTable"#if( ${report.type} == "jasperReportTable" ) selected="selected"#end>$i18n.getString( "jasper_report_report_table_data_source" )</option>
+				<option value="jasperJdbc"#if( ${report.type} == "jasperJdbc" ) selected="selected"#end>$i18n.getString( "jasper_report_jdbc_data_source" )</option>
+				<option value="html"#if( ${report.type} == "html" ) selected="selected"#end>$i18n.getString( "html_report" )</option>
 		    </select>
 	    </td>
-    </tr>
+	</tr>
 	<tr>
 		<td><label for="upload">$i18n.getString( "design_file" )</label></td>
 		<td><input type="file" id="upload" name="upload" size="30" /></td>
@@ -54,13 +54,13 @@
 			<input type="button" value="$i18n.getString( 'get_jasper_report_template' )" onclick="window.location.href='getReportTemplate.action?type=jasper'">
 		</td>
 	</tr>
-    <tr class="htmlDataSource">
-        <td></td>
-        <td>
-            <input type="button" value="$i18n.getString( 'get_html_report_template' )" onclick="window.location.href='getReportTemplate.action?type=html'">
-        </td>
-    </tr>
-    #end
+	<tr class="htmlDataSource">
+		<td></td>
+		<td>
+			<input type="button" value="$i18n.getString( 'get_html_report_template' )" onclick="window.location.href='getReportTemplate.action?type=html'">
+		</td>
+	</tr>
+	#end
 	<tr class="jasperReportTableDataSource">
 		<td><label for="reportTable">$i18n.getString( "report_table" )</label></td>
 		<td>
@@ -76,25 +76,45 @@
 		<th colspan="2">$i18n.getString( "relative_periods" )</th>
 	</tr>
 	<tr class="jasperJdbcDataSource htmlDataSource">
-        <td colspan="2">#parse( "/dhis-web-reporting/relativePeriodsInput.vm" )</td>
-    </tr>
-    <tr class="jasperJdbcDataSource htmlDataSource">
-        <td colspan="2" style="height:15px"></td>
-    </tr>
-    <tr class="jasperJdbcDataSource htmlDataSource">
-        <th colspan="2">$i18n.getString( "report_parameters" )</th>
-    </tr>
-    <tr class="jasperJdbcDataSource htmlDataSource">
-        <td colspan="2">
-            <label for="paramReportingMonth">$i18n.getString( "reporting_period" )</label>
-            <input type="checkbox" id="paramReportingMonth" name="paramReportingMonth" value="true"#if( $report.reportParams.isParamReportingMonth() ) checked#end>&nbsp;
-            <label for="paramOrganisationUnit">$i18n.getString( "organisation_unit" )</label>
-            <input type="checkbox" id="paramOrganisationUnit" name="paramOrganisationUnit" value="true"#if( $report.reportParams.isParamOrganisationUnit() ) checked#end>
-        <td>
-    </tr>
-    <tr>
-        <td colspan="2" style="height:15px"></td>
-    </tr>
+		<td colspan="2">#parse( "/dhis-web-reporting/relativePeriodsInput.vm" )</td>
+	</tr>
+	<tr class="jasperJdbcDataSource htmlDataSource">
+		<td colspan="2" style="height:15px"></td>
+	</tr>
+	<tr class="jasperJdbcDataSource htmlDataSource">
+		<th colspan="2">$i18n.getString( "report_parameters" )</th>
+	</tr>
+	<tr class="jasperJdbcDataSource htmlDataSource">
+		<td colspan="2">
+			<label for="paramReportingMonth">$i18n.getString( "reporting_period" )</label>
+			<input type="checkbox" id="paramReportingMonth" name="paramReportingMonth" value="true"#if( $report.reportParams.isParamReportingMonth() ) checked#end>&nbsp;
+			<label for="paramOrganisationUnit">$i18n.getString( "organisation_unit" )</label>
+			<input type="checkbox" id="paramOrganisationUnit" name="paramOrganisationUnit" value="true"#if( $report.reportParams.isParamOrganisationUnit() ) checked#end>
+		<td>
+	</tr>
+	<tr>
+		<td colspan="2" style="height:15px"></td>
+	</tr>
+	<tr>
+		<th colspan="2">$i18n.getString( "settings" )</th>
+	</tr>
+	<tr>
+		<td>
+			<label for="cacheStrategy">$encoder.htmlEncode( $i18n.getString( "cache_strategy" ) )</label>
+		</td>
+		<td>
+			<select id="cacheStrategy" name="cacheStrategy">
+				<option value="RESPECT_SYSTEM_SETTING" #if( $!report.cacheStrategy.name() == "RESPECT_SYSTEM_SETTING" ) selected="selected" #end>$i18n.getString( "respect_system_setting" )</option>
+				<option value="NO_CACHE" #if( $!report.cacheStrategy.name() == "NO_CACHE" ) selected="selected" #end>$i18n.getString( "no_cache" )</option>
+				<option value="CACHE_1_HOUR" #if( $!report.cacheStrategy.name() == "CACHE_1_HOUR" ) selected="selected" #end>$i18n.getString( "cache_for_one_hour" )</option>
+				<option value="CACHE_6AM_TOMORROW" #if( $!report.cacheStrategy.name() == "CACHE_6AM_TOMORROW" ) selected="selected" #end>$i18n.getString( "cache_until_6am_tomorrow" )</option>
+				<option value="CACHE_TWO_WEEKS" #if( $!report.cacheStrategy.name() == "CACHE_TWO_WEEKS" ) selected="selected" #end>$i18n.getString( "cache_for_two_weeks" )</option>
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td colspan="2" style="height:15px"></td>
+	</tr>
 	<tr>
 		<td colspan="2">
 			<input type="button" value="$i18n.getString( 'save' )" style="width:10em" onclick="addReport()" />
@@ -102,5 +122,5 @@
 		</td>
 	</tr>
 </table>
-	
+
 </form>