result.setName(JsonInput.getStringOrNull(content, "name"));
return result;
}
public static Role parseRole(JSONObject content) throws JSONException {
final Role role = RoleFactory.create(JsonInput.getIntOrNull(content, "id"));
role.setName(JsonInput.getStringOrNull(content, "name"));
role.setInherited(content.has("inherited")
&& content.getBoolean("inherited"));
if (content.has("permissions")) {
final JSONArray perms = content.getJSONArray("permissions");
final Set<String> permSet = new HashSet<String>();
for (int i = 0; i < perms.length(); i++)
permSet.add(perms.getString(i));
role.addPermissions(permSet);
}
return role;
}