@SuppressWarnings("unchecked")
Iterator<IGroupMember> members = (Iterator<IGroupMember>) entityGroup.getMembers();
entity = populateChildren(entity,members);
}
IAuthorizationPrincipal authP = getPrincipalForEntity(entity);
Principal principal = new PrincipalImpl(authP.getKey(), authP.getPrincipalString());
entity.setPrincipal(principal);
return entity;
}
}
// otherwise use the getGroupMember method
else {
IGroupMember groupMember = GroupService.getGroupMember(entityId, entityEnum.getClazz());
if(groupMember == null || groupMember instanceof IEntityGroup) {
return null;
}
Entity entity = EntityFactory.createEntity(groupMember,entityEnum);
// the group member interface doesn't include the entity name, so
// we'll need to look that up manually
entity.setName(lookupEntityName(entity));
if (EntityEnum.GROUP.toString().equals(entity.getEntityType()) || EntityEnum.PERSON.toString().equals(entity.getEntityType())) {
IAuthorizationPrincipal authP = getPrincipalForEntity(entity);
Principal principal = new PrincipalImpl(authP.getKey(), authP.getPrincipalString());
entity.setPrincipal(principal);
}
return entity;
}