GetUsersOrGroupsOperation.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. import com.owncloud.android.lib.common.OwnCloudClient;
  22. import com.owncloud.android.lib.common.operations.RemoteOperationResult;
  23. import com.owncloud.android.lib.resources.shares.GetRemoteShareesOperation;
  24. import com.owncloud.android.operations.common.SyncOperation;
  25. /**
  26. * Get the users from the server
  27. */
  28. public class GetUsersOrGroupsOperation extends SyncOperation{
  29. private static final String TAG = GetUsersOrGroupsOperation.class.getSimpleName();
  30. private String mSearchString;
  31. private int mLimit;
  32. private int mOffset;
  33. private boolean mGetGroups;
  34. /**
  35. * Constructor
  36. *
  37. * @param searchString string for searching users, optional
  38. * @param limit limit, optional
  39. * @param offset offset, optional
  40. * @param getGroups true: for searching groups, false: for searching users
  41. */
  42. public GetUsersOrGroupsOperation(String searchString, int limit, int offset,
  43. boolean getGroups) {
  44. mSearchString = searchString;
  45. mLimit = limit;
  46. mOffset = offset;
  47. mGetGroups = getGroups;
  48. }
  49. @Override
  50. protected RemoteOperationResult run(OwnCloudClient client) {
  51. GetRemoteShareesOperation operation =
  52. new GetRemoteShareesOperation(mSearchString,
  53. mLimit, mOffset);
  54. RemoteOperationResult result = operation.execute(client);
  55. return result;
  56. }
  57. }