public void setDisplayNameOfUser(String userKey, String displayName){
final String logp = CN + " :: setDisplayNameOfUser - ";
LOGGER.log(Level.FINEST, logp + "START");
HashMap<String, Object> modifyMap = new HashMap<String, Object>();
//get user manager service
UserManager usrService = Platform.getService(UserManager.class);
//create display name map
HashMap displayNameMap = new HashMap();
displayNameMap.put("base", displayName);
modifyMap.put(UserManagerConstants.AttributeName.DISPLAYNAME.getId(), displayNameMap);
try{
User newUser = new User(userKey, modifyMap);
LOGGER.log(Level.INFO, logp + "User to update :: " + userKey);
UserManagerResult result = usrService.modify(AttributeName.USER_KEY.getId(), userKey, newUser);
LOGGER.log(Level.INFO, logp + "Operations Status :: " + result.getStatus());
}catch(Exception e){
LOGGER.log(Level.SEVERE, logp + "Exception occured :: " ,e.getMessage());
}
Logger.log(Level.FINEST, logp + "END");
}
Happy Learning!!!!
final String logp = CN + " :: setDisplayNameOfUser - ";
LOGGER.log(Level.FINEST, logp + "START");
HashMap<String, Object> modifyMap = new HashMap<String, Object>();
//get user manager service
UserManager usrService = Platform.getService(UserManager.class);
//create display name map
HashMap displayNameMap = new HashMap();
displayNameMap.put("base", displayName);
modifyMap.put(UserManagerConstants.AttributeName.DISPLAYNAME.getId(), displayNameMap);
try{
User newUser = new User(userKey, modifyMap);
LOGGER.log(Level.INFO, logp + "User to update :: " + userKey);
UserManagerResult result = usrService.modify(AttributeName.USER_KEY.getId(), userKey, newUser);
LOGGER.log(Level.INFO, logp + "Operations Status :: " + result.getStatus());
}catch(Exception e){
LOGGER.log(Level.SEVERE, logp + "Exception occured :: " ,e.getMessage());
}
Logger.log(Level.FINEST, logp + "END");
}
Happy Learning!!!!
No comments:
Post a Comment