예제 #1
0
  public static String getProfileDetails(HttpSession session) {
    Profile profile = (Profile) session.getAttribute("profile");
    if (profile == null) return "";
    String email = profile.getEmail();
    String fullName = profile.getFullName();
    String firstName = profile.getFirstName();
    String lastName = profile.getLastName();
    String location = profile.getLocation();
    String gender = profile.getGender();
    String image = profile.getProfileImageURL();
    String displayName = profile.getDisplayName();
    String validatedId = profile.getValidatedId();
    String providerId = profile.getProviderId();

    if (null == fullName) fullName = firstName + " " + lastName;
    String dob = "";
    if (profile.getDob() != null) {
      BirthDate bd = profile.getDob();
      dob = bd.toString();
    }

    StringBuffer basicJs = new StringBuffer();
    basicJs.append("<script> \n");
    basicJs.append("\tvar _email = '").append(email).append("'; \n");
    basicJs.append("\tvar _fullName = '").append(fullName).append("'; \n");
    basicJs.append("\tvar _dob = '").append(dob).append("'; \n");
    basicJs.append("\tvar _gender = '").append(gender).append("'; \n");
    basicJs.append("\tvar _location = '").append(location).append("'; \n");
    basicJs.append("\tvar _image = '").append(image).append("'; \n");
    basicJs.append("\tvar _displayName = '").append(displayName).append("'; \n");
    basicJs.append("\tvar _validatedId = '").append(validatedId).append("'; \n");
    basicJs.append("\tvar _providerId = '").append(providerId).append("'; \n");
    basicJs.append("</script> \n");

    return basicJs.toString();
  }
예제 #2
0
 public static String getUserIdFromSessionId(String sessionId) {
   Profile profile = getUserProfileFromSessionId(sessionId);
   if (profile == null) return null;
   return profile.getProviderId();
 }