UIGroupManagement uiGroupManagement = this.getParent();
UIBreadcumbs uiBreadcumb = uiGroupManagement.getChild(UIBreadcumbs.class);
uiBreadcumb.setPath(getPath(null, groupId));
UITree uiTree = getChild(UITree.class);
UIGroupDetail uiGroupDetail = uiGroupManagement.getChild(UIGroupDetail.class);
UIGroupInfo uiGroupInfo = uiGroupDetail.getChild(UIGroupInfo.class);
if (groupId == null)
{
sibblingsGroup_ = service.getGroupHandler().findGroups(null);
// if not administrator
if (!GroupManagement.isAdministrator(null))
sibblingsGroup_ = GroupManagement.getRelatedGroups(null, sibblingsGroup_);
uiTree.setSibbling((List)convertGroups(sibblingsGroup_));
uiTree.setSelected(null);
uiTree.setChildren(null);
uiTree.setParentSelected(null);
selectedGroup_ = null;
uiGroupInfo.setGroup(null);
return;
}
if (groupId != null)
{
selectedGroup_ = service.getGroupHandler().findGroupById(groupId);
}
else
{
selectedGroup_ = null;
}
String parentGroupId = null;
if (selectedGroup_ != null)
parentGroupId = selectedGroup_.getParentId();
Group parentGroup = null;
if (parentGroupId != null)
parentGroup = service.getGroupHandler().findGroupById(parentGroupId);
childrenGroup_ = service.getGroupHandler().findGroups(selectedGroup_);
sibblingsGroup_ = service.getGroupHandler().findGroups(parentGroup);
// if not administrator
if (!GroupManagement.isAdministrator(null))
{
childrenGroup_ = GroupManagement.getRelatedGroups(null, childrenGroup_);
sibblingsGroup_ = GroupManagement.getRelatedGroups(null, sibblingsGroup_);
}
for (Object group : sibblingsGroup_)
{
if (selectedGroup_ != null && ((Group)group).getId().equals(selectedGroup_.getId()))
{
selectedGroup_ = (Group)group;
break;
}
}
uiGroupInfo.setGroup(selectedGroup_);
uiTree.setSibbling((List)convertGroups(sibblingsGroup_));
uiTree.setChildren((List)convertGroups(childrenGroup_));
uiTree.setSelected(new UIGroup(selectedGroup_));
uiTree.setParentSelected(parentGroup);
}