final Set<String> vAttrsToBeRemoved, final Set<AttributeMod> vAttrsToBeUpdated,
final PropagationByResource propByRes, final Collection<String> noPropResourceNames,
final Set<MembershipMod> membershipsToAdd)
throws NotFoundException {
AbstractAttributableDataBinder binder = subject instanceof SyncopeUser
? userDataBinder : roleDataBinder;
PropagationByResource localPropByRes = binder.fillVirtual(subject, vAttrsToBeRemoved == null
? Collections.<String>emptySet()
: vAttrsToBeRemoved, vAttrsToBeUpdated == null
? Collections.<AttributeMod>emptySet()
: vAttrsToBeUpdated, AttributableUtil.getInstance(subject));
// SYNCOPE-458 fill membership virtual attributes
if (subject instanceof SyncopeUser) {
final SyncopeUser user = (SyncopeUser) subject;
for (Membership membership : user.getMemberships()) {
if (membership.getVirAttrs() != null && !membership.getVirAttrs().isEmpty()) {
final MembershipMod membershipMod = findMembershipMod(membership, membershipsToAdd);
if (membershipMod != null) {
binder.fillVirtual(membership, membershipMod.getVirAttrsToRemove() == null
? Collections.<String>emptySet()
: membershipMod.getVirAttrsToRemove(),
membershipMod.getVirAttrsToUpdate() == null ? Collections.<AttributeMod>emptySet()
: membershipMod.getVirAttrsToUpdate(), AttributableUtil.getInstance(
AttributableType.MEMBERSHIP));