protected Map.Entry<RoleTO, RoleTO> updateRole(
final Long id, SyncDelta delta, final boolean dryRun, final SyncResult result)
throws Exception {
final RoleTO before = roleDataBinder.getRoleTO(id);
RoleMod roleMod = connObjectUtil.getAttributableMod(
id, delta.getObject(), before, syncTask, AttributableUtil.getInstance(AttributableType.ROLE));
if (dryRun) {
return new AbstractMap.SimpleEntry<RoleTO, RoleTO>(before, before);
}
// Attribute value transformation (if configured)
RoleMod actual = attrTransformer.transform(roleMod);
LOG.debug("Transformed: {}", actual);
delta = actions.beforeUpdate(this, delta, before, roleMod);
WorkflowResult<Long> updated = rwfAdapter.update(actual);
String roleOwner = null;
for (AttributeMod attrMod : actual.getAttributesToBeUpdated()) {
if (attrMod.getSchema().isEmpty()) {
roleOwner = attrMod.getValuesToBeAdded().iterator().next();
}
}
if (roleOwner != null) {
roleOwnerMap.put(updated.getResult(), roleOwner);
}
List<PropagationTask> tasks = propagationManager.getRoleUpdateTaskIds(updated,
actual.getVirtualAttributesToBeRemoved(),
actual.getVirtualAttributesToBeUpdated(),
Collections.singleton(syncTask.getResource().getName()));
taskExecutor.execute(tasks);
final RoleTO after = roleDataBinder.getRoleTO(updated.getResult());
actions.after(this, delta, after, result);
return new AbstractMap.SimpleEntry<RoleTO, RoleTO>(before, after);
}