Add Get Groups operation
authormasensio <masensio@solidgear.es>
Fri, 9 Oct 2015 10:30:00 +0000 (12:30 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Fri, 30 Oct 2015 14:22:57 +0000 (15:22 +0100)
src/com/owncloud/android/operations/GetUsersOperation.java [deleted file]
src/com/owncloud/android/operations/GetUsersOrGroupsOperation.java [new file with mode: 0644]

diff --git a/src/com/owncloud/android/operations/GetUsersOperation.java b/src/com/owncloud/android/operations/GetUsersOperation.java
deleted file mode 100644 (file)
index 0b95bb0..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- *   ownCloud Android client application
- *
- *   @author masensio
- *   Copyright (C) 2015 ownCloud Inc.
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License version 2,
- *   as published by the Free Software Foundation.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package com.owncloud.android.operations;
-
-import com.owncloud.android.lib.common.OwnCloudClient;
-import com.owncloud.android.lib.common.operations.RemoteOperationResult;
-import com.owncloud.android.lib.resources.users.GetRemoteUsersOperation;
-import com.owncloud.android.operations.common.SyncOperation;
-
-/**
- * Get the users from the server
- */
-public class GetUsersOperation  extends SyncOperation{
-
-    private static final String TAG = GetUsersOperation.class.getSimpleName();
-
-    private String mSearchString;
-    private int mLimit;
-    private int mOffset;
-
-    /**
-     * Constructor
-     *
-     * @param searchString     string for searching users, optional
-     * @param limit                    limit, optional
-     * @param offset                   offset, optional
-     */
-    public GetUsersOperation(String searchString, int limit, int offset) {
-        mSearchString = searchString;
-        mLimit = limit;
-        mOffset = offset;
-    }
-
-    @Override
-    protected RemoteOperationResult run(OwnCloudClient client) {
-        GetRemoteUsersOperation operation = new GetRemoteUsersOperation(mSearchString,
-                mLimit, mOffset);
-        RemoteOperationResult result = operation.execute(client);
-
-        return result;
-    }
-}
diff --git a/src/com/owncloud/android/operations/GetUsersOrGroupsOperation.java b/src/com/owncloud/android/operations/GetUsersOrGroupsOperation.java
new file mode 100644 (file)
index 0000000..6ac4ade
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   @author masensio
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package com.owncloud.android.operations;
+
+import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.resources.users.GetRemoteUsersOrGroupsOperation;
+import com.owncloud.android.operations.common.SyncOperation;
+
+/**
+ * Get the users from the server
+ */
+public class GetUsersOrGroupsOperation extends SyncOperation{
+
+    private static final String TAG = GetUsersOrGroupsOperation.class.getSimpleName();
+
+    private String mSearchString;
+    private int mLimit;
+    private int mOffset;
+    private boolean mGetGroups;
+
+    /**
+     * Constructor
+     *
+     * @param searchString     string for searching users, optional
+     * @param limit                    limit, optional
+     * @param offset                   offset, optional
+     * @param getGroups         true: for searching groups, false: for searching users
+     */
+    public GetUsersOrGroupsOperation(String searchString, int limit, int offset,
+                                     boolean getGroups) {
+        mSearchString = searchString;
+        mLimit = limit;
+        mOffset = offset;
+        mGetGroups = getGroups;
+    }
+
+    @Override
+    protected RemoteOperationResult run(OwnCloudClient client) {
+        GetRemoteUsersOrGroupsOperation operation =
+                new GetRemoteUsersOrGroupsOperation(mSearchString,
+                mLimit, mOffset, mGetGroups);
+        RemoteOperationResult result = operation.execute(client);
+
+        return result;
+    }
+}