1
0
mirror of https://github.com/owncloud/android-library.git synced 2026-08-16 10:53:06 +00:00

Updated CopyRemoteFileOperation and verified with the unit tests

This commit is contained in:
Jorge Antonio Diaz-Benito Soriano
2014-11-04 15:56:30 +01:00
committed by David A. Velasco
parent 8633efbb49
commit 2970b54e7c
2 changed files with 25 additions and 28 deletions
@@ -24,6 +24,7 @@
package com.owncloud.android.lib.resources.files;
import android.content.Context;
import android.util.Log;
import com.owncloud.android.lib.common.OwnCloudClient;
@@ -61,6 +62,7 @@ public class CopyRemoteFileOperation extends RemoteOperation {
private String mTargetRemotePath;
private boolean mOverwrite;
private Context mContext;
/**
@@ -71,10 +73,9 @@ public class CopyRemoteFileOperation extends RemoteOperation {
* @param srcRemotePath Remote path of the file/folder to move.
* @param targetRemotePath Remove path desired for the file/folder after moving it.
*/
public CopyRemoteFileOperation(
String srcRemotePath, String targetRemotePath, boolean overwrite
public CopyRemoteFileOperation(Context context, String srcRemotePath, String targetRemotePath, boolean overwrite
) {
mContext = context;
mSrcRemotePath = srcRemotePath;
mTargetRemotePath = targetRemotePath;
mOverwrite = overwrite;
@@ -107,6 +108,10 @@ public class CopyRemoteFileOperation extends RemoteOperation {
return new RemoteOperationResult(ResultCode.INVALID_COPY_INTO_DESCENDANT);
}
if (!new ExistenceCheckRemoteOperation(mSrcRemotePath, mContext, Boolean.FALSE).run(getClient()).isSuccess()) {
return new RemoteOperationResult(ResultCode.FILE_NOT_FOUND);
}
/// perform remote operation
CopyMethod copyMethod = null;
RemoteOperationResult result = null;