Share the file with a user or group when selected on the list of suggestions
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / GetUsersOrGroupsOperation.java
1 /**
2 * ownCloud Android client application
3 *
4 * @author masensio
5 * Copyright (C) 2015 ownCloud Inc.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2,
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20 package com.owncloud.android.operations;
21
22 import com.owncloud.android.lib.common.OwnCloudClient;
23 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
24 import com.owncloud.android.lib.resources.shares.GetRemoteShareesOperation;
25 import com.owncloud.android.operations.common.SyncOperation;
26
27 /**
28 * Get the users from the server
29 */
30 public class GetUsersOrGroupsOperation extends SyncOperation{
31
32 private static final String TAG = GetUsersOrGroupsOperation.class.getSimpleName();
33
34 private String mSearchString;
35 private int mLimit;
36 private int mOffset;
37 private boolean mGetGroups;
38
39 /**
40 * Constructor
41 *
42 * @param searchString string for searching users, optional
43 * @param limit limit, optional
44 * @param offset offset, optional
45 * @param getGroups true: for searching groups, false: for searching users
46 */
47 public GetUsersOrGroupsOperation(String searchString, int limit, int offset,
48 boolean getGroups) {
49 mSearchString = searchString;
50 mLimit = limit;
51 mOffset = offset;
52 mGetGroups = getGroups;
53 }
54
55 @Override
56 protected RemoteOperationResult run(OwnCloudClient client) {
57 GetRemoteShareesOperation operation =
58 new GetRemoteShareesOperation(mSearchString,
59 mOffset, mLimit);
60 RemoteOperationResult result = operation.execute(client);
61
62 return result;
63 }
64 }