protected RoleTO updateRole(final Long id, SyncDelta delta, final boolean dryRun, final SyncResult result)
throws Exception {
RoleTO roleTO = roleDataBinder.getRoleTO(id);
RoleMod roleMod = connObjectUtil.getAttributableMod(
id, delta.getObject(), roleTO, syncTask, AttributableUtil.getInstance(AttributableType.ROLE));
delta = actions.beforeUpdate(this, delta, roleTO, roleMod);
if (dryRun) {
return roleTO;
}
WorkflowResult<Long> updated = rwfAdapter.update(roleMod);
String roleOwner = null;
for (AttributeMod attrMod : roleMod.getAttributesToBeUpdated()) {
if (attrMod.getSchema().isEmpty()) {
roleOwner = attrMod.getValuesToBeAdded().iterator().next();
}
}
if (roleOwner != null) {
roleOwnerMap.put(updated.getResult(), roleOwner);
}
List<PropagationTask> tasks = propagationManager.getRoleUpdateTaskIds(updated,
roleMod.getVirtualAttributesToBeRemoved(),
roleMod.getVirtualAttributesToBeUpdated(),
Collections.singleton(syncTask.getResource().getName()));
taskExecutor.execute(tasks);
roleTO = roleDataBinder.getRoleTO(updated.getResult());