Skip to content

Commit

Permalink
fix for MID-4744 GUI User Preview - Old Administrative Status in proj…
Browse files Browse the repository at this point in the history
…ection always (unknown)
  • Loading branch information
katkav committed Sep 10, 2018
1 parent 01f7d8a commit 080ec14
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Expand Up @@ -1178,10 +1178,29 @@ public void merge(ItemDelta<V,D> deltaToMerge) {
mergeValuesToDelete(PrismValue.cloneValues(deltaToMerge.valuesToDelete));
}
}

if (CollectionUtils.isNotEmpty(deltaToMerge.estimatedOldValues)) {
mergeOldValues(PrismValue.cloneValues(deltaToMerge.estimatedOldValues));
}

// We do not want to clean up the sets during merging (e.g. in removeValue methods) because the set
// may become empty and the a values may be added later. So just clean it up when all is done.
removeEmptySets();
}

private void mergeOldValues(Collection<V> oldValues) {
if (estimatedOldValues == null) {
estimatedOldValues = newValueCollection();
}

for (V oldValue : oldValues) {
if (containsEquivalentValue(estimatedOldValues, oldValue)) {
continue;
}

estimatedOldValues.add(oldValue);
}
}

private void removeEmptySets() {
// Do not remove replace set, even if it is empty.
Expand Down
Expand Up @@ -765,6 +765,7 @@ private <T, F extends FocusType> void reconcileOutboundValue(LensContext<F> cont
}
}

LensUtil.setDeltaOldValue(projCtx, targetItemDelta);
if (!targetItemDelta.isEmpty()) {
LOGGER.trace("Reconciliation delta:\n{}", targetItemDelta.debugDumpLazily(1));
projCtx.swallowToSecondaryDelta(targetItemDelta);
Expand Down

0 comments on commit 080ec14

Please sign in to comment.