"CHAN_ID." + String.valueOf(form.getId()));
for (int mp = 0; mp < prins.length; mp++) {
JsonEntityBean bean;
// first assume this is a group
IEntityGroup group = GroupService.findGroup(prins[mp].getKey());
if (group != null) {
bean = new JsonEntityBean(group, EntityEnum.GROUP.toString());
}
// if a matching group can't be found, try to find a matching
// non-group entity
else {
IGroupMember member = AuthorizationService.instance().getGroupMember(prins[mp]);
bean = new JsonEntityBean(member, EntityEnum.PERSON.toString());
String name = groupListHelper.lookupEntityName(bean);
bean.setName(name);
}
form.addGroup(bean);
}
} catch (GroupsException e) {
e.printStackTrace();
}
}
// otherwise, if this is a new channel, pre-populate the categories
// and groups with some reasonable defaults
else {
// pre-populate with top-level category
IEntityGroup channelCategoriesGroup = GroupService.getDistinguishedGroup(GroupService.CHANNEL_CATEGORIES);
form.addCategory(new JsonEntityBean(channelCategoriesGroup, groupListHelper.getEntityType(channelCategoriesGroup)));
// pre-populate with top-level group
IEntityGroup everyoneGroup = GroupService.getDistinguishedGroup(GroupService.EVERYONE);
form.addGroup(new JsonEntityBean(everyoneGroup, groupListHelper.getEntityType(everyoneGroup)));
}
return form;
}