RoleTreeResource resource)
{
for (String roleId : role.getRoles()) {
try {
Role childRole = authzManager.getRole(roleId);
RoleTreeResource childResource = new RoleTreeResource();
childResource.setId(childRole.getRoleId());
childResource.setName(childRole.getName());
childResource.setType("role");
if (resource != null) {
resource.addChildren(childResource);
}
else {
response.addData(childResource);
}
handleRole(childRole, authzManager, response, childResource);
}
catch (NoSuchRoleException e) {
getLogger().debug("handleRole() failed, roleId: " + roleId + " not found");
}
}
for (String privilegeId : role.getPrivileges()) {
try {
Privilege childPrivilege = authzManager.getPrivilege(privilegeId);
RoleTreeResource childResource = new RoleTreeResource();
childResource.setId(childPrivilege.getId());
childResource.setName(childPrivilege.getName());
childResource.setType("privilege");
if (resource != null) {
resource.addChildren(childResource);
}
else {
response.addData(childResource);