Search in sources :

Example 11 with ExistenceCheckRemoteOperation

use of com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation 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

ExistenceCheckRemoteOperation (com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation)11 RemoteOperationResult (com.owncloud.android.lib.common.operations.RemoteOperationResult)10 RemoteOperation (com.owncloud.android.lib.common.operations.RemoteOperation)4 ArrayList (java.util.ArrayList)3 Uri (android.net.Uri)2 OCFile (com.owncloud.android.datamodel.OCFile)2 OwnCloudClient (com.owncloud.android.lib.common.OwnCloudClient)2 OwnCloudCredentials (com.owncloud.android.lib.common.OwnCloudCredentials)2 RedirectionPath (com.owncloud.android.lib.common.network.RedirectionPath)2 Activity (android.app.Activity)1 Context (android.content.Context)1 NextcloudClient (com.nextcloud.common.NextcloudClient)1 DecryptedFolderMetadata (com.owncloud.android.datamodel.DecryptedFolderMetadata)1 UserInfo (com.owncloud.android.lib.common.UserInfo)1 UnlockFileRemoteOperation (com.owncloud.android.lib.resources.e2ee.UnlockFileRemoteOperation)1 ChunkedFileUploadRemoteOperation (com.owncloud.android.lib.resources.files.ChunkedFileUploadRemoteOperation)1 CreateFolderRemoteOperation (com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation)1 ReadFileRemoteOperation (com.owncloud.android.lib.resources.files.ReadFileRemoteOperation)1 UploadFileRemoteOperation (com.owncloud.android.lib.resources.files.UploadFileRemoteOperation)1 RemoteFile (com.owncloud.android.lib.resources.files.model.RemoteFile)1