← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17639: Data entry, fixed bug with caching. Including user in etag.

 

------------------------------------------------------------
revno: 17639
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-12-02 16:07:40 +0200
message:
  Data entry, fixed bug with caching. Including user in etag.
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataSetAssociationsAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java	2014-09-25 10:17:34 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java	2014-12-02 14:07:40 +0000
@@ -46,6 +46,7 @@
     public static final TextUtils INSTANCE = new TextUtils();
     public static final String EMPTY = "";
     public static final String SPACE = "";
+    public static final String SEP = "-";
     public static final String LN = System.getProperty( "line.separator" );
     
     private static final Pattern LINK_PATTERN = Pattern.compile( "((http://|https://|www\\.).+?)($|\\n|\\r|\\r\\n| )" );

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataSetAssociationsAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataSetAssociationsAction.java	2014-11-19 11:16:04 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataSetAssociationsAction.java	2014-12-02 14:07:40 +0000
@@ -44,11 +44,14 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.system.util.DateUtils;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
 import org.hisp.dhis.webapi.utils.ContextUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
 
+import static org.hisp.dhis.system.util.TextUtils.SEP;
 /**
  * @author Lars Helge Overland
  */
@@ -64,6 +67,9 @@
     @Autowired
     private IdentifiableObjectManager identifiableObjectManager;
 
+    @Autowired
+    private CurrentUserService currentUserService;
+    
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -89,10 +95,12 @@
     @Override
     public String execute()
     {
+        User user = currentUserService.getCurrentUser();
+        
         Date lastUpdated = DateUtils.max( 
             identifiableObjectManager.getLastUpdated( DataSet.class ), 
             identifiableObjectManager.getLastUpdated( OrganisationUnit.class ) );
-        String tag = lastUpdated != null ? DateUtils.LONG_DATE_FORMAT.format( lastUpdated ) : null;
+        String tag = lastUpdated != null && user != null ? ( DateUtils.LONG_DATE_FORMAT.format( lastUpdated ) + SEP + user.getUid() ): null;
         
         if ( ContextUtils.isNotModified( ServletActionContext.getRequest(), ServletActionContext.getResponse(), tag ) )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java	2014-11-19 12:17:41 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java	2014-12-02 14:07:40 +0000
@@ -62,6 +62,8 @@
 
 import com.opensymphony.xwork2.Action;
 
+import static org.hisp.dhis.system.util.TextUtils.SEP;
+
 /**
  * @author Lars Helge Overland
  */
@@ -119,7 +121,7 @@
 
     @Autowired
     private IdentifiableObjectManager identifiableObjectManager;
-
+    
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -201,6 +203,8 @@
     @Override
     public String execute()
     {
+        User user = currentUserService.getCurrentUser();
+
         Date lastUpdated = DateUtils.max( 
             identifiableObjectManager.getLastUpdated( DataElement.class ), 
             identifiableObjectManager.getLastUpdated( OptionSet.class ),
@@ -209,15 +213,13 @@
             identifiableObjectManager.getLastUpdated( DataElementCategoryCombo.class ),
             identifiableObjectManager.getLastUpdated( DataElementCategory.class ),
             identifiableObjectManager.getLastUpdated( DataElementCategoryOption.class ));
-        String tag = lastUpdated != null ? DateUtils.LONG_DATE_FORMAT.format( lastUpdated ) : null;
+        String tag = lastUpdated != null && user != null ? ( DateUtils.LONG_DATE_FORMAT.format( lastUpdated ) + SEP + user.getUid() ): null;
         
         if ( ContextUtils.isNotModified( ServletActionContext.getRequest(), ServletActionContext.getResponse(), tag ) )
         {
             return SUCCESS;
         }
                 
-        User user = currentUserService.getCurrentUser();
-
         if ( user != null && user.getOrganisationUnits().isEmpty() )
         {
             emptyOrganisationUnits = true;