|
@@ -85,28 +85,18 @@ public class FileDataStorageManager {
|
|
|
|
|
|
private ContentResolver contentResolver;
|
|
|
private ContentProviderClient contentProviderClient;
|
|
|
- private Account account;
|
|
|
+ private User user;
|
|
|
|
|
|
- @Deprecated
|
|
|
- public FileDataStorageManager(Account account, ContentResolver contentResolver) {
|
|
|
+ public FileDataStorageManager(User user, ContentResolver contentResolver) {
|
|
|
this.contentProviderClient = null;
|
|
|
this.contentResolver = contentResolver;
|
|
|
- this.account = account;
|
|
|
+ this.user = user;
|
|
|
}
|
|
|
|
|
|
- public FileDataStorageManager(User user, ContentResolver contentResolver) {
|
|
|
- this(user.toPlatformAccount(), contentResolver);
|
|
|
- }
|
|
|
-
|
|
|
- @Deprecated
|
|
|
- public FileDataStorageManager(Account account, ContentProviderClient contentProviderClient) {
|
|
|
+ public FileDataStorageManager(User user, ContentProviderClient contentProviderClient) {
|
|
|
this.contentProviderClient = contentProviderClient;
|
|
|
this.contentResolver = null;
|
|
|
- this.account = account;
|
|
|
- }
|
|
|
-
|
|
|
- public FileDataStorageManager(User user, ContentProviderClient contentProviderClient) {
|
|
|
- this(user.toPlatformAccount(), contentProviderClient);
|
|
|
+ this.user = user;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -235,7 +225,7 @@ public class FileDataStorageManager {
|
|
|
if (!ocFile.isFolder()) {
|
|
|
cv.put(ProviderTableMeta.FILE_STORAGE_PATH, ocFile.getStoragePath());
|
|
|
}
|
|
|
- cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
|
|
|
+ cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, user.getAccountName());
|
|
|
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, ocFile.getLastSyncDateForProperties());
|
|
|
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, ocFile.getLastSyncDateForData());
|
|
|
cv.put(ProviderTableMeta.FILE_ETAG, ocFile.getEtag());
|
|
@@ -402,7 +392,7 @@ public class FileDataStorageManager {
|
|
|
// prepare operations to remove files in the given folder
|
|
|
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + " = ?";
|
|
|
String[] whereArgs = new String[2];
|
|
|
- whereArgs[0] = account.name;
|
|
|
+ whereArgs[0] = user.getAccountName();
|
|
|
for (OCFile ocFile : filesToRemove) {
|
|
|
if (ocFile.getParentId() == folder.getFileId()) {
|
|
|
whereArgs[1] = ocFile.getRemotePath();
|
|
@@ -411,7 +401,7 @@ public class FileDataStorageManager {
|
|
|
ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_DIR, ocFile.getFileId()))
|
|
|
.withSelection(where, whereArgs).build());
|
|
|
|
|
|
- File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(account.name, ocFile));
|
|
|
+ File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(user.getAccountName(), ocFile));
|
|
|
if (localFolder.exists()) {
|
|
|
removeLocalFolder(localFolder);
|
|
|
}
|
|
@@ -489,7 +479,7 @@ public class FileDataStorageManager {
|
|
|
cv.put(ProviderTableMeta.FILE_PARENT, folder.getParentId());
|
|
|
cv.put(ProviderTableMeta.FILE_PATH, folder.getRemotePath());
|
|
|
cv.put(ProviderTableMeta.FILE_PATH_DECRYPTED, folder.getDecryptedRemotePath());
|
|
|
- cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
|
|
|
+ cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, user.getAccountName());
|
|
|
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, folder.getLastSyncDateForProperties());
|
|
|
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, folder.getLastSyncDateForData());
|
|
|
cv.put(ProviderTableMeta.FILE_ETAG, folder.getEtag());
|
|
@@ -523,7 +513,7 @@ public class FileDataStorageManager {
|
|
|
cv.put(ProviderTableMeta.FILE_PATH, file.getRemotePath());
|
|
|
cv.put(ProviderTableMeta.FILE_PATH_DECRYPTED, file.getDecryptedRemotePath());
|
|
|
cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
|
|
|
- cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
|
|
|
+ cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, user.getAccountName());
|
|
|
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
|
|
|
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA, file.getLastSyncDateForData());
|
|
|
cv.put(ProviderTableMeta.FILE_ETAG, file.getEtag());
|
|
@@ -562,7 +552,7 @@ public class FileDataStorageManager {
|
|
|
// ""+file.getFileId());
|
|
|
Uri file_uri = ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_FILE, ocFile.getFileId());
|
|
|
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
|
|
|
- String[] whereArgs = new String[]{account.name, ocFile.getRemotePath()};
|
|
|
+ String[] whereArgs = new String[]{user.getAccountName(), ocFile.getRemotePath()};
|
|
|
int deleted = 0;
|
|
|
if (getContentProviderClient() != null) {
|
|
|
try {
|
|
@@ -619,7 +609,7 @@ public class FileDataStorageManager {
|
|
|
Uri folderUri = Uri.withAppendedPath(ProviderTableMeta.CONTENT_URI_DIR, String.valueOf(folder.getFileId()));
|
|
|
// for recursive deletion
|
|
|
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
|
|
|
- String[] whereArgs = new String[]{account.name, folder.getRemotePath()};
|
|
|
+ String[] whereArgs = new String[]{user.getAccountName(), folder.getRemotePath()};
|
|
|
int deleted = 0;
|
|
|
if (getContentProviderClient() != null) {
|
|
|
try {
|
|
@@ -635,7 +625,7 @@ public class FileDataStorageManager {
|
|
|
|
|
|
private boolean removeLocalFolder(OCFile folder) {
|
|
|
boolean success = true;
|
|
|
- String localFolderPath = FileStorageUtils.getDefaultSavePathFor(account.name, folder);
|
|
|
+ String localFolderPath = FileStorageUtils.getDefaultSavePathFor(user.getAccountName(), folder);
|
|
|
File localFolder = new File(localFolderPath);
|
|
|
|
|
|
if (localFolder.exists()) {
|
|
@@ -704,7 +694,7 @@ public class FileDataStorageManager {
|
|
|
ProviderTableMeta.CONTENT_URI,
|
|
|
null,
|
|
|
ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + " LIKE ? ",
|
|
|
- new String[]{account.name, ocFile.getRemotePath() + "%"},
|
|
|
+ new String[]{user.getAccountName(), ocFile.getRemotePath() + "%"},
|
|
|
ProviderTableMeta.FILE_PATH + " ASC "
|
|
|
);
|
|
|
} catch (RemoteException e) {
|
|
@@ -716,14 +706,14 @@ public class FileDataStorageManager {
|
|
|
ProviderTableMeta.CONTENT_URI,
|
|
|
null,
|
|
|
ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + " LIKE ? ",
|
|
|
- new String[]{account.name, ocFile.getRemotePath() + "%"},
|
|
|
+ new String[]{user.getAccountName(), ocFile.getRemotePath() + "%"},
|
|
|
ProviderTableMeta.FILE_PATH + " ASC "
|
|
|
);
|
|
|
}
|
|
|
|
|
|
/// 2. prepare a batch of update operations to change all the descendants
|
|
|
ArrayList<ContentProviderOperation> operations = new ArrayList<>(cursor.getCount());
|
|
|
- String defaultSavePath = FileStorageUtils.getSavePath(account.name);
|
|
|
+ String defaultSavePath = FileStorageUtils.getSavePath(user.getAccountName());
|
|
|
List<String> originalPathsToTriggerMediaScan = new ArrayList<>();
|
|
|
List<String> newPathsToTriggerMediaScan = new ArrayList<>();
|
|
|
|
|
@@ -779,7 +769,7 @@ public class FileDataStorageManager {
|
|
|
}
|
|
|
|
|
|
/// 4. move in local file system
|
|
|
- String originalLocalPath = FileStorageUtils.getDefaultSavePathFor(account.name, ocFile);
|
|
|
+ String originalLocalPath = FileStorageUtils.getDefaultSavePathFor(user.getAccountName(), ocFile);
|
|
|
String targetLocalPath = defaultSavePath + targetPath;
|
|
|
File localFile = new File(originalLocalPath);
|
|
|
boolean renamed = false;
|
|
@@ -811,10 +801,10 @@ public class FileDataStorageManager {
|
|
|
|
|
|
public void copyLocalFile(OCFile ocFile, String targetPath) {
|
|
|
if (ocFile.fileExists() && !OCFile.ROOT_PATH.equals(ocFile.getFileName())) {
|
|
|
- String localPath = FileStorageUtils.getDefaultSavePathFor(account.name, ocFile);
|
|
|
+ String localPath = FileStorageUtils.getDefaultSavePathFor(user.getAccountName(), ocFile);
|
|
|
File localFile = new File(localPath);
|
|
|
boolean copied = false;
|
|
|
- String defaultSavePath = FileStorageUtils.getSavePath(account.name);
|
|
|
+ String defaultSavePath = FileStorageUtils.getSavePath(user.getAccountName());
|
|
|
if (localFile.exists()) {
|
|
|
File targetFile = new File(defaultSavePath + targetPath);
|
|
|
File targetFolder = targetFile.getParentFile();
|
|
@@ -827,6 +817,10 @@ public class FileDataStorageManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * This method does not require {@link FileDataStorageManager} being initialized
|
|
|
+ * with any specific user. Migration can be performed with {@link com.nextcloud.client.account.AnonymousUser}.
|
|
|
+ */
|
|
|
public void migrateStoredFiles(String sourcePath, String destinationPath)
|
|
|
throws RemoteException, OperationApplicationException {
|
|
|
Cursor cursor;
|
|
@@ -961,14 +955,14 @@ public class FileDataStorageManager {
|
|
|
key + AND
|
|
|
+ ProviderTableMeta.FILE_ACCOUNT_OWNER
|
|
|
+ "=?",
|
|
|
- new String[]{value, account.name}, null);
|
|
|
+ new String[]{value, user.getAccountName()}, null);
|
|
|
} else {
|
|
|
try {
|
|
|
cursor = getContentProviderClient().query(
|
|
|
ProviderTableMeta.CONTENT_URI,
|
|
|
null,
|
|
|
key + AND + ProviderTableMeta.FILE_ACCOUNT_OWNER
|
|
|
- + "=?", new String[]{value, account.name},
|
|
|
+ + "=?", new String[]{value, user.getAccountName()},
|
|
|
null);
|
|
|
} catch (RemoteException e) {
|
|
|
Log_OC.e(TAG, "Could not get file details: " + e.getMessage(), e);
|
|
@@ -998,7 +992,7 @@ public class FileDataStorageManager {
|
|
|
// try to find existing file and bind it with current account;
|
|
|
// with the current update of SynchronizeFolderOperation, this won't be
|
|
|
// necessary anymore after a full synchronization of the account
|
|
|
- File file = new File(FileStorageUtils.getDefaultSavePathFor(account.name, ocFile));
|
|
|
+ File file = new File(FileStorageUtils.getDefaultSavePathFor(user.getAccountName(), ocFile));
|
|
|
if (file.exists()) {
|
|
|
ocFile.setStoragePath(file.getAbsolutePath());
|
|
|
ocFile.setLastSyncDateForData(file.lastModified());
|
|
@@ -1159,7 +1153,7 @@ public class FileDataStorageManager {
|
|
|
null,
|
|
|
key + AND
|
|
|
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?",
|
|
|
- new String[]{value, account.name},
|
|
|
+ new String[]{value, user.getAccountName()},
|
|
|
null
|
|
|
);
|
|
|
} else {
|
|
@@ -1168,7 +1162,7 @@ public class FileDataStorageManager {
|
|
|
ProviderTableMeta.CONTENT_URI_SHARE,
|
|
|
null,
|
|
|
key + AND + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?",
|
|
|
- new String[]{value, account.name},
|
|
|
+ new String[]{value, user.getAccountName()},
|
|
|
null
|
|
|
);
|
|
|
} catch (RemoteException e) {
|
|
@@ -1204,21 +1198,21 @@ public class FileDataStorageManager {
|
|
|
selectionArgs = new String[]{
|
|
|
path,
|
|
|
Integer.toString(type.getValue()),
|
|
|
- account.name
|
|
|
+ user.getAccountName()
|
|
|
};
|
|
|
} else {
|
|
|
if (shareWith == null) {
|
|
|
selectionArgs = new String[]{
|
|
|
path,
|
|
|
Integer.toString(type.getValue()),
|
|
|
- account.name,
|
|
|
+ user.getAccountName(),
|
|
|
""
|
|
|
};
|
|
|
} else {
|
|
|
selectionArgs = new String[]{
|
|
|
path,
|
|
|
Integer.toString(type.getValue()),
|
|
|
- account.name,
|
|
|
+ user.getAccountName(),
|
|
|
shareWith
|
|
|
};
|
|
|
}
|
|
@@ -1273,7 +1267,7 @@ public class FileDataStorageManager {
|
|
|
contentValues.put(ProviderTableMeta.OCSHARES_IS_DIRECTORY, share.isFolder() ? 1 : 0);
|
|
|
contentValues.put(ProviderTableMeta.OCSHARES_USER_ID, share.getUserId());
|
|
|
contentValues.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getRemoteId());
|
|
|
- contentValues.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, account.name);
|
|
|
+ contentValues.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, user.getAccountName());
|
|
|
contentValues.put(ProviderTableMeta.OCSHARES_IS_PASSWORD_PROTECTED, share.isPasswordProtected() ? 1 : 0);
|
|
|
contentValues.put(ProviderTableMeta.OCSHARES_NOTE, share.getNote());
|
|
|
contentValues.put(ProviderTableMeta.OCSHARES_HIDE_DOWNLOAD, share.isHideFileDownload());
|
|
@@ -1312,7 +1306,7 @@ public class FileDataStorageManager {
|
|
|
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, Boolean.FALSE);
|
|
|
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, Boolean.FALSE);
|
|
|
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?";
|
|
|
- String[] whereArgs = new String[]{account.name};
|
|
|
+ String[] whereArgs = new String[]{user.getAccountName()};
|
|
|
|
|
|
if (getContentResolver() != null) {
|
|
|
getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs);
|
|
@@ -1331,7 +1325,7 @@ public class FileDataStorageManager {
|
|
|
contentValues.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, Boolean.FALSE);
|
|
|
contentValues.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, Boolean.FALSE);
|
|
|
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PARENT + " = ?";
|
|
|
- String[] whereArgs = new String[]{account.name, String.valueOf(folder.getFileId())};
|
|
|
+ String[] whereArgs = new String[]{user.getAccountName(), String.valueOf(folder.getFileId())};
|
|
|
|
|
|
if (getContentResolver() != null) {
|
|
|
getContentResolver().update(ProviderTableMeta.CONTENT_URI, contentValues, where, whereArgs);
|
|
@@ -1350,7 +1344,7 @@ public class FileDataStorageManager {
|
|
|
contentValues.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, Boolean.FALSE);
|
|
|
contentValues.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, Boolean.FALSE);
|
|
|
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + " = ?";
|
|
|
- String[] whereArgs = new String[]{account.name, filePath};
|
|
|
+ String[] whereArgs = new String[]{user.getAccountName(), filePath};
|
|
|
|
|
|
if (getContentResolver() != null) {
|
|
|
getContentResolver().update(ProviderTableMeta.CONTENT_URI, contentValues, where, whereArgs);
|
|
@@ -1367,7 +1361,7 @@ public class FileDataStorageManager {
|
|
|
@VisibleForTesting
|
|
|
public void cleanShares() {
|
|
|
String where = ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?";
|
|
|
- String[] whereArgs = new String[]{account.name};
|
|
|
+ String[] whereArgs = new String[]{user.getAccountName()};
|
|
|
|
|
|
if (getContentResolver() != null) {
|
|
|
getContentResolver().delete(ProviderTableMeta.CONTENT_URI_SHARE, where, whereArgs);
|
|
@@ -1450,7 +1444,7 @@ public class FileDataStorageManager {
|
|
|
if (!file.isFolder()) {
|
|
|
cv.put(ProviderTableMeta.FILE_STORAGE_PATH, file.getStoragePath());
|
|
|
}
|
|
|
- cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, account.name);
|
|
|
+ cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, user.getAccountName());
|
|
|
cv.put(ProviderTableMeta.FILE_LAST_SYNC_DATE, file.getLastSyncDateForProperties());
|
|
|
cv.put(
|
|
|
ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA,
|
|
@@ -1511,7 +1505,7 @@ public class FileDataStorageManager {
|
|
|
Uri contentUriShare = ProviderTableMeta.CONTENT_URI_SHARE;
|
|
|
String where = ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + AND +
|
|
|
ProviderTableMeta._ID + " = ?";
|
|
|
- String[] whereArgs = {account.name, Long.toString(share.getId())};
|
|
|
+ String[] whereArgs = {user.getAccountName(), Long.toString(share.getId())};
|
|
|
|
|
|
if (getContentProviderClient() != null) {
|
|
|
try {
|
|
@@ -1634,7 +1628,7 @@ public class FileDataStorageManager {
|
|
|
if (folder != null) {
|
|
|
String where = ProviderTableMeta.OCSHARES_PATH + AND
|
|
|
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?";
|
|
|
- String[] whereArgs = new String[]{"", account.name};
|
|
|
+ String[] whereArgs = new String[]{"", user.getAccountName()};
|
|
|
|
|
|
List<OCFile> files = getFolderContent(folder, false);
|
|
|
|
|
@@ -1655,7 +1649,7 @@ public class FileDataStorageManager {
|
|
|
|
|
|
String where = ProviderTableMeta.OCSHARES_PATH + AND
|
|
|
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + " = ?";
|
|
|
- String[] whereArgs = new String[]{filePath, account.name};
|
|
|
+ String[] whereArgs = new String[]{filePath, user.getAccountName()};
|
|
|
|
|
|
preparedOperations.add(
|
|
|
ContentProviderOperation
|
|
@@ -1888,7 +1882,7 @@ public class FileDataStorageManager {
|
|
|
ProviderTableMeta.CONTENT_URI_FILE,
|
|
|
projection,
|
|
|
whereForDescencentsInConflict,
|
|
|
- new String[]{account.name, parentPath + "%"},
|
|
|
+ new String[]{user.getAccountName(), parentPath + "%"},
|
|
|
null
|
|
|
);
|
|
|
} else {
|
|
@@ -1897,7 +1891,7 @@ public class FileDataStorageManager {
|
|
|
ProviderTableMeta.CONTENT_URI_FILE,
|
|
|
projection,
|
|
|
whereForDescencentsInConflict,
|
|
|
- new String[]{account.name, parentPath + "%"},
|
|
|
+ new String[]{user.getAccountName(), parentPath + "%"},
|
|
|
null
|
|
|
);
|
|
|
} catch (RemoteException e) {
|
|
@@ -1913,7 +1907,7 @@ public class FileDataStorageManager {
|
|
|
cv,
|
|
|
ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
|
|
|
ProviderTableMeta.FILE_PATH + "=?",
|
|
|
- new String[]{account.name, parentPath}
|
|
|
+ new String[]{user.getAccountName(), parentPath}
|
|
|
);
|
|
|
} else {
|
|
|
try {
|
|
@@ -1922,7 +1916,7 @@ public class FileDataStorageManager {
|
|
|
cv,
|
|
|
ProviderTableMeta.FILE_ACCOUNT_OWNER + AND +
|
|
|
ProviderTableMeta.FILE_PATH + "=?"
|
|
|
- , new String[]{account.name, parentPath}
|
|
|
+ , new String[]{user.getAccountName(), parentPath}
|
|
|
);
|
|
|
} catch (RemoteException e) {
|
|
|
Log_OC.e(TAG, "Failed saving conflict in database " + e.getMessage(), e);
|
|
@@ -1947,18 +1941,18 @@ public class FileDataStorageManager {
|
|
|
|
|
|
public void saveCapabilities(OCCapability capability) {
|
|
|
// Prepare capabilities data
|
|
|
- ContentValues contentValues = createContentValues(account.name, capability);
|
|
|
+ ContentValues contentValues = createContentValues(user.getAccountName(), capability);
|
|
|
|
|
|
- if (capabilityExists(account.name)) {
|
|
|
+ if (capabilityExists(user.getAccountName())) {
|
|
|
if (getContentResolver() != null) {
|
|
|
getContentResolver().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES, contentValues,
|
|
|
ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
|
|
|
- new String[]{account.name});
|
|
|
+ new String[]{user.getAccountName()});
|
|
|
} else {
|
|
|
try {
|
|
|
getContentProviderClient().update(ProviderTableMeta.CONTENT_URI_CAPABILITIES,
|
|
|
contentValues, ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
|
|
|
- new String[]{account.name});
|
|
|
+ new String[]{user.getAccountName()});
|
|
|
} catch (RemoteException e) {
|
|
|
Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
|
|
}
|
|
@@ -1980,7 +1974,7 @@ public class FileDataStorageManager {
|
|
|
long new_id = Long.parseLong(result_uri.getPathSegments()
|
|
|
.get(1));
|
|
|
capability.setId(new_id);
|
|
|
- capability.setAccountName(account.name);
|
|
|
+ capability.setAccountName(user.getAccountName());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2340,7 +2334,7 @@ public class FileDataStorageManager {
|
|
|
public void deleteAllFiles() {
|
|
|
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + "= ? AND " +
|
|
|
ProviderTableMeta.FILE_PATH + "= ?";
|
|
|
- String[] whereArgs = new String[]{account.name, OCFile.ROOT_PATH};
|
|
|
+ String[] whereArgs = new String[]{user.getAccountName(), OCFile.ROOT_PATH};
|
|
|
|
|
|
if (getContentResolver() != null) {
|
|
|
getContentResolver().delete(ProviderTableMeta.CONTENT_URI_DIR, where, whereArgs);
|
|
@@ -2348,14 +2342,14 @@ public class FileDataStorageManager {
|
|
|
try {
|
|
|
getContentProviderClient().delete(ProviderTableMeta.CONTENT_URI_DIR, where, whereArgs);
|
|
|
} catch (RemoteException e) {
|
|
|
- Log_OC.e(TAG, "Exception in deleteAllFiles for account " + account.name + ": " + e.getMessage(), e);
|
|
|
+ Log_OC.e(TAG, "Exception in deleteAllFiles for account " + user.getAccountName() + ": " + e.getMessage(), e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public List<OCFile> getAllFiles() {
|
|
|
String selection = ProviderTableMeta.FILE_ACCOUNT_OWNER + "= ? ";
|
|
|
- String[] selectionArgs = new String[]{account.name};
|
|
|
+ String[] selectionArgs = new String[]{user.getAccountName()};
|
|
|
|
|
|
List<OCFile> folderContent = new ArrayList<>();
|
|
|
|
|
@@ -2409,7 +2403,8 @@ public class FileDataStorageManager {
|
|
|
return this.contentProviderClient;
|
|
|
}
|
|
|
|
|
|
+ @Deprecated
|
|
|
public Account getAccount() {
|
|
|
- return this.account;
|
|
|
+ return this.user.toPlatformAccount();
|
|
|
}
|
|
|
}
|