* {@inheritDoc}
*/
public void addChild(Group parent, Group child, boolean broadcast) throws Exception
{
String groupId = "/" + child.getGroupName();
GroupImpl childImpl = (GroupImpl)child;
if (parent != null)
{
Group parentGroup = findGroupById(parent.getId());
if (parentGroup == null)
{
throw new InvalidNameException("Can't add node to not existed parent " + parent.getId());
}
groupId = parentGroup.getId() + "/" + child.getGroupName();
childImpl.setParentId(parentGroup.getId());
}
else if (child.getId() != null)
{
groupId = child.getId();
}
Object o = findGroupById(groupId);
if (o != null)
{
Object[] args = {child.getGroupName()};
throw new UniqueObjectException("OrganizationService.unique-group-exception", args);
}
childImpl.setId(groupId);
if (broadcast)
preSave(child, true);
Session session = service_.openSession();