boolean overriden = false;
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.FILE_MODIFIED, file.getModificationTimestamp());
+ cv.put(ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA, file.getModificationTimestampAtLastSyncForData());
cv.put(ProviderTableMeta.FILE_CREATION, file.getCreationTimestamp());
cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, file.getFileLength());
cv.put(ProviderTableMeta.FILE_CONTENT_TYPE, file.getMimetype());
file = filesIt.next();
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.FILE_MODIFIED, file.getModificationTimestamp());
+ cv.put(ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA, file.getModificationTimestampAtLastSyncForData());
cv.put(ProviderTableMeta.FILE_CREATION, file.getCreationTimestamp());
cv.put(ProviderTableMeta.FILE_CONTENT_LENGTH, file.getFileLength());
cv.put(ProviderTableMeta.FILE_CONTENT_TYPE, file.getMimetype());
.getColumnIndex(ProviderTableMeta.FILE_CREATION)));
file.setModificationTimestamp(c.getLong(c
.getColumnIndex(ProviderTableMeta.FILE_MODIFIED)));
+ file.setModificationTimestampAtLastSyncForData(c.getLong(c
+ .getColumnIndex(ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA)));
file.setLastSyncDateForProperties(c.getLong(c
.getColumnIndex(ProviderTableMeta.FILE_LAST_SYNC_DATE)));
file.setLastSyncDateForData(c.getLong(c.
private long mLength;
private long mCreationTimestamp;
private long mModifiedTimestamp;
+ private long mModifiedTimestampAtLastSyncForData;
private String mRemotePath;
private String mLocalPath;
private String mMimeType;
mLength = source.readLong();
mCreationTimestamp = source.readLong();
mModifiedTimestamp = source.readLong();
+ mModifiedTimestampAtLastSyncForData = source.readLong();
mRemotePath = source.readString();
mLocalPath = source.readString();
mMimeType = source.readString();
dest.writeLong(mLength);
dest.writeLong(mCreationTimestamp);
dest.writeLong(mModifiedTimestamp);
+ dest.writeLong(mModifiedTimestampAtLastSyncForData);
dest.writeString(mRemotePath);
dest.writeString(mLocalPath);
dest.writeString(mMimeType);
}
/**
- * Get a UNIX timestamp of the file modification time
- *
- * @return A UNIX timestamp of the modification time
+ * Get a UNIX timestamp of the file modification time.
+ *
+ * @return A UNIX timestamp of the modification time, corresponding to the value returned by the server
+ * in the last synchronization of the properties of this file.
*/
public long getModificationTimestamp() {
return mModifiedTimestamp;
/**
* Set a UNIX timestamp of the time the time the file was modified.
*
+ * To update with the value returned by the server in every synchronization of the properties
+ * of this file.
+ *
* @param modification_timestamp to set
*/
public void setModificationTimestamp(long modification_timestamp) {
mModifiedTimestamp = modification_timestamp;
}
+
+ /**
+ * Get a UNIX timestamp of the file modification time.
+ *
+ * @return A UNIX timestamp of the modification time, corresponding to the value returned by the server
+ * in the last synchronization of THE CONTENTS of this file.
+ */
+ public long getModificationTimestampAtLastSyncForData() {
+ return mModifiedTimestampAtLastSyncForData;
+ }
+
+ /**
+ * Set a UNIX timestamp of the time the time the file was modified.
+ *
+ * To update with the value returned by the server in every synchronization of THE CONTENTS
+ * of this file.
+ *
+ * @param modification_timestamp to set
+ */
+ public void setModificationTimestampAtLastSyncForData(long modificationTimestamp) {
+ mModifiedTimestampAtLastSyncForData = modificationTimestamp;
+ }
+
+
+
/**
* Returns the filename and "/" for the root directory
*
mLength = 0;
mCreationTimestamp = 0;
mModifiedTimestamp = 0;
+ mModifiedTimestampAtLastSyncForData = 0;
mLastSyncDateForProperties = 0;
mLastSyncDateForData = 0;
mKeepInSync = false;
public static final String AUTHORITY_FILES = "org.owncloud";\r
public static final String DB_FILE = "owncloud.db";\r
public static final String DB_NAME = "filelist";\r
- //public static final int DB_VERSION = 2;\r
- public static final int DB_VERSION = 3;\r
+ public static final int DB_VERSION = 4;\r
\r
private ProviderMeta() {\r
}\r
public static final String FILE_NAME = "filename";\r
public static final String FILE_CREATION = "created";\r
public static final String FILE_MODIFIED = "modified";\r
+ public static final String FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA = "modified_at_last_sync_for_data";\r
public static final String FILE_CONTENT_LENGTH = "content_length";\r
public static final String FILE_CONTENT_TYPE = "content_type";\r
public static final String FILE_STORAGE_PATH = "media_path";\r
file.setLastSyncDateForProperties(syncDate);\r
file.setLastSyncDateForData(syncDate);\r
file.setModificationTimestamp(mCurrentDownload.getModificationTimestamp());\r
+ file.setModificationTimestampAtLastSyncForData(mCurrentDownload.getModificationTimestamp());\r
// file.setEtag(mCurrentDownload.getEtag()); // TODO Etag, where available\r
file.setMimetype(mCurrentDownload.getMimeType());\r
file.setStoragePath(mCurrentDownload.getSavePath());\r
file.setCreationTimestamp(we.createTimestamp());
file.setFileLength(we.contentLength());
file.setMimetype(we.contentType());
- file.setModificationTimestamp(we.modifiedTimesamp());
+ file.setModificationTimestamp(we.modifiedTimestamp());
+ file.setModificationTimestampAtLastSyncForData(we.modifiedTimestamp());
// file.setEtag(mCurrentDownload.getEtag()); // TODO Etag, where available
}
serverChanged = (!mServerFile.getEtag().equals(mLocalFile.getEtag())); // TODO could this be dangerous when the user upgrades the server from non-tagged to tagged?
} else {
// server without etags
- serverChanged = (mServerFile.getModificationTimestamp() > mLocalFile.getModificationTimestamp());
+ serverChanged = (mServerFile.getModificationTimestamp() > mLocalFile.getModificationTimestampAtLastSyncForData());
}
boolean localChanged = (mLocalChangeAlreadyKnown || mLocalFile.getLocalModificationTimestamp() > mLocalFile.getLastSyncDateForData());
// TODO this will be always true after the app is upgraded to database version 3; will result in unnecessary uploads
file.setCreationTimestamp(we.createTimestamp());
file.setFileLength(we.contentLength());
file.setMimetype(we.contentType());
- file.setModificationTimestamp(we.modifiedTimesamp());
+ file.setModificationTimestamp(we.modifiedTimestamp());
return file;
}
file.setCreationTimestamp(we.createTimestamp());
file.setFileLength(we.contentLength());
file.setMimetype(we.contentType());
- file.setModificationTimestamp(we.modifiedTimesamp());
+ file.setModificationTimestamp(we.modifiedTimestamp());
file.setParentId(mParentId);
return file;
}
newFile.setFileLength(mFile.getFileLength());
newFile.setMimetype(mFile.getMimetype());
newFile.setModificationTimestamp(mFile.getModificationTimestamp());
+ newFile.setModificationTimestampAtLastSyncForData(mFile.getModificationTimestampAtLastSyncForData());
// newFile.setEtag(mFile.getEtag())
newFile.setKeepInSync(mFile.keepInSync());
newFile.setLastSyncDateForProperties(mFile.getLastSyncDateForProperties());
ProviderTableMeta.FILE_CREATION);\r
mProjectionMap.put(ProviderTableMeta.FILE_MODIFIED,\r
ProviderTableMeta.FILE_MODIFIED);\r
+ mProjectionMap.put(ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA,\r
+ ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA);\r
mProjectionMap.put(ProviderTableMeta.FILE_CONTENT_LENGTH,\r
ProviderTableMeta.FILE_CONTENT_LENGTH);\r
mProjectionMap.put(ProviderTableMeta.FILE_CONTENT_TYPE,\r
+ ProviderTableMeta.FILE_ACCOUNT_OWNER + " TEXT, "\r
+ ProviderTableMeta.FILE_LAST_SYNC_DATE + " INTEGER, "\r
+ ProviderTableMeta.FILE_KEEP_IN_SYNC + " INTEGER, "\r
- + ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA + " INTEGER );"\r
+ + ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA + " INTEGER, "\r
+ + ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA + " INTEGER );"\r
);\r
}\r
\r
" DEFAULT 0");\r
upgraded = true;\r
}\r
+ if (oldVersion < 4 && newVersion >= 4) {\r
+ Log.i("SQL", "Entering in the #3 ADD in onUpgrade");\r
+ db.execSQL("ALTER TABLE " + ProviderTableMeta.DB_NAME +\r
+ " ADD COLUMN " + ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA + " INTEGER " +\r
+ " DEFAULT 0");\r
+ upgraded = true;\r
+ }\r
if (!upgraded)\r
Log.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion + ", newVersion == " + newVersion);\r
}\r
return mCreateTimestamp;
}
- public long modifiedTimesamp() {
+ public long modifiedTimestamp() {
return mModifiedTimestamp;
}