}
private List<EntityGroup> createAuthorGroups(Collection<INews> input) {
/* Default Group */
EntityGroup gDefault = new EntityGroup(Group.UNKNOWN_AUTHOR.ordinal(), GROUP_CATEGORY_ID, Group.UNKNOWN_AUTHOR.getName());
Map<String, EntityGroup> groupCache = new HashMap<String, EntityGroup>();
groupCache.put(Group.UNKNOWN_AUTHOR.getName(), gDefault);
/* Group Input */
int nextId = Group.UNKNOWN_AUTHOR.ordinal() + AUTHOR_ID_BEGIN;
for (Object object : input) {
if (object instanceof INews) {
INews news = (INews) object;
IPerson author = news.getAuthor();
EntityGroup group = gDefault;
if (author != null) {
String name = author.getName();
if (!StringUtils.isSet(name))
name = Group.UNKNOWN_AUTHOR.getName();
group = groupCache.get(name);
if (group == null) {
group = new EntityGroup(nextId++, GROUP_CATEGORY_ID, name);
groupCache.put(name, group);
}
}
new EntityGroupItem(group, news);