List<Authorizable> toAdd = new ArrayList();
List<Value> nonExisting = new ArrayList();
for (NodeId originalId : ((Membership) reference).ids) {
NodeId remapped = referenceTracker.getMappedId(originalId);
NodeId id = (remapped == null) ? originalId : remapped;
Authorizable authorz = null;
try {
NodeImpl n = ((SessionImpl) session).getNodeById(id);
authorz = userManager.getAuthorizable(n);
} catch (RepositoryException e) {
// no such node or failed to retrieve authorizable
// warning is logged below.
}
if (authorz != null) {
if (toRemove.remove(authorz.getID()) == null) {
toAdd.add(authorz);
} // else: no need to remove from rep:members
} else {
handleFailure("Ignoring new member of " + gr + ". No such authorizable (NodeID = " + id + ")");
if (importBehavior == ImportBehavior.BESTEFFORT) {
nonExisting.add(session.getValueFactory().createValue(id.toString(), PropertyType.WEAKREFERENCE));
}
}
}
// 2. adjust members of the group