|
@@ -230,19 +230,16 @@ public class FileDataStorageManager {
|
|
|
} else {
|
|
|
Uri result_uri = null;
|
|
|
if (getContentResolver() != null) {
|
|
|
- result_uri = getContentResolver().insert(
|
|
|
- ProviderTableMeta.CONTENT_URI_FILE, cv);
|
|
|
+ result_uri = getContentResolver().insert(ProviderTableMeta.CONTENT_URI_FILE, cv);
|
|
|
} else {
|
|
|
try {
|
|
|
- result_uri = getContentProviderClient().insert(
|
|
|
- ProviderTableMeta.CONTENT_URI_FILE, cv);
|
|
|
+ result_uri = getContentProviderClient().insert(ProviderTableMeta.CONTENT_URI_FILE, cv);
|
|
|
} catch (RemoteException e) {
|
|
|
Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
|
|
}
|
|
|
}
|
|
|
if (result_uri != null) {
|
|
|
- long new_id = Long.parseLong(result_uri.getPathSegments()
|
|
|
- .get(1));
|
|
|
+ long new_id = Long.parseLong(result_uri.getPathSegments().get(1));
|
|
|
file.setFileId(new_id);
|
|
|
}
|
|
|
}
|
|
@@ -347,8 +344,7 @@ public class FileDataStorageManager {
|
|
|
)
|
|
|
).withSelection(where, whereArgs).build());
|
|
|
|
|
|
- File localFolder =
|
|
|
- new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file));
|
|
|
+ File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file));
|
|
|
if (localFolder.exists()) {
|
|
|
removeLocalFolder(localFolder);
|
|
|
}
|
|
@@ -411,7 +407,6 @@ public class FileDataStorageManager {
|
|
|
|
|
|
} catch (OperationApplicationException | RemoteException e) {
|
|
|
Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage(), e);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// update new id in file objects for insertions
|
|
@@ -448,10 +443,8 @@ public class FileDataStorageManager {
|
|
|
if (removeDBData) {
|
|
|
//Uri file_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_FILE,
|
|
|
// ""+file.getFileId());
|
|
|
- Uri file_uri = ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_FILE,
|
|
|
- file.getFileId());
|
|
|
- String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
|
|
|
- ProviderTableMeta.FILE_PATH + "=?";
|
|
|
+ Uri file_uri = ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_FILE, file.getFileId());
|
|
|
+ String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
|
|
|
String[] whereArgs = new String[]{mAccount.name, file.getRemotePath()};
|
|
|
int deleted = 0;
|
|
|
if (getContentProviderClient() != null) {
|
|
@@ -500,10 +493,9 @@ public class FileDataStorageManager {
|
|
|
}
|
|
|
|
|
|
private boolean removeFolderInDb(OCFile folder) {
|
|
|
- Uri folder_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, "" +
|
|
|
- folder.getFileId()); // URI for recursive deletion
|
|
|
- String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
|
|
|
- ProviderTableMeta.FILE_PATH + "=?";
|
|
|
+ Uri folder_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, "" + folder.getFileId()); // URI
|
|
|
+ // for recursive deletion
|
|
|
+ String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
|
|
|
String [] whereArgs = new String[]{mAccount.name, folder.getRemotePath()};
|
|
|
int deleted = 0;
|
|
|
if (getContentProviderClient() != null) {
|
|
@@ -581,8 +573,7 @@ public class FileDataStorageManager {
|
|
|
|
|
|
OCFile targetParent = getFileByPath(targetParentPath);
|
|
|
if (targetParent == null) {
|
|
|
- throw new IllegalStateException(
|
|
|
- "Parent folder of the target path does not exist!!");
|
|
|
+ throw new IllegalStateException("Parent folder of the target path does not exist!!");
|
|
|
}
|
|
|
|
|
|
/// 1. get all the descendants of the moved element in a single QUERY
|
|
@@ -592,12 +583,8 @@ public class FileDataStorageManager {
|
|
|
c = getContentProviderClient().query(
|
|
|
ProviderTableMeta.CONTENT_URI,
|
|
|
null,
|
|
|
- ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
|
|
|
- ProviderTableMeta.FILE_PATH + " LIKE ? ",
|
|
|
- new String[]{
|
|
|
- mAccount.name,
|
|
|
- file.getRemotePath() + "%"
|
|
|
- },
|
|
|
+ ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + " LIKE ? ",
|
|
|
+ new String[]{mAccount.name, file.getRemotePath() + "%"},
|
|
|
ProviderTableMeta.FILE_PATH + " ASC "
|
|
|
);
|
|
|
} catch (RemoteException e) {
|
|
@@ -608,19 +595,14 @@ public class FileDataStorageManager {
|
|
|
c = getContentResolver().query(
|
|
|
ProviderTableMeta.CONTENT_URI,
|
|
|
null,
|
|
|
- ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
|
|
|
- ProviderTableMeta.FILE_PATH + " LIKE ? ",
|
|
|
- new String[]{
|
|
|
- mAccount.name,
|
|
|
- file.getRemotePath() + "%"
|
|
|
- },
|
|
|
+ ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + " LIKE ? ",
|
|
|
+ new String[]{mAccount.name, file.getRemotePath() + "%"},
|
|
|
ProviderTableMeta.FILE_PATH + " ASC "
|
|
|
);
|
|
|
}
|
|
|
|
|
|
/// 2. prepare a batch of update operations to change all the descendants
|
|
|
- ArrayList<ContentProviderOperation> operations =
|
|
|
- new ArrayList<ContentProviderOperation>(c.getCount());
|
|
|
+ ArrayList<ContentProviderOperation> operations = new ArrayList<>(c.getCount());
|
|
|
String defaultSavePath = FileStorageUtils.getSavePath(mAccount.name);
|
|
|
List<String> originalPathsToTriggerMediaScan = new ArrayList<String>();
|
|
|
List<String> newPathsToTriggerMediaScan = new ArrayList<String>();
|
|
@@ -634,8 +616,7 @@ public class FileDataStorageManager {
|
|
|
ProviderTableMeta.FILE_PATH,
|
|
|
targetPath + child.getRemotePath().substring(lengthOfOldPath)
|
|
|
);
|
|
|
- if (child.getStoragePath() != null &&
|
|
|
- child.getStoragePath().startsWith(defaultSavePath)) {
|
|
|
+ if (child.getStoragePath() != null && child.getStoragePath().startsWith(defaultSavePath)) {
|
|
|
// update link to downloaded content - but local move is not done here!
|
|
|
String targetLocalPath = defaultSavePath + targetPath +
|
|
|
child.getStoragePath().substring(lengthOfOldStoragePath);
|
|
@@ -647,10 +628,7 @@ public class FileDataStorageManager {
|
|
|
|
|
|
}
|
|
|
if (child.getRemotePath().equals(file.getRemotePath())) {
|
|
|
- cv.put(
|
|
|
- ProviderTableMeta.FILE_PARENT,
|
|
|
- targetParent.getFileId()
|
|
|
- );
|
|
|
+ cv.put(ProviderTableMeta.FILE_PARENT, targetParent.getFileId());
|
|
|
}
|
|
|
operations.add(
|
|
|
ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI).
|
|
@@ -669,14 +647,12 @@ public class FileDataStorageManager {
|
|
|
try {
|
|
|
if (getContentResolver() != null) {
|
|
|
getContentResolver().applyBatch(MainApp.getAuthority(), operations);
|
|
|
-
|
|
|
} else {
|
|
|
getContentProviderClient().applyBatch(operations);
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
- Log_OC.e(TAG, "Fail to update " + file.getFileId() + " and descendants in database",
|
|
|
- e);
|
|
|
+ Log_OC.e(TAG, "Fail to update " + file.getFileId() + " and descendants in database", e);
|
|
|
}
|
|
|
|
|
|
/// 4. move in local file system
|
|
@@ -755,21 +731,17 @@ public class FileDataStorageManager {
|
|
|
do {
|
|
|
ContentValues cv = new ContentValues();
|
|
|
long fileId = cursor.getLong(cursor.getColumnIndex(ProviderTableMeta._ID));
|
|
|
- String oldFileStoragePath = cursor.getString(cursor.getColumnIndex(ProviderTableMeta.FILE_STORAGE_PATH));
|
|
|
+ String oldFileStoragePath =
|
|
|
+ cursor.getString(cursor.getColumnIndex(ProviderTableMeta.FILE_STORAGE_PATH));
|
|
|
|
|
|
if (oldFileStoragePath.startsWith(srcPath)) {
|
|
|
|
|
|
- cv.put(
|
|
|
- ProviderTableMeta.FILE_STORAGE_PATH,
|
|
|
- oldFileStoragePath.replaceFirst(srcPath, dstPath));
|
|
|
+ cv.put(ProviderTableMeta.FILE_STORAGE_PATH, oldFileStoragePath.replaceFirst(srcPath, dstPath));
|
|
|
|
|
|
operations.add(
|
|
|
ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI).
|
|
|
withValues(cv).
|
|
|
- withSelection(
|
|
|
- ProviderTableMeta._ID + "=?",
|
|
|
- new String[]{String.valueOf(fileId)}
|
|
|
- )
|
|
|
+ withSelection(ProviderTableMeta._ID + "=?", new String[]{String.valueOf(fileId)})
|
|
|
.build());
|
|
|
}
|
|
|
|
|
@@ -787,32 +759,38 @@ public class FileDataStorageManager {
|
|
|
|
|
|
private Vector<OCFile> getFolderContent(long parentId, boolean onlyOnDevice) {
|
|
|
|
|
|
- Vector<OCFile> ret = new Vector<OCFile>();
|
|
|
+ Vector<OCFile> ret = new Vector<>();
|
|
|
|
|
|
- Uri req_uri = Uri.withAppendedPath(
|
|
|
- ProviderTableMeta.CONTENT_URI_DIR,
|
|
|
- String.valueOf(parentId));
|
|
|
+ Uri req_uri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, String.valueOf(parentId));
|
|
|
Cursor c = null;
|
|
|
|
|
|
if (getContentProviderClient() != null) {
|
|
|
try {
|
|
|
- c = getContentProviderClient().query(req_uri, null,
|
|
|
+ c = getContentProviderClient().query(
|
|
|
+ req_uri,
|
|
|
+ null,
|
|
|
ProviderTableMeta.FILE_PARENT + "=?",
|
|
|
- new String[]{String.valueOf(parentId)}, null);
|
|
|
+ new String[]{String.valueOf(parentId)},
|
|
|
+ null
|
|
|
+ );
|
|
|
} catch (RemoteException e) {
|
|
|
Log_OC.e(TAG, e.getMessage(), e);
|
|
|
return ret;
|
|
|
}
|
|
|
} else {
|
|
|
- c = getContentResolver().query(req_uri, null,
|
|
|
+ c = getContentResolver().query(
|
|
|
+ req_uri,
|
|
|
+ null,
|
|
|
ProviderTableMeta.FILE_PARENT + "=?",
|
|
|
- new String[]{String.valueOf(parentId)}, null);
|
|
|
+ new String[]{String.valueOf(parentId)},
|
|
|
+ null
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
if (c != null && c.moveToFirst()) {
|
|
|
do {
|
|
|
OCFile child = createFileInstance(c);
|
|
|
- if (child.isFolder() || !onlyOnDevice || child.isDown()){
|
|
|
+ if (child.isFolder() || !onlyOnDevice || child.isDown()) {
|
|
|
ret.add(child);
|
|
|
}
|
|
|
} while (c.moveToNext());
|
|
@@ -891,16 +869,12 @@ public class FileDataStorageManager {
|
|
|
private OCFile createFileInstance(Cursor c) {
|
|
|
OCFile file = null;
|
|
|
if (c != null) {
|
|
|
- file = new OCFile(c.getString(c
|
|
|
- .getColumnIndex(ProviderTableMeta.FILE_PATH)));
|
|
|
+ file = new OCFile(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_PATH)));
|
|
|
file.setFileId(c.getLong(c.getColumnIndex(ProviderTableMeta._ID)));
|
|
|
- file.setParentId(c.getLong(c
|
|
|
- .getColumnIndex(ProviderTableMeta.FILE_PARENT)));
|
|
|
- file.setMimetype(c.getString(c
|
|
|
- .getColumnIndex(ProviderTableMeta.FILE_CONTENT_TYPE)));
|
|
|
+ file.setParentId(c.getLong(c.getColumnIndex(ProviderTableMeta.FILE_PARENT)));
|
|
|
+ file.setMimetype(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_CONTENT_TYPE)));
|
|
|
if (!file.isFolder()) {
|
|
|
- file.setStoragePath(c.getString(c
|
|
|
- .getColumnIndex(ProviderTableMeta.FILE_STORAGE_PATH)));
|
|
|
+ file.setStoragePath(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_STORAGE_PATH)));
|
|
|
if (file.getStoragePath() == null) {
|
|
|
// try to find existing file and bind it with current account;
|
|
|
// with the current update of SynchronizeFolderOperation, this won't be
|
|
@@ -914,18 +888,13 @@ public class FileDataStorageManager {
|
|
|
}
|
|
|
file.setFileLength(c.getLong(c
|
|
|
.getColumnIndex(ProviderTableMeta.FILE_CONTENT_LENGTH)));
|
|
|
- file.setCreationTimestamp(c.getLong(c
|
|
|
- .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.
|
|
|
- getColumnIndex(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA)));
|
|
|
- file.setFavorite(c.getInt(
|
|
|
- c.getColumnIndex(ProviderTableMeta.FILE_KEEP_IN_SYNC)) == 1 ? true : false);
|
|
|
+ file.setCreationTimestamp(c.getLong(c.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.getColumnIndex(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA)));
|
|
|
+ file.setFavorite(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_KEEP_IN_SYNC)) == 1 ? true : false);
|
|
|
file.setEtag(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_ETAG)));
|
|
|
file.setShareViaLink(c.getInt(
|
|
|
c.getColumnIndex(ProviderTableMeta.FILE_SHARED_VIA_LINK)) == 1 ? true : false);
|
|
@@ -984,19 +953,16 @@ public class FileDataStorageManager {
|
|
|
} else {
|
|
|
Uri result_uri = null;
|
|
|
if (getContentResolver() != null) {
|
|
|
- result_uri = getContentResolver().insert(
|
|
|
- ProviderTableMeta.CONTENT_URI_SHARE, cv);
|
|
|
+ result_uri = getContentResolver().insert(ProviderTableMeta.CONTENT_URI_SHARE, cv);
|
|
|
} else {
|
|
|
try {
|
|
|
- result_uri = getContentProviderClient().insert(
|
|
|
- ProviderTableMeta.CONTENT_URI_SHARE, cv);
|
|
|
+ result_uri = getContentProviderClient().insert(ProviderTableMeta.CONTENT_URI_SHARE, cv);
|
|
|
} catch (RemoteException e) {
|
|
|
Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
|
|
}
|
|
|
}
|
|
|
if (result_uri != null) {
|
|
|
- long new_id = Long.parseLong(result_uri.getPathSegments()
|
|
|
- .get(1));
|
|
|
+ long new_id = Long.parseLong(result_uri.getPathSegments().get(1));
|
|
|
share.setId(new_id);
|
|
|
}
|
|
|
}
|
|
@@ -1012,10 +978,7 @@ public class FileDataStorageManager {
|
|
|
*/
|
|
|
public OCShare getShareById(long id) {
|
|
|
OCShare share = null;
|
|
|
- Cursor c = getShareCursorForValue(
|
|
|
- ProviderTableMeta._ID,
|
|
|
- String.valueOf(id)
|
|
|
- );
|
|
|
+ Cursor c = getShareCursorForValue(ProviderTableMeta._ID, String.valueOf(id));
|
|
|
if (c != null) {
|
|
|
if (c.moveToFirst()) {
|
|
|
share = createShareInstance(c);
|
|
@@ -1098,7 +1061,7 @@ public class FileDataStorageManager {
|
|
|
* @param path Path of the file.
|
|
|
* @param type Type of the share to get
|
|
|
* @param shareWith Target of the share. Ignored in type is {@link ShareType#PUBLIC_LINK}
|
|
|
- * @return First {@OCShare} instance found in DB bound to the file in 'path'
|
|
|
+ * @return First {@link OCShare} instance found in DB bound to the file in 'path'
|
|
|
*/
|
|
|
public OCShare getFirstShareByPathAndType(String path, ShareType type, String shareWith) {
|
|
|
Cursor cursor = null;
|
|
@@ -1162,30 +1125,20 @@ public class FileDataStorageManager {
|
|
|
private OCShare createShareInstance(Cursor c) {
|
|
|
OCShare share = null;
|
|
|
if (c != null) {
|
|
|
- share = new OCShare(c.getString(c
|
|
|
- .getColumnIndex(ProviderTableMeta.OCSHARES_PATH)));
|
|
|
+ share = new OCShare(c.getString(c.getColumnIndex(ProviderTableMeta.OCSHARES_PATH)));
|
|
|
share.setId(c.getLong(c.getColumnIndex(ProviderTableMeta._ID)));
|
|
|
- share.setFileSource(c.getLong(c
|
|
|
- .getColumnIndex(ProviderTableMeta.OCSHARES_ITEM_SOURCE)));
|
|
|
- share.setShareType(ShareType.fromValue(c.getInt(c
|
|
|
- .getColumnIndex(ProviderTableMeta.OCSHARES_SHARE_TYPE))));
|
|
|
- share.setShareWith(c.getString(c
|
|
|
- .getColumnIndex(ProviderTableMeta.OCSHARES_SHARE_WITH)));
|
|
|
- share.setPermissions(c.getInt(c
|
|
|
- .getColumnIndex(ProviderTableMeta.OCSHARES_PERMISSIONS)));
|
|
|
- share.setSharedDate(c.getLong(c
|
|
|
- .getColumnIndex(ProviderTableMeta.OCSHARES_SHARED_DATE)));
|
|
|
- share.setExpirationDate(c.getLong(c
|
|
|
- .getColumnIndex(ProviderTableMeta.OCSHARES_EXPIRATION_DATE)));
|
|
|
- share.setToken(c.getString(c
|
|
|
- .getColumnIndex(ProviderTableMeta.OCSHARES_TOKEN)));
|
|
|
- share.setSharedWithDisplayName(c.getString(c
|
|
|
- .getColumnIndex(ProviderTableMeta.OCSHARES_SHARE_WITH_DISPLAY_NAME)));
|
|
|
- share.setIsFolder(c.getInt(
|
|
|
- c.getColumnIndex(ProviderTableMeta.OCSHARES_IS_DIRECTORY)) == 1);
|
|
|
+ share.setFileSource(c.getLong(c.getColumnIndex(ProviderTableMeta.OCSHARES_ITEM_SOURCE)));
|
|
|
+ share.setShareType(ShareType.fromValue(c.getInt(c.getColumnIndex(ProviderTableMeta.OCSHARES_SHARE_TYPE))));
|
|
|
+ share.setShareWith(c.getString(c.getColumnIndex(ProviderTableMeta.OCSHARES_SHARE_WITH)));
|
|
|
+ share.setPermissions(c.getInt(c.getColumnIndex(ProviderTableMeta.OCSHARES_PERMISSIONS)));
|
|
|
+ share.setSharedDate(c.getLong(c.getColumnIndex(ProviderTableMeta.OCSHARES_SHARED_DATE)));
|
|
|
+ share.setExpirationDate(c.getLong(c.getColumnIndex(ProviderTableMeta.OCSHARES_EXPIRATION_DATE)));
|
|
|
+ share.setToken(c.getString(c.getColumnIndex(ProviderTableMeta.OCSHARES_TOKEN)));
|
|
|
+ share.setSharedWithDisplayName(
|
|
|
+ c.getString(c.getColumnIndex(ProviderTableMeta.OCSHARES_SHARE_WITH_DISPLAY_NAME)));
|
|
|
+ share.setIsFolder(c.getInt(c.getColumnIndex(ProviderTableMeta.OCSHARES_IS_DIRECTORY)) == 1);
|
|
|
share.setUserId(c.getLong(c.getColumnIndex(ProviderTableMeta.OCSHARES_USER_ID)));
|
|
|
- share.setIdRemoteShared(c.getLong(
|
|
|
- c.getColumnIndex(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED)));
|
|
|
+ share.setIdRemoteShared(c.getLong(c.getColumnIndex(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED)));
|
|
|
}
|
|
|
return share;
|
|
|
}
|
|
@@ -1215,8 +1168,7 @@ public class FileDataStorageManager {
|
|
|
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, false);
|
|
|
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false);
|
|
|
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, "");
|
|
|
- String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
|
|
|
- ProviderTableMeta.FILE_PARENT + "=?";
|
|
|
+ String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PARENT + "=?";
|
|
|
String [] whereArgs = new String[] { mAccount.name , String.valueOf(folder.getFileId()) };
|
|
|
|
|
|
if (getContentResolver() != null) {
|
|
@@ -1236,8 +1188,7 @@ public class FileDataStorageManager {
|
|
|
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, false);
|
|
|
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false);
|
|
|
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, "");
|
|
|
- String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
|
|
|
- ProviderTableMeta.FILE_PATH+ "=?";
|
|
|
+ String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH+ "=?";
|
|
|
String [] whereArgs = new String[] { mAccount.name , filePath };
|
|
|
|
|
|
if (getContentResolver() != null) {
|
|
@@ -1261,8 +1212,7 @@ public class FileDataStorageManager {
|
|
|
|
|
|
} else {
|
|
|
try {
|
|
|
- getContentProviderClient().delete(ProviderTableMeta.CONTENT_URI_SHARE, where,
|
|
|
- whereArgs);
|
|
|
+ getContentProviderClient().delete(ProviderTableMeta.CONTENT_URI_SHARE, where, whereArgs);
|
|
|
} catch (RemoteException e) {
|
|
|
Log_OC.e(TAG, "Exception in cleanShares" + e.getMessage(), e);
|
|
|
}
|
|
@@ -1339,8 +1289,7 @@ public class FileDataStorageManager {
|
|
|
resetShareFlagsInAllFiles();
|
|
|
|
|
|
if (sharedFiles != null) {
|
|
|
- ArrayList<ContentProviderOperation> operations =
|
|
|
- new ArrayList<ContentProviderOperation>(sharedFiles.size());
|
|
|
+ ArrayList<ContentProviderOperation> operations = new ArrayList<>(sharedFiles.size());
|
|
|
|
|
|
// prepare operations to insert or update files to save in the given folder
|
|
|
for (OCFile file : sharedFiles) {
|