String newName = event.getProperties().getProperty("newName");
String newFirstName = event.getProperties().getProperty("newFirstName");
String newLastName = event.getProperties().getProperty("newLastName");
String newEmail = event.getProperties().getProperty("newEmail");
AktarioUserManager aktarioUserManager = (AktarioUserManager) Engine.instance().getManager("AktarioUserManager");
AktarioUserRegistry aktarioUserRegistry = aktarioUserManager.getUserRegistry();
AktarioUser aktarioUser = aktarioUserRegistry.getUserByName(oldName);
if (aktarioUser != null)
{
aktarioUser.setAttribute("name", newName);
if (StringTools.isNotTrimEmpty(newEmail))
{
aktarioUser.setEmail(newEmail);
}
if (StringTools.isNotTrimEmpty(newFirstName) || StringTools.isNotTrimEmpty(newLastName))
{
StringBuilder newFullName = new StringBuilder(StringTools.trim(newFirstName));
StringTools.appendWithDelimiter(newFullName, StringTools.trim(newLastName), " ");
aktarioUser.setFullName(newFullName.toString());
}
aktarioUserManager.modifyUser(aktarioUser, oldName);
}
}