{
UIRegisterForm registerForm = event.getSource();
OrganizationService orgService = registerForm.getApplicationComponent(OrganizationService.class);
UIRegisterInputSet registerInput = registerForm.getChild(UIRegisterInputSet.class);
UIFormStringInput userNameInput = registerInput.getUIStringInput(UIRegisterInputSet.USER_NAME);
MandatoryValidator validator = new MandatoryValidator();
try
{
validator.validate(userNameInput);
}
catch (MessageException e)
{
event.getRequestContext().getUIApplication().addMessage(e.getDetailMessage());
return;