diff --git a/src/com/owncloud/android/lib/operations/remote/RemoveRemoteShareOperation.java b/src/com/owncloud/android/lib/operations/remote/RemoveRemoteShareOperation.java index 67ebc7a1..932774ff 100644 --- a/src/com/owncloud/android/lib/operations/remote/RemoveRemoteShareOperation.java +++ b/src/com/owncloud/android/lib/operations/remote/RemoveRemoteShareOperation.java @@ -50,16 +50,16 @@ public class RemoveRemoteShareOperation extends RemoteOperation { private static final String TAG = RemoveRemoteShareOperation.class.getSimpleName(); - private int mIdShare; + private int mRemoteShareId; /** * Constructor * - * @param idShare Share ID + * @param remoteShareId Share ID */ - public RemoveRemoteShareOperation(int idShare) { - mIdShare = idShare; + public RemoveRemoteShareOperation(int remoteShareId) { + mRemoteShareId = remoteShareId; } @@ -71,9 +71,9 @@ public class RemoveRemoteShareOperation extends RemoteOperation { DeleteMethod delete = null; try { - String id = "/" + String.valueOf(mIdShare); - delete = new DeleteMethod(client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE + id); - Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE + id); + String id = "/" + String.valueOf(mRemoteShareId); + delete = new DeleteMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH + id); + Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHARING_API_PATH + id); status = client.executeMethod(delete); diff --git a/src/com/owncloud/android/lib/resources/files/ChunkedUploadRemoteFileOperation.java b/src/com/owncloud/android/lib/resources/files/ChunkedUploadRemoteFileOperation.java index 411c65e4..632b660c 100644 --- a/src/com/owncloud/android/lib/resources/files/ChunkedUploadRemoteFileOperation.java +++ b/src/com/owncloud/android/lib/resources/files/ChunkedUploadRemoteFileOperation.java @@ -60,7 +60,7 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation FileChannel channel = null; RandomAccessFile raf = null; try { - File file = new File(mStoragePath); + File file = new File(mLocalPath); raf = new RandomAccessFile(file, "r"); channel = raf.getChannel(); mEntity = new ChunkFromFileChannelRequestEntity(channel, mMimeType, CHUNK_SIZE, file); @@ -82,7 +82,7 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation mPutMethod.setRequestEntity(mEntity); status = client.executeMethod(mPutMethod); client.exhaustResponse(mPutMethod.getResponseBodyAsStream()); - Log.d(TAG, "Upload of " + mStoragePath + " to " + mRemotePath + ", chunk index " + chunkIndex + ", count " + chunkCount + ", HTTP result status " + status); + Log.d(TAG, "Upload of " + mLocalPath + " to " + mRemotePath + ", chunk index " + chunkIndex + ", count " + chunkCount + ", HTTP result status " + status); if (!isSuccess(status)) break; } diff --git a/src/com/owncloud/android/lib/resources/files/DownloadRemoteFileOperation.java b/src/com/owncloud/android/lib/resources/files/DownloadRemoteFileOperation.java index 99f99b05..6b91bb72 100644 --- a/src/com/owncloud/android/lib/resources/files/DownloadRemoteFileOperation.java +++ b/src/com/owncloud/android/lib/resources/files/DownloadRemoteFileOperation.java @@ -65,11 +65,11 @@ public class DownloadRemoteFileOperation extends RemoteOperation { private GetMethod mGet; private String mRemotePath; - private String mDownloadFolderPath; + private String mLocalFolderPath; - public DownloadRemoteFileOperation(String remotePath, String downloadFolderPath) { + public DownloadRemoteFileOperation(String remotePath, String localFolderPath) { mRemotePath = remotePath; - mDownloadFolderPath = downloadFolderPath; + mLocalFolderPath = localFolderPath; } @Override @@ -157,7 +157,7 @@ public class DownloadRemoteFileOperation extends RemoteOperation { } private String getTmpPath() { - return mDownloadFolderPath + mRemotePath; + return mLocalFolderPath + mRemotePath; } public void addDatatransferProgressListener (OnDatatransferProgressListener listener) { diff --git a/src/com/owncloud/android/lib/resources/files/ExistenceCheckRemoteOperation.java b/src/com/owncloud/android/lib/resources/files/ExistenceCheckRemoteOperation.java index 27326a4c..bd2adbd9 100644 --- a/src/com/owncloud/android/lib/resources/files/ExistenceCheckRemoteOperation.java +++ b/src/com/owncloud/android/lib/resources/files/ExistenceCheckRemoteOperation.java @@ -56,12 +56,12 @@ public class ExistenceCheckRemoteOperation extends RemoteOperation { /** * Full constructor. Success of the operation will depend upon the value of successIfAbsent. * - * @param path Path to append to the URL owned by the client instance. + * @param remotePath Path to append to the URL owned by the client instance. * @param context Android application context. * @param successIfAbsent When 'true', the operation finishes in success if the path does NOT exist in the remote server (HTTP 404). */ - public ExistenceCheckRemoteOperation(String path, Context context, boolean successIfAbsent) { - mPath = (path != null) ? path : ""; + public ExistenceCheckRemoteOperation(String remotePath, Context context, boolean successIfAbsent) { + mPath = (remotePath != null) ? remotePath : ""; mContext = context; mSuccessIfAbsent = successIfAbsent; } diff --git a/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java b/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java index ded2945a..3e95075c 100644 --- a/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java +++ b/src/com/owncloud/android/lib/resources/files/ReadRemoteFolderOperation.java @@ -126,24 +126,24 @@ public class ReadRemoteFolderOperation extends RemoteOperation { * Read the data retrieved from the server about the contents of the target folder * * - * @param dataInServer Full response got from the server with the data of the target + * @param remoteData Full response got from the server with the data of the target * folder and its direct children. * @param client Client instance to the remote server where the data were * retrieved. * @return */ - private void readData(MultiStatus dataInServer, OwnCloudClient client) { + private void readData(MultiStatus remoteData, OwnCloudClient client) { mFolderAndFiles = new ArrayList(); // parse data from remote folder - WebdavEntry we = new WebdavEntry(dataInServer.getResponses()[0], client.getWebdavUri().getPath()); + WebdavEntry we = new WebdavEntry(remoteData.getResponses()[0], client.getWebdavUri().getPath()); mFolderAndFiles.add(fillOCFile(we)); // loop to update every child RemoteFile remoteFile = null; - for (int i = 1; i < dataInServer.getResponses().length; ++i) { + for (int i = 1; i < remoteData.getResponses().length; ++i) { /// new OCFile instance with the data from the server - we = new WebdavEntry(dataInServer.getResponses()[i], client.getWebdavUri().getPath()); + we = new WebdavEntry(remoteData.getResponses()[i], client.getWebdavUri().getPath()); remoteFile = fillOCFile(we); mFolderAndFiles.add(remoteFile); } diff --git a/src/com/owncloud/android/lib/resources/files/UploadRemoteFileOperation.java b/src/com/owncloud/android/lib/resources/files/UploadRemoteFileOperation.java index 821a753a..962b1f09 100644 --- a/src/com/owncloud/android/lib/resources/files/UploadRemoteFileOperation.java +++ b/src/com/owncloud/android/lib/resources/files/UploadRemoteFileOperation.java @@ -54,7 +54,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult; public class UploadRemoteFileOperation extends RemoteOperation { - protected String mStoragePath; + protected String mLocalPath; protected String mRemotePath; protected String mMimeType; protected PutMethod mPutMethod = null; @@ -64,8 +64,8 @@ public class UploadRemoteFileOperation extends RemoteOperation { protected RequestEntity mEntity = null; - public UploadRemoteFileOperation(String storagePath, String remotePath, String mimeType) { - mStoragePath = storagePath; + public UploadRemoteFileOperation(String localPath, String remotePath, String mimeType) { + mLocalPath = localPath; mRemotePath = remotePath; mMimeType = mimeType; } @@ -106,7 +106,7 @@ public class UploadRemoteFileOperation extends RemoteOperation { protected int uploadFile(OwnCloudClient client) throws HttpException, IOException, OperationCancelledException { int status = -1; try { - File f = new File(mStoragePath); + File f = new File(mLocalPath); mEntity = new FileRequestEntity(f, mMimeType); synchronized (mDataTransferListeners) { ((ProgressiveDataTransferer)mEntity).addDatatransferProgressListeners(mDataTransferListeners); diff --git a/src/com/owncloud/android/lib/resources/shares/CreateRemoteShareOperation.java b/src/com/owncloud/android/lib/resources/shares/CreateRemoteShareOperation.java index d6ebc343..45995508 100644 --- a/src/com/owncloud/android/lib/resources/shares/CreateRemoteShareOperation.java +++ b/src/com/owncloud/android/lib/resources/shares/CreateRemoteShareOperation.java @@ -57,7 +57,7 @@ public class CreateRemoteShareOperation extends RemoteOperation { private ArrayList mShares; // List of shares for result, one share in this case - private String mPath; + private String mRemoteFilePath; private ShareType mShareType; private String mShareWith; private boolean mPublicUpload; @@ -66,26 +66,26 @@ public class CreateRemoteShareOperation extends RemoteOperation { /** * Constructor - * @param path Full path of the file/folder being shared. Mandatory argument - * @param shareType ‘0’ = user, ‘1’ = group, ‘3’ = Public link. Mandatory argument - * @param shareWith User/group ID with who the file should be shared. This is mandatory for shareType of 0 or 1 - * @param publicUpload If ‘false’ (default) public cannot upload to a public shared folder. - * If ‘true’ public can upload to a shared folder. Only available for public link shares - * @param password Password to protect a public link share. Only available for public link shares - * @param permissions 1 - Read only – Default for “public” shares - * 2 - Update - * 4 - Create - * 8 - Delete - * 16- Re-share - * 31- All above – Default for “private” shares - * For user or group shares. - * To obtain combinations, add the desired values together. - * For instance, for “Re-Share”, “delete”, “read”, “update”, add 16+8+2+1 = 27. + * @param remoteFilePath Full path of the file/folder being shared. Mandatory argument + * @param shareType ‘0’ = user, ‘1’ = group, ‘3’ = Public link. Mandatory argument + * @param shareWith User/group ID with who the file should be shared. This is mandatory for shareType of 0 or 1 + * @param publicUpload If ‘false’ (default) public cannot upload to a public shared folder. + * If ‘true’ public can upload to a shared folder. Only available for public link shares + * @param password Password to protect a public link share. Only available for public link shares + * @param permissions 1 - Read only – Default for “public” shares + * 2 - Update + * 4 - Create + * 8 - Delete + * 16- Re-share + * 31- All above – Default for “private” shares + * For user or group shares. + * To obtain combinations, add the desired values together. + * For instance, for “Re-Share”, “delete”, “read”, “update”, add 16+8+2+1 = 27. */ - public CreateRemoteShareOperation(String path, ShareType shareType, String shareWith, boolean publicUpload, + public CreateRemoteShareOperation(String remoteFilePath, ShareType shareType, String shareWith, boolean publicUpload, String password, int permissions) { - mPath = path; + mRemoteFilePath = remoteFilePath; mShareType = shareType; mShareWith = shareWith; mPublicUpload = publicUpload; @@ -102,11 +102,11 @@ public class CreateRemoteShareOperation extends RemoteOperation { try { // Post Method - post = new PostMethod(client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE); - Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE); + post = new PostMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH); + Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHARING_API_PATH); post.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); // necessary for special characters - post.addParameter(PARAM_PATH, mPath); + post.addParameter(PARAM_PATH, mRemoteFilePath); post.addParameter(PARAM_SHARE_TYPE, Integer.toString(mShareType.getValue())); post.addParameter(PARAM_SHARE_WITH, mShareWith); post.addParameter(PARAM_PUBLIC_UPLOAD, Boolean.toString(mPublicUpload)); diff --git a/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java b/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java index 86dc3d33..6b79ac55 100644 --- a/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java +++ b/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesForFileOperation.java @@ -58,21 +58,21 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation { private ArrayList mShares; // List of shares for result, one share in this case - private String mPath; + private String mRemoteFilePath; private boolean mReshares; private boolean mSubfiles; /** * Constructor * - * @param path Path to file or folder - * @param reshares If set to ‘false’ (default), only shares from the current user are returned - * If set to ‘true’, all shares from the given file are returned - * @param subfiles If set to ‘false’ (default), lists only the folder being shared - * If set to ‘true’, all shared files within the folder are returned. + * @param remoteFilePath Path to file or folder + * @param reshares If set to ‘false’ (default), only shares from the current user are returned + * If set to ‘true’, all shares from the given file are returned + * @param subfiles If set to ‘false’ (default), lists only the folder being shared + * If set to ‘true’, all shared files within the folder are returned. */ - public GetRemoteSharesForFileOperation(String path, boolean reshares, boolean subfiles) { - mPath = path; + public GetRemoteSharesForFileOperation(String remoteFilePath, boolean reshares, boolean subfiles) { + mRemoteFilePath = remoteFilePath; mReshares = reshares; mSubfiles = subfiles; } @@ -86,12 +86,12 @@ public class GetRemoteSharesForFileOperation extends RemoteOperation { try { // Get Method - get = new GetMethod(client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE); - Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE); + get = new GetMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH); + Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHARING_API_PATH); // Add Parameters to Get Method get.setQueryString(new NameValuePair[] { - new NameValuePair(PARAM_PATH, mPath), + new NameValuePair(PARAM_PATH, mRemoteFilePath), new NameValuePair(PARAM_RESHARES, String.valueOf(mReshares)), new NameValuePair(PARAM_SUBFILES, String.valueOf(mSubfiles)) }); diff --git a/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesOperation.java b/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesOperation.java index 43db4234..f3c69508 100644 --- a/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesOperation.java +++ b/src/com/owncloud/android/lib/resources/shares/GetRemoteSharesOperation.java @@ -66,8 +66,8 @@ public class GetRemoteSharesOperation extends RemoteOperation { // Get the response try{ - get = new GetMethod(client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE); - Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHAREAPI_ROUTE); + get = new GetMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH); + Log.d(TAG, "URL ------> " + client.getBaseUri() + ShareUtils.SHARING_API_PATH); status = client.executeMethod(get); if(isSuccess(status)) { Log.d(TAG, "Obtain RESPONSE"); diff --git a/src/com/owncloud/android/lib/resources/shares/ShareUtils.java b/src/com/owncloud/android/lib/resources/shares/ShareUtils.java index c977c908..668a0ccd 100644 --- a/src/com/owncloud/android/lib/resources/shares/ShareUtils.java +++ b/src/com/owncloud/android/lib/resources/shares/ShareUtils.java @@ -34,6 +34,6 @@ package com.owncloud.android.lib.resources.shares; public class ShareUtils { // OCS Route - public static final String SHAREAPI_ROUTE ="/ocs/v1.php/apps/files_sharing/api/v1/shares"; + public static final String SHARING_API_PATH ="/ocs/v1.php/apps/files_sharing/api/v1/shares"; } diff --git a/src/com/owncloud/android/lib/resources/status/GetRemoteStatusOperation.java b/src/com/owncloud/android/lib/resources/status/GetRemoteStatusOperation.java index 2636977f..95d41078 100644 --- a/src/com/owncloud/android/lib/resources/status/GetRemoteStatusOperation.java +++ b/src/com/owncloud/android/lib/resources/status/GetRemoteStatusOperation.java @@ -33,7 +33,6 @@ import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.accounts.AccountUtils; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; import android.content.Context; import android.net.ConnectivityManager;