@Override
    protected Void doInBackground(Void... params) {
      // Create the array
      userProfileList = new ArrayList<UserProfile>();
      try {

        // Locate the class table named "Country" in Parse.com
        ParseQuery<ParseUser> query = ParseUser.getQuery();

        Log.d("UserListActivity", "In asynctask.. username - " + currentUser.getUsername());

        query.whereNotEqualTo("username", currentUser.getUsername());

        // by ascending LastName
        query.orderByAscending("lastName");
        ob = query.find();
        for (ParseObject userProfile : ob) {

          UserProfile map = new UserProfile();
          map.setFirstName((String) userProfile.get("firstName"));
          map.setLastName((String) userProfile.get("lastName"));
          map.setDepartment((String) userProfile.get("department"));
          map.setUsername((String) userProfile.get("username"));

          userProfileList.add(map);
        }
      } catch (ParseException e) {
        Log.e("Error", e.getMessage());
        e.printStackTrace();
      }
      return null;
    }
Exemple #2
0
 private UserProfile getUserProfile(Node profileNode) throws Exception {
   UserProfile userProfile = new UserProfile();
   userProfile.setUserId(profileNode.getName());
   PropertyReader reader = new PropertyReader(profileNode);
   userProfile.setScreenName(
       reader.string(
           ForumNodeTypes.EXO_SCREEN_NAME,
           reader.string(ForumNodeTypes.EXO_FULL_NAME, profileNode.getName())));
   userProfile.setFullName(reader.string(ForumNodeTypes.EXO_FULL_NAME));
   userProfile.setFirstName(reader.string(ForumNodeTypes.EXO_FIRST_NAME));
   userProfile.setLastName(reader.string(ForumNodeTypes.EXO_LAST_NAME));
   userProfile.setEmail(reader.string(ForumNodeTypes.EXO_EMAIL));
   userProfile.setUserRole(reader.l(ForumNodeTypes.EXO_USER_ROLE));
   userProfile.setUserTitle(reader.string(ForumNodeTypes.EXO_USER_TITLE, ""));
   userProfile.setSignature(reader.string(ForumNodeTypes.EXO_SIGNATURE));
   userProfile.setTotalPost(reader.l(ForumNodeTypes.EXO_TOTAL_POST));
   userProfile.setTotalTopic(reader.l(ForumNodeTypes.EXO_TOTAL_TOPIC));
   userProfile.setBookmark(reader.strings(ForumNodeTypes.EXO_BOOKMARK));
   userProfile.setLastLoginDate(reader.date(ForumNodeTypes.EXO_LAST_LOGIN_DATE));
   userProfile.setJoinedDate(reader.date(ForumNodeTypes.EXO_JOINED_DATE));
   userProfile.setLastPostDate(reader.date(ForumNodeTypes.EXO_LAST_POST_DATE));
   userProfile.setIsDisplaySignature(reader.bool(ForumNodeTypes.EXO_IS_DISPLAY_SIGNATURE));
   userProfile.setIsDisplayAvatar(reader.bool(ForumNodeTypes.EXO_IS_DISPLAY_AVATAR));
   userProfile.setShortDateFormat(
       reader.string(ForumNodeTypes.EXO_SHORT_DATEFORMAT, userProfile.getShortDateFormat()));
   userProfile.setLongDateFormat(
       reader.string(ForumNodeTypes.EXO_LONG_DATEFORMAT, userProfile.getLongDateFormat()));
   userProfile.setTimeFormat(
       reader.string(ForumNodeTypes.EXO_TIME_FORMAT, userProfile.getTimeFormat()));
   userProfile.setMaxPostInPage(reader.l(ForumNodeTypes.EXO_MAX_POST, 10));
   userProfile.setMaxTopicInPage(reader.l(ForumNodeTypes.EXO_MAX_TOPIC, 10));
   userProfile.setIsShowForumJump(reader.bool(ForumNodeTypes.EXO_IS_SHOW_FORUM_JUMP, true));
   userProfile.setModerateForums(
       reader.strings(ForumNodeTypes.EXO_MODERATE_FORUMS, new String[] {}));
   userProfile.setModerateCategory(
       reader.strings(ForumNodeTypes.EXO_MODERATE_CATEGORY, new String[] {}));
   userProfile.setNewMessage(reader.l(ForumNodeTypes.EXO_NEW_MESSAGE));
   userProfile.setTimeZone(reader.d(ForumNodeTypes.EXO_TIME_ZONE));
   userProfile.setIsBanned(reader.bool(ForumNodeTypes.EXO_IS_BANNED));
   userProfile.setBanUntil(reader.l(ForumNodeTypes.EXO_BAN_UNTIL));
   userProfile.setBanReason(reader.string(ForumNodeTypes.EXO_BAN_REASON, ""));
   userProfile.setBanCounter(Integer.parseInt(reader.string(ForumNodeTypes.EXO_BAN_COUNTER, "0")));
   userProfile.setBanReasonSummary(
       reader.strings(ForumNodeTypes.EXO_BAN_REASON_SUMMARY, new String[] {}));
   userProfile.setCreatedDateBan(reader.date(ForumNodeTypes.EXO_CREATED_DATE_BAN));
   return userProfile;
 }