Search in sources :

Example 31 with RemoteOperation

use of com.owncloud.android.lib.common.operations.RemoteOperation in project android by nextcloud.

the class CheckCurrentCredentialsOperation method run.

@Override
protected RemoteOperationResult run(OwnCloudClient client) {
    RemoteOperationResult result;
    boolean validAccount = user.nameEquals(getStorageManager().getUser().getAccountName());
    if (!validAccount) {
        result = new RemoteOperationResult(new IllegalStateException("Account to validate is not the account connected to!"));
    } else {
        RemoteOperation check = new ExistenceCheckRemoteOperation(OCFile.ROOT_PATH, false);
        result = check.execute(client);
        ArrayList<Object> data = new ArrayList<>();
        data.add(user.toPlatformAccount());
        result.setData(data);
    }
    return result;
}
Also used : ExistenceCheckRemoteOperation(com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation) RemoteOperation(com.owncloud.android.lib.common.operations.RemoteOperation) ExistenceCheckRemoteOperation(com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation) RemoteOperationResult(com.owncloud.android.lib.common.operations.RemoteOperationResult) ArrayList(java.util.ArrayList)

Aggregations

RemoteOperation (com.owncloud.android.lib.common.operations.RemoteOperation)31 RemoteOperationResult (com.owncloud.android.lib.common.operations.RemoteOperationResult)24 Account (android.accounts.Account)7 OCFile (com.owncloud.android.datamodel.OCFile)7 OwnCloudAccount (com.owncloud.android.lib.common.OwnCloudAccount)7 Pair (android.util.Pair)6 OCShare (com.owncloud.android.lib.resources.shares.OCShare)6 ArrayList (java.util.ArrayList)6 RefreshFolderOperation (com.owncloud.android.operations.RefreshFolderOperation)5 Handler (android.os.Handler)4 ExistenceCheckRemoteOperation (com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation)4 GetUserInfoRemoteOperation (com.owncloud.android.lib.resources.users.GetUserInfoRemoteOperation)4 User (com.nextcloud.client.account.User)3 FileDataStorageManager (com.owncloud.android.datamodel.FileDataStorageManager)3 ReadFileRemoteOperation (com.owncloud.android.lib.resources.files.ReadFileRemoteOperation)3 RestoreFileVersionRemoteOperation (com.owncloud.android.lib.resources.files.RestoreFileVersionRemoteOperation)3 SearchRemoteOperation (com.owncloud.android.lib.resources.files.SearchRemoteOperation)3 GetShareRemoteOperation (com.owncloud.android.lib.resources.shares.GetShareRemoteOperation)3 UpdateShareRemoteOperation (com.owncloud.android.lib.resources.shares.UpdateShareRemoteOperation)3 AuthenticatorException (android.accounts.AuthenticatorException)2