* @param claimValues The claim values of the person
* @param userId id of the person
* @return The Person object with attribute values added
*/
private Person getPersonWithClaims(Map<String, String> claimValues, String userId) {
Person person;
String displayName = claimValues.get(SocialImplConstants.CLAIM_URI_DISPLAY_NAME);
Name userName = new NameImpl();
userName.setGivenName(claimValues.get(SocialImplConstants.CLAIM_URI_GIVEN_NAME));
userName.setFamilyName(claimValues.get(SocialImplConstants.CLAIM_URI_FAMILY_NAME));
person = new PersonImpl(userId, displayName, userName);
String value;
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_NICK_NAME)) != null) {
person.setNickname(value);
}
Organization org = new OrganizationImpl();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_ORGANIZATION)) != null) {
org.setName(value);
}
List<Organization> orgsList = new ArrayList<Organization>();
orgsList.add(org);
person.setOrganizations(orgsList);
Address address = new AddressImpl();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_STREET_ADDRESS)) != null) {
address.setStreetAddress(value);
}
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_REGION)) != null) {
address.setRegion(value);
}
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_COUNTRY)) != null) {
address.setCountry(value);
}
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_LATITUDE)) != null) {
address.setLatitude(Float.valueOf(value));
}
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_LONGITUDE)) != null) {
address.setLongitude(Float.valueOf(value));
}
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_POSTAL_CODE)) != null) {
address.setPostalCode(value);
}
List<Address> addressList = new ArrayList<Address>();
addressList.add(address);
person.setAddresses(addressList);
List<ListField> emailList = new ArrayList<ListField>();
ListField email = new ListFieldImpl();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_EMAIL)) != null) {
email.setValue(value);
}
emailList.add(email);
person.setEmails(emailList);
List<ListField> phoneNumberList = new ArrayList<ListField>();
ListField phoneNumber = new ListFieldImpl();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_PHONE_NUMBER)) != null) {
phoneNumber.setValue(value);
}
phoneNumberList.add(phoneNumber);
person.setPhoneNumbers(phoneNumberList);
List<ListField> imList = new ArrayList<ListField>();
ListField im = new ListFieldImpl();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_IM)) != null) {
im.setValue(value);
}
imList.add(im);
person.setIms(imList);
List<Url> urlList = new ArrayList<Url>();
Url url = new UrlImpl();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_URL)) != null) {
url.setValue(value);
}
urlList.add(url);
person.setUrls(urlList);
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_ABOUT_ME)) != null) {
person.setAboutMe(value);
}
Date birthday = new Date();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_BIRTHDAY)) != null) {
birthday.setTime(Long.valueOf(value));
}
person.setBirthday(birthday);
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_RELATIONSHIP_STATUS)) != null) {
person.setRelationshipStatus(value);
}
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_RELIGIOUS_VIEW)) != null) {
person.setReligion(value);
}
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_ETHNICITY)) != null) {
person.setEthnicity(value);
}
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_GENDER)) != null) {
person.setGender(Person.Gender.valueOf(value));
}
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_POLITICAL_VIEW)) != null) {
person.setPoliticalViews(value);
}
List<String> interest = new ArrayList<String>();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_INTERESTS)) != null) {
interest.add(value);
}
person.setInterests(interest);
List<String> books = new ArrayList<String>();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_BOOKS)) != null) {
books.add(value);
}
person.setBooks(books);
person.setJobInterests(claimValues.get(SocialImplConstants.CLAIM_URI_JOB_INTERESTS));
List<String> languageSpoken = new ArrayList<String>();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_LANGUAGE_SPOKEN)) != null) {
languageSpoken.add(value);
}
person.setLanguagesSpoken(languageSpoken);
List<String> movieList = new ArrayList<String>();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_MOVIES)) != null) {
movieList.add(value);
}
person.setMovies(movieList);
List<String> musicList = new ArrayList<String>();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_MUSIC)) != null) {
musicList.add(value);
}
person.setMusic(musicList);
List<String> quotesList = new ArrayList<String>();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_QUOTES)) != null) {
quotesList.add(value);
}
person.setQuotes(quotesList);
person.setHappiestWhen(claimValues.get(SocialImplConstants.CLAIM_URI_HAPPIEST_WHEN));
List<Enum<LookingFor>> lookingFor = new ArrayList<Enum<LookingFor>>();
if ((value = claimValues.get(SocialImplConstants.CLAIM_URI_LOOKING_FOR)) != null) {
lookingFor.add(LookingFor.valueOf(value));
}
person.setLookingFor(lookingFor);
return person;
}