log.error(msg);
throw new Exception(msg);
}
int tenantId = registry.getTenantId();
// get the tenant information from the tenant manager
Tenant tenant;
try {
tenant = (Tenant) tenantManager.getTenant(tenantId);
} catch (UserStoreException e) {
String msg = "Error in retrieving the tenant information for the tenant id: " +
tenantId + ".";
log.info(msg, e);
throw new Exception(msg, e);
}
RealmService realmService = Util.getRealmService();
try {
Map<String, String> claimsMap = new HashMap<String, String>();
claimsMap.put(UserCoreConstants.ClaimTypeURIs.GIVEN_NAME,
accountInfoBean.getFirstname());
claimsMap.put(UserCoreConstants.ClaimTypeURIs.SURNAME, accountInfoBean.getLastname());
UserStoreManager userStoreManager =
(UserStoreManager) realmService.getTenantUserRealm(tenantId)
.getUserStoreManager();
userStoreManager.setUserClaimValues(
ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, tenantId),
claimsMap, UserCoreConstants.DEFAULT_PROFILE);
log.info("FirstName: " + accountInfoBean.getFirstname() +
" has been updated to the tenant admin " +
ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, tenantId) + " of " +
tenant.getDomain());
return true;
} catch (Exception e) {
// this is expected, as many users haven't given their fullnames
// during their registration.
String msg =