public static CmisAccessControlListType convert(Acl acl) {
if (acl == null) {
return null;
}
CmisAccessControlListType result = new CmisAccessControlListType();
if (acl.getAces() != null) {
for (Ace ace : acl.getAces()) {
if (ace == null) {
continue;
}
CmisAccessControlEntryType entry = new CmisAccessControlEntryType();
if (ace.getPrincipal() != null) {
CmisAccessControlPrincipalType pincipal = new CmisAccessControlPrincipalType();
pincipal.setPrincipalId(ace.getPrincipal().getId());
convertExtension(pincipal, ace.getPrincipal());
entry.setPrincipal(pincipal);
}
entry.setDirect(ace.isDirect());
entry.getPermission().addAll(ace.getPermissions());
convertExtension(ace, entry);
result.getPermission().add(entry);
}
}
// handle extensions
convertExtension(acl, result);