if (permissionStore.getCount() > 0)
{
Set<Permission> permissions = new HashSet<Permission>(permissionStore.getCount());
for (PermissionData data : permissionStore.getModels())
{
Permission permission = (Permission)data.get(Constants.PERMISSION);
String newAccessLevel = ((AccessLevel)data.get(Constants.ACCESSLEVEL)).name();
if (!newAccessLevel.equals(permission.getAccessLevel()))
{
// if user changed the access level value in the GUI, treat it like a new permission
permission = new Permission(permission.getSubject(), AccessLevel.valueOf(newAccessLevel));
}
permissions.add(permission);
}
permissionListener.doPermissionsChanged(permissions);
hide();