private static Logger log = Logger.getLogger(PageStandardAction.class);
@Override
public void readForm(PageStandardForm form, ActionMessages errors, HttpServletRequest request)
{
UserVO user = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
UserVO editUser = (UserVO) getPanel().getEntity();
boolean isActiveUser = false;
if(getPanel().getAttribute("isActiveUser") != null)
isActiveUser = (Boolean)getPanel().getAttribute("isActiveUser");
boolean isLdapUser = (Boolean)getPanel().getAttribute("isLdapUser");
if(!isLdapUser) {
editUser.setUserName(form.getUserName());
if(!isActiveUser)
editUser.getProfile().setLocked(form.isLocked());
editUser.getProfile().setTimeLock(form.getTimeLock());
editUser.getProfile().setIpPattern(form.getIpPattern());
if(!isActiveUser) {
SimpleDateFormat sdf = new SimpleDateFormat(MessageUtil.message(request, "default.format.input.dateTime"));
try
{
if(form.getValidFrom() != null)
editUser.getProfile().setValidFrom(sdf.parse(form.getValidFrom()));
else
editUser.getProfile().setValidFrom(null);
if(form.getValidUntil() != null)
editUser.getProfile().setValidUntil(sdf.parse(form.getValidUntil()));
else
editUser.getProfile().setValidUntil(null);
}
catch (ParseException e)
{
log.error("problems parsing event time validFrom/validUntil", e);
}
}
if (form.getUserPassword() != null && !isActiveUser)
editUser.setPassword(SignatureUtility.getInstance().createSignature(form.getUserPassword()));
if (form.getMainUsergroupId() > 0)
{
Iterator<UsergroupVO> usergroups = editUser.getProfile().getUsergroups().iterator();
while (usergroups.hasNext())
{
UsergroupVO usergroup = usergroups.next();
if (usergroup.getId() == form.getMainUsergroupId())
{
editUser.getProfile().setDefaultUsergroup(usergroup);
break;
}
}
}
}
editUser.setLocale(LocaleUtility.parseLocale(form.getLocale()));
}