Browse Source

OC-1196 OC-1195: Obtain etag from de Server and save it

masensio 11 years ago
parent
commit
eaa17eb429

+ 2 - 0
src/com/owncloud/android/operations/SynchronizeFileOperation.java

@@ -215,6 +215,8 @@ public class SynchronizeFileOperation extends RemoteOperation {
         file.setFileLength(we.contentLength());
         file.setMimetype(we.contentType());
         file.setModificationTimestamp(we.modifiedTimestamp());
+        file.setEtag(we.etag());
+        
         return file;
     }
 

+ 1 - 0
src/com/owncloud/android/operations/SynchronizeFolderOperation.java

@@ -286,6 +286,7 @@ public class SynchronizeFolderOperation extends RemoteOperation {
         file.setMimetype(we.contentType());
         file.setModificationTimestamp(we.modifiedTimestamp());
         file.setParentId(mParentId);
+        file.setEtag(we.etag());
         return file;
     }
     

+ 9 - 1
src/eu/alefzero/webdav/WebdavEntry.java

@@ -28,7 +28,7 @@ import com.owncloud.android.Log_OC;
 import android.net.Uri;
 
 public class WebdavEntry {
-    private String mName, mPath, mUri, mContentType;
+    private String mName, mPath, mUri, mContentType, mEtag;
     private long mContentLength, mCreateTimestamp, mModifiedTimestamp;
 
     public WebdavEntry(MultiStatusResponse ms, String splitElement) {
@@ -87,6 +87,10 @@ public class WebdavEntry {
                         .parseResponseDate((String) prop.getValue());
                 mCreateTimestamp = (d != null) ? d.getTime() : 0;
             }
+            
+            prop = propSet.get(DavPropertyName.GETETAG);
+            if (prop != null)
+                mEtag = (String) prop.getValue();
 
         } else {
             Log_OC.e("WebdavEntry",
@@ -129,6 +133,10 @@ public class WebdavEntry {
     public long modifiedTimestamp() {
         return mModifiedTimestamp;
     }
+    
+    public String etag() {
+        return mEtag;
+    }
 
     private void resetData() {
         mName = mUri = mContentType = null;