JBoss.orgCommunity Documentation
When you start the Tomcat, the DefaultContactProvider class will be initialized and the OrganizationService component is set within the DefaultContactProvider component.
The DefaultContactProvider class allows you to get user information via the OrganizationService component.
public CommonContact getCommonContact(String userId) {
CommonContact contact = new CommonContact();
try {
User user = orgService.getUserHandler().findUserByName(userId);
UserProfile profile = orgService.getUserProfileHandler().findUserProfileByName(userId);
contact.setEmailAddress(user.getEmail());
contact.setFirstName(user.getFirstName());
contact.setLastName(user.getLastName());
if(profile.getUserInfoMap() != null) {
contact.setAvatarUrl(profile.getAttribute("user.other-info.avatar.url"));
contact.setBirthday(profile.getAttribute("user.bdate"));
contact.setCity(profile.getAttribute("user.home-info.postal.city"));
contact.setCountry(profile.getAttribute("user.home-info.postal.country"));
contact.setGender(profile.getAttribute("user.gender"));
contact.setJob(profile.getAttribute("user.jobtitle"));
contact.setMobile(profile.getAttribute("user.home-info.telecom.mobile.number"));
contact.setPhone(profile.getAttribute("user.business-info.telecom.telephone.number"));
contact.setWebSite(profile.getAttribute("user.home-info.online.uri"));
}
} catch (Exception e) {
log.error("Could not retrieve forum user profile for " + userId + ": " ,e);
}
return contact;
}
The information which is get by the user includes:
Name | Type | Description |
---|---|---|
String
| Email of user. | |
firstName |
String
| First name of user. |
lastName |
String
| Last name of user. |
The information which is get via UserProfile includes:
Attribute | Type | Description |
---|---|---|
user.other-info.avatar.url | String | The path containing the user's avatar. |
user.bdate | String | The user's birthday. |
user.home-info.postal.city | String | The home city of user. |
user.home-info.postal.country | String | The home country of user. |
user.gender | String | The user's gender. |
user.jobtitle | String | The user's job. |
user.home-info.telecom. mobile.number | String | The home phone number of user. |
user.business-info.telecom. telephone.number | String | The mobile number of user. |
user.home-info.online.uri | String | The individual websites of user. |