Skip to content

Commit

Permalink
[SYNCOPE-1387] Clearing up calls between link() and update()
Browse files Browse the repository at this point in the history
  • Loading branch information
ilgrosso committed Oct 23, 2018
1 parent 292006e commit 6bb67af
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ private void create(
finalize(operation, resultStatus, null, output, delta);
}

private List<ProvisioningReport> update(final SyncDelta delta, final List<String> keys)
private List<ProvisioningReport> update(final SyncDelta delta, final List<String> keys, final boolean inLink)
throws JobExecutionException {

if (!profile.getTask().isPerformUpdate()) {
Expand Down Expand Up @@ -314,8 +314,10 @@ private List<ProvisioningReport> update(final SyncDelta delta, final List<String
output = null;
} else {
try {
for (PullActions action : profile.getActions()) {
action.beforeUpdate(profile, delta, before, null);
if (!inLink) {
for (PullActions action : profile.getActions()) {
action.beforeUpdate(profile, delta, before, null);
}
}

PropagationByResource propByRes = binder.update(realm, before);
Expand Down Expand Up @@ -414,15 +416,17 @@ private List<ProvisioningReport> deprovision(final SyncDelta delta, final List<S
propByRes.add(ResourceOperation.DELETE, profile.getTask().getResource().getKey());
taskExecutor.execute(propagationManager.createTasks(realm, propByRes, null), false);

RealmTO realmTO;
if (unlink) {
realm.getResources().remove(profile.getTask().getResource());
output = binder.getRealmTO(realmDAO.save(realm), true);
realmTO = binder.getRealmTO(realmDAO.save(realm), true);
} else {
output = binder.getRealmTO(realm, true);
realmTO = binder.getRealmTO(realm, true);
}
output = realmTO;

for (PullActions action : profile.getActions()) {
action.after(profile, delta, RealmTO.class.cast(output), result);
action.after(profile, delta, realmTO, result);
}

resultStatus = Result.SUCCESS;
Expand Down Expand Up @@ -510,11 +514,7 @@ private List<ProvisioningReport> link(final SyncDelta delta, final List<String>
} else {
realm.add(profile.getTask().getResource());
}
output = update(delta, Collections.singletonList(key));

for (PullActions action : profile.getActions()) {
action.after(profile, delta, RealmTO.class.cast(output), result);
}
output = update(delta, Collections.singletonList(key), true);

resultStatus = Result.SUCCESS;

Expand Down Expand Up @@ -687,8 +687,8 @@ private void doHandle(final SyncDelta delta, final OrgUnit orgUnit) throws JobEx
if (keys.size() > 1) {
switch (profile.getConflictResolutionAction()) {
case IGNORE:
throw new IgnoreProvisionException("More than one match found for "
+ processed.getObject().getUid().getUidValue() + ": " + keys);
throw new IgnoreProvisionException("More than one match found for "
+ processed.getObject().getUid().getUidValue() + ": " + keys);

case FIRSTMATCH:
keys = keys.subList(0, 1);
Expand Down Expand Up @@ -725,7 +725,7 @@ private void doHandle(final SyncDelta delta, final OrgUnit orgUnit) throws JobEx
} else {
switch (profile.getTask().getMatchingRule()) {
case UPDATE:
profile.getResults().addAll(update(processed, keys));
profile.getResults().addAll(update(processed, keys, false));
break;

case DEPROVISION:
Expand Down

0 comments on commit 6bb67af

Please sign in to comment.