public RemoteOperationResult execute(OwnCloudClient client) { return execute(client, false); }
/** * Synchronously executes the remote operation * * Do not call this method from the main thread. * * @param client Client object to reach an ownCloud server during the execution of * the operation. * @return Result of the operation. */ public RemoteOperationResult<T> execute(OkHttpClient client, Context context) { if (client == null) throw new IllegalArgumentException("Trying to execute a remote operation with a NULL " + "OwnCloudClient"); mHttpClient = client; mContext = context; return runOperation(); }
/** * Run operation for asynchronous or synchronous 'onExecute' method. * * Considers and performs silent refresh of account credentials if possible, and if * {@link RemoteOperation#setSilentRefreshOfAccountCredentials(boolean)} was called with * parameter 'true' before the execution. * * @return Remote operation result */ private RemoteOperationResult<T> runOperation() { RemoteOperationResult<T> result; try { grantOwnCloudClient(); result = run(mClient); } catch (AccountsException | IOException e) { Log_OC.e(TAG, "Error while trying to access to " + mAccount.name, e); result = new RemoteOperationResult<>(e); } return result; }
/** * Synchronously executes the remote operation * * Do not call this method from the main thread. * * @param client Client object to reach an ownCloud server during the execution of * the operation. * @return Result of the operation. */ public RemoteOperationResult execute(OwnCloudClient client, boolean useNextcloudUserAgent) { if (client == null) throw new IllegalArgumentException("Trying to execute a remote operation with a NULL " + "OwnCloudClient"); mClient = client; mClient.setUseNextcloudUserAgent(useNextcloudUserAgent); return run(client); }
return new RemoteOperationResult(e); return run(mClient);
public RemoteOperationResult execute(Account account, Context context) { return execute(account, context, false); }
result = run(mClient);
/** * Synchronously executes the remote operation on the received ownCloud account. * * Do not call this method from the main thread. * * This method should be used whenever an ownCloud account is available, instead of * {@link #execute(OwnCloudClient)}. * * @param account ownCloud account in remote ownCloud server to reach during the * execution of the operation. * @param context Android context for the component calling the method. * @return Result of the operation. */ public RemoteOperationResult<T> execute(Account account, Context context) { if (account == null) throw new IllegalArgumentException("Trying to execute a remote operation with a NULL " + "Account"); if (context == null) throw new IllegalArgumentException("Trying to execute a remote operation with a NULL " + "Context"); mAccount = account; mContext = context.getApplicationContext(); return runOperation(); }
private RemoteOperationResult createParentFolder(String parentPath, OwnCloudClient client) { RemoteOperation operation = new CreateRemoteFolderOperation(parentPath, mCreateFullPath); return operation.execute(client); } }
/** * Asynchronous execution of the operation * started by {@link RemoteOperation#execute(OwnCloudClient, * OnRemoteOperationListener, Handler)}, * and result posting. */ @Override public final void run() { final RemoteOperationResult resultToSend = runOperation(); if (mAccount != null && mContext != null) { // Save Client Cookies AccountUtils.saveClient(mClient, mAccount, mContext); } if (mListenerHandler != null && mListener != null) { mListenerHandler.post(() -> mListener.onRemoteOperationFinish(RemoteOperation.this, resultToSend)); } else if (mListener != null) { mListener.onRemoteOperationFinish(RemoteOperation.this, resultToSend); } } }
private RemoteOperationResult createParentFolder(String parentPath, OwnCloudClient client) { RemoteOperation operation = new CreateFolderRemoteOperation(parentPath, mCreateFullPath); return operation.execute(client); }
/** * Synchronously executes the remote operation * * Do not call this method from the main thread. * * @param client Client object to reach an ownCloud server during the execution of * the operation. * @return Result of the operation. */ public RemoteOperationResult<T> execute(OwnCloudClient client) { if (client == null) throw new IllegalArgumentException("Trying to execute a remote operation with a NULL " + "OwnCloudClient"); mClient = client; if (client.getAccount() != null) { mAccount = client.getAccount().getSavedAccount(); } mContext = client.getContext(); return runOperation(); }
RemoteOperationResult capabilitiesResult = getCapabilities.execute(client); OCCapability capability = (OCCapability) capabilitiesResult.getData().get(0);