@SuppressWarnings("unchecked")
public void setMembership(String groupId, String membershipType) throws Exception {
if (groupId.trim().length() < 1 || membershipType.trim().length() < 1) {
return;
}
Permission permission = new Permission();
permission.setExpression(membershipType + ":" + groupId);
permission.setGroupId(groupId);
permission.setMembership(membershipType);
List<Object> list = new ArrayList<Object>();
UIPageIterator uiIterator = getChild(UIGrid.class).getUIPageIterator();
list.addAll(uiIterator.getPageList().getAll());
if (existsPermission(list, permission)) {
return;