X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/67ecc0f262d86f4fa17cee32ec4cf61e953ff2fd..06d5cc94778ee4fe5ec49cd9061c039283ea7cdc:/src/com/owncloud/android/operations/common/SyncOperation.java diff --git a/src/com/owncloud/android/operations/common/SyncOperation.java b/src/com/owncloud/android/operations/common/SyncOperation.java index 512be4e0..86b433b8 100644 --- a/src/com/owncloud/android/operations/common/SyncOperation.java +++ b/src/com/owncloud/android/operations/common/SyncOperation.java @@ -20,6 +20,7 @@ package com.owncloud.android.operations.common; +import com.owncloud.android.MainApp; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.operations.OnRemoteOperationListener; @@ -52,21 +53,24 @@ public abstract class SyncOperation extends RemoteOperation { * * 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)}. + * This method should be used whenever an ownCloud account is available, instead of + * {@link #execute(OwnCloudClient, com.owncloud.android.datamodel.FileDataStorageManager)}. * - * @param account ownCloud account in remote ownCloud server to reach during the execution of the operation. + * @param storageManager * @param context Android context for the component calling the method. * @return Result of the operation. */ public RemoteOperationResult execute(FileDataStorageManager storageManager, Context context) { if (storageManager == null) { - throw new IllegalArgumentException("Trying to execute a sync operation with a NULL storage manager"); + throw new IllegalArgumentException("Trying to execute a sync operation with a " + + "NULL storage manager"); } if (storageManager.getAccount() == null) { - throw new IllegalArgumentException("Trying to execute a sync operation with a storage manager for a NULL account"); + throw new IllegalArgumentException("Trying to execute a sync operation with a " + + "storage manager for a NULL account"); } mStorageManager = storageManager; - return super.execute(mStorageManager.getAccount(), context); + return super.execute(mStorageManager.getAccount(), context, getUserAgent()); } @@ -75,38 +79,49 @@ public abstract class SyncOperation extends RemoteOperation { * * Do not call this method from the main thread. * - * @param client Client object to reach an ownCloud server during the execution of the operation. + * @param client Client object to reach an ownCloud server during the execution of the o + * peration. + * @param storageManager * @return Result of the operation. */ - public RemoteOperationResult execute(OwnCloudClient client, FileDataStorageManager storageManager) { + public RemoteOperationResult execute(OwnCloudClient client, + FileDataStorageManager storageManager) { if (storageManager == null) - throw new IllegalArgumentException("Trying to execute a sync operation with a NULL storage manager"); + throw new IllegalArgumentException("Trying to execute a sync operation with a " + + "NULL storage manager"); mStorageManager = storageManager; - return super.execute(client); + return super.execute(client, MainApp.getUserAgent()); } /** * Asynchronously executes the remote operation * - * This method should be used whenever an ownCloud account is available, instead of {@link #execute(OwnCloudClient)}. + * 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 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. * @param listener Listener to be notified about the execution of the operation. - * @param listenerHandler Handler associated to the thread where the methods of the listener objects must be called. + * @param listenerHandler Handler associated to the thread where the methods of the listener + * objects must be called. * @return Thread were the remote operation is executed. */ /* - public Thread execute(FileDataStorageManager storageManager, Context context, OnRemoteOperationListener listener, Handler listenerHandler, Activity callerActivity) { + public Thread execute(FileDataStorageManager storageManager, + Context context, OnRemoteOperationListener listener, Handler listenerHandler, Activity callerActivity) { if (storageManager == null) { - throw new IllegalArgumentException("Trying to execute a sync operation with a NULL storage manager"); + throw new IllegalArgumentException("Trying to execute a sync operation + with a NULL storage manager"); } if (storageManager.getAccount() == null) { - throw new IllegalArgumentException("Trying to execute a sync operation with a storage manager for a NULL account"); + throw new IllegalArgumentException("Trying to execute a sync operation with a + storage manager for a NULL account"); } mStorageManager = storageManager; - return super.execute(storageManager.getAccount(), context, listener, listenerHandler, callerActivity); + return super.execute(storageManager.getAccount(), context, listener, listenerHandler, + callerActivity); } */ @@ -114,17 +129,21 @@ public abstract class SyncOperation extends RemoteOperation { /** * Asynchronously executes the remote operation * - * @param client Client object to reach an ownCloud server during the execution of the operation. + * @param client Client object to reach an ownCloud server during the + * execution of the operation. * @param listener Listener to be notified about the execution of the operation. - * @param listenerHandler Handler associated to the thread where the methods of the listener objects must be called. + * @param listenerHandler Handler associated to the thread where the methods of + * the listener objects must be called. * @return Thread were the remote operation is executed. */ - public Thread execute(OwnCloudClient client, FileDataStorageManager storageManager, OnRemoteOperationListener listener, Handler listenerHandler) { + public Thread execute(OwnCloudClient client, FileDataStorageManager storageManager, + OnRemoteOperationListener listener, Handler listenerHandler) { if (storageManager == null) { - throw new IllegalArgumentException("Trying to execute a sync operation with a NULL storage manager"); + throw new IllegalArgumentException("Trying to execute a sync operation " + + "with a NULL storage manager"); } mStorageManager = storageManager; - return super.execute(client, listener, listenerHandler); + return super.execute(client, MainApp.getUserAgent(), listener, listenerHandler); }