/** * Works if we are looking e.g. for modification to inducement item, * and delta contains e.g. REPLACE(inducement[1]/validTo, "..."). * * Does NOT work the way around: if we are looking for modification to inducement/validTo and * delta contains e.g. ADD(inducement, ...). In such a case we would need to do more complex processing, * involving splitting value-to-be-added into remainder and offspring delta. It's probably doable, * but some conditions would have to be met, e.g. inducement to be added must have an ID. */ private FactorOutResultSingle<O> factorOutForModifyDelta(Collection<? extends ItemPath> paths, boolean cloneDelta) { checkMutability(); ObjectDeltaImpl<O> remainder = cloneIfRequested(cloneDelta); ObjectDeltaImpl<O> offspring = null; List<ItemDelta<?, ?>> modificationsFound = new ArrayList<>(); for (Iterator<? extends ItemDelta<?, ?>> iterator = remainder.modifications.iterator(); iterator.hasNext(); ) { ItemDelta<?, ?> modification = iterator.next(); if (ItemPathCollectionsUtil.containsSubpathOrEquivalent(paths, modification.getPath())) { modificationsFound.add(modification); iterator.remove(); } } if (!modificationsFound.isEmpty()) { offspring = createOffspring(); modificationsFound.forEach(offspring::addModification); } return new FactorOutResultSingle<>(remainder, offspring); }
for (ItemDelta itemDelta : deltas) { ItemPath pathToExplain = getPathToExplain(itemDelta); if (pathToExplain == null || ItemPathCollectionsUtil.containsSubpathOrEquivalent(alreadyExplained, pathToExplain)) { continue; // null or already processed
if (visitable instanceof PrismReferenceValue) { PrismReferenceValue value = (PrismReferenceValue) visitable; if (!ItemPathCollectionsUtil.containsSubpathOrEquivalent(pathsToResolve, value.getPath())) { return;
assertTrue(ItemPathCollectionsUtil.containsSubpathOrEquivalent(onlyEmpty, pathFoo)); assertTrue(ItemPathCollectionsUtil.containsSubpath(onlyEmpty, pathFoo)); assertFalse(ItemPathCollectionsUtil.containsSuperpathOrEquivalent(onlyEmpty, pathFoo)); assertFalse(ItemPathCollectionsUtil.containsSuperpath(onlyEmpty, pathFoo)); assertTrue(ItemPathCollectionsUtil.containsSubpathOrEquivalent(onlyEmpty, empty)); assertFalse(ItemPathCollectionsUtil.containsSubpath(onlyEmpty, empty)); assertTrue(ItemPathCollectionsUtil.containsSuperpathOrEquivalent(onlyEmpty, empty)); assertFalse(ItemPathCollectionsUtil.containsSuperpath(onlyEmpty, empty)); assertTrue(ItemPathCollectionsUtil.containsSubpathOrEquivalent(onlyFoo, pathFoo)); assertFalse(ItemPathCollectionsUtil.containsSubpath(onlyFoo, pathFoo)); assertTrue(ItemPathCollectionsUtil.containsSuperpathOrEquivalent(onlyFoo, pathFoo)); assertFalse(ItemPathCollectionsUtil.containsSuperpath(onlyFoo, pathFoo)); assertFalse(ItemPathCollectionsUtil.containsSubpathOrEquivalent(onlyFoo, empty)); assertFalse(ItemPathCollectionsUtil.containsSubpath(onlyFoo, empty)); assertTrue(ItemPathCollectionsUtil.containsSuperpathOrEquivalent(onlyFoo, empty)); assertTrue(ItemPathCollectionsUtil.containsSuperpath(onlyFoo, empty)); assertFalse(ItemPathCollectionsUtil.containsSubpathOrEquivalent(onlyFoo, pathZoo)); assertFalse(ItemPathCollectionsUtil.containsSubpath(onlyFoo, pathZoo)); assertFalse(ItemPathCollectionsUtil.containsSuperpathOrEquivalent(onlyFoo, pathZoo)); assertFalse(ItemPathCollectionsUtil.containsSuperpath(onlyFoo, pathZoo)); assertFalse(ItemPathCollectionsUtil.containsSubpathOrEquivalent(onlyFooBar, pathFoo)); assertFalse(ItemPathCollectionsUtil.containsSubpath(onlyFooBar, pathFoo)); assertTrue(ItemPathCollectionsUtil.containsSuperpathOrEquivalent(onlyFooBar, pathFoo)); assertTrue(ItemPathCollectionsUtil.containsSuperpath(onlyFooBar, pathFoo));