← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20810: SQL view. Addded missing UI for cache strategy.

 

------------------------------------------------------------
revno: 20810
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-10-20 17:38:22 +0200
message:
  SQL view. Addded missing UI for cache strategy.
modified:
  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/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/sqlView.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateSqlViewForm.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
=== 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-07-31 10:51:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/AddSqlViewAction.java	2015-10-20 15:38:22 +0000
@@ -28,7 +28,6 @@
  * 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;
@@ -85,9 +84,9 @@
         this.type = type;
     }
 
-    private String cacheStrategy;
+    private CacheStrategy cacheStrategy;
 
-    public void setCacheStrategy( String cacheStrategy )
+    public void setCacheStrategy( CacheStrategy cacheStrategy )
     {
         this.cacheStrategy = cacheStrategy;
     }
@@ -108,8 +107,7 @@
 
         if ( cacheStrategy != null )
         {
-            CacheStrategy strategy = EnumUtils.getEnum( CacheStrategy.class, cacheStrategy );
-            sqlView.setCacheStrategy( strategy != null ? strategy : SqlView.DEFAULT_CACHE_STRATEGY );
+            sqlView.setCacheStrategy( cacheStrategy != null ? cacheStrategy : SqlView.DEFAULT_CACHE_STRATEGY );
         }
         else
         {

=== 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-07-31 10:51:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/sqlview/UpdateSqlViewAction.java	2015-10-20 15:38:22 +0000
@@ -29,7 +29,6 @@
  */
 
 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;
@@ -78,9 +77,9 @@
         this.sqlquery = sqlquery;
     }
 
-    private String cacheStrategy;
+    private CacheStrategy cacheStrategy;
 
-    public void setCacheStrategy( String cacheStrategy )
+    public void setCacheStrategy( CacheStrategy cacheStrategy )
     {
         this.cacheStrategy = cacheStrategy;
     }
@@ -99,8 +98,7 @@
 
         if ( cacheStrategy != null )
         {
-            CacheStrategy strategy = EnumUtils.getEnum( CacheStrategy.class, cacheStrategy );
-            sqlView.setCacheStrategy( strategy != null ? strategy : SqlView.DEFAULT_CACHE_STRATEGY );
+            sqlView.setCacheStrategy( cacheStrategy != null ? cacheStrategy : SqlView.DEFAULT_CACHE_STRATEGY );
         }
 
         sqlViewService.updateSqlView( sqlView.cleanSqlQuery() );

=== 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-07-31 12:46:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addSqlViewForm.vm	2015-10-20 15:38:22 +0000
@@ -18,6 +18,18 @@
             <td><textarea id="description" name="description"></textarea></td>
         </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">$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><label for="type">$encoder.htmlEncode( $i18n.getString( "sql_type" ) )</label></td>
             <td>
                 <select id="type" name="type">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/sqlView.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/sqlView.vm	2015-07-14 14:50:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/sqlView.vm	2015-10-20 15:38:22 +0000
@@ -20,10 +20,10 @@
 <div id="contextMenu" class="contextMenu">
   <ul id="contextMenuItems" class="contextMenuItems">
     <li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i>&nbsp;&nbsp;$i18n.getString( "sharing_settings" )</a></li>
+    <li data-enabled="canUpdate"><a data-target-fn="showUpdateSqlViewForm"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "edit" )</a></li>
     <li data-enabled="canRun"><a data-target-fn="runSqlViewQuery"><i class="fa fa-caret-square-o-right"></i>&nbsp;&nbsp;$i18n.getString( "run" )</a></li>
     <li data-enabled="canRefresh"><a data-target-fn="refreshMaterializedView"><i class="fa fa-refresh"></i>&nbsp;&nbsp;$i18n.getString( "refresh" )</a></li>
     <li><a data-target-fn="showDataSqlViewForm"><i class="fa fa-table"></i>&nbsp;&nbsp;$i18n.getString( "show_sql_view" )</a></li>
-    <li data-enabled="canUpdate"><a data-target-fn="showUpdateSqlViewForm"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "edit" )</a></li>
     <li data-enabled="canDelete"><a data-target-fn="removeSqlViewObject"><i class="fa fa-trash-o"></i>&nbsp;&nbsp;$i18n.getString( "remove" )</a></li>
     <li><a data-target-fn="showSqlViewDetails"><i class="fa fa-info-circle"></i>&nbsp;&nbsp;$i18n.getString( "show_details" )</a></li>
   </ul>

=== 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-09-15 07:52:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateSqlViewForm.vm	2015-10-20 15:38:22 +0000
@@ -36,6 +36,18 @@
             </td>
         </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( $!sqlViewObject.cacheStrategy == "RESPECT_SYSTEM_SETTING" ) selected="selected" #end>$i18n.getString( "respect_system_setting" )</option>
+                    <option value="NO_CACHE" #if( $!sqlViewObject.cacheStrategy == "NO_CACHE" ) selected="selected" #end>$i18n.getString( "no_cache" )</option>
+                    <option value="CACHE_1_HOUR" #if( $!sqlViewObject.cacheStrategy == "CACHE_1_HOUR" ) selected="selected" #end>$i18n.getString( "cache_for_one_hour" )</option>
+                    <option value="CACHE_6AM_TOMORROW" #if( $!sqlViewObject.cacheStrategy == "CACHE_6AM_TOMORROW" ) selected="selected" #end>$i18n.getString( "cache_until_6am_tomorrow" )</option>
+                    <option value="CACHE_TWO_WEEKS" #if( $!sqlViewObject.cacheStrategy == "CACHE_TWO_WEEKS" ) selected="selected" #end>$i18n.getString( "cache_for_two_weeks" )</option>
+                </select>
+            </td>
+        </tr>
+        <tr>
             <td><label>$encoder.htmlEncode( $i18n.getString( "sql_type" ) )</label></td>
             <td><input type="text" disabled="disabled" value="${type}"/></td>
         </tr>