List<Object> jsonAces = getList(json.get(JSON_ACL_ACES));
if (jsonAces != null) {
for (Object obj : jsonAces) {
Map<String, Object> entry = getMap(obj);
if (entry != null) {
AccessControlEntryImpl ace = new AccessControlEntryImpl();
Boolean isDirect = getBoolean(entry, JSON_ACE_IS_DIRECT);
ace.setDirect(isDirect != null ? isDirect.booleanValue() : true);
List<Object> jsonPermissions = getList(entry.get(JSON_ACE_PERMISSIONS));
if (jsonPermissions != null) {
List<String> permissions = new ArrayList<String>();
for (Object perm : jsonPermissions) {
if (perm != null) {
permissions.add(perm.toString());
}
}
ace.setPermissions(permissions);
}
Map<String, Object> jsonPrincipal = getMap(entry.get(JSON_ACE_PRINCIPAL));
if (jsonPrincipal != null) {
AccessControlPrincipalDataImpl principal = new AccessControlPrincipalDataImpl();
principal.setPrincipalId(getString(jsonPrincipal, JSON_ACE_PRINCIPAL_ID));
convertExtension(jsonPrincipal, principal, PRINCIPAL_KEYS);
ace.setPrincipal(principal);
}
convertExtension(entry, ace, ACE_KEYS);
aces.add(ace);