} else {
currentGroupId = null;
}
String groupName = "/" + uiGroupForm.getUIStringInput(GROUP_NAME).getValue();
GroupHandler groupHandler = service.getGroupHandler();
if (currentGroupId != null) {
groupName = currentGroupId + groupName;
}
Group newGroup = groupHandler.findGroupById(groupName);
if (newGroup != null) {
Object[] args = { groupName };
UIApplication uiApp = event.getRequestContext().getUIApplication();
uiApp.addMessage(new ApplicationMessage("UIGroupForm.msg.group-exist", args));
return;
}
newGroup = groupHandler.createGroupInstance();
uiGroupForm.invokeSetBindingBean(newGroup);
if (newGroup.getLabel() == null || newGroup.getLabel().trim().length() == 0) {
newGroup.setLabel(newGroup.getGroupName());
}
String changeGroupId;
if (currentGroupId == null) {
groupHandler.addChild(null, newGroup, true);
// uiGroupExplorer.changeGroup(groupName) ;
changeGroupId = groupName;
} else {
Group parrentGroup = groupHandler.findGroupById(currentGroupId);
groupHandler.addChild(parrentGroup, newGroup, true);
// uiGroupExplorer.changeGroup(currentGroupId) ;
changeGroupId = currentGroupId;
}
// change group