1 /*
2 * Copyright (C) 2003-2014 eXo Platform SAS.
3 *
4 * This is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as
6 * published by the Free Software Foundation; either version 3 of
7 * the License, or (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this software; if not, write to the Free
16 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
18 */
19 package org.exoplatform.ui.login.tasks;
20
21 import org.exoplatform.utils.ExoConnectionUtils;
22
23 import android.os.AsyncTask;
24
25 /**
26 * Created by The eXo Platform SAS Author : Philippe Aristote
27 * paristote@exoplatform.com Jun 25, 2014
28 */
29 public class CheckAccountExistsTask extends AsyncTask<String, Void, Boolean> {
30
31 private AsyncTaskListener mListener;
32
33 private static final String TAG = "eXo____CheckAccountExistsTask____";
34
35 @Override
36 protected Boolean doInBackground(String... params) {
37
38 String username = params[0];
39 String tenant = params[1];
40
41 Boolean result = Boolean.valueOf(ExoConnectionUtils.requestAccountExistsForUser(username, tenant));
42
43 return result;
44 }
45
46 @Override
47 protected void onPostExecute(Boolean result) {
48 if (mListener != null)
49 mListener.onCheckAccountExistsFinished(result.booleanValue());
50 }
51
52 public void setListener(AsyncTaskListener listener) {
53 mListener = listener;
54 }
55
56 public interface AsyncTaskListener {
57
58 void onCheckAccountExistsFinished(boolean result);
59 }
60
61 }