public boolean isApplicable(ItemPath nameOnlyItemPath) { if (allItems) { return true; } for (ItemPath includedItem: includedItems) { if (includedItem.isSubPathOrEquivalent(nameOnlyItemPath)) { return true; } } if (excludedItems.isEmpty()) { return false; } for (ItemPath excludedItem: excludedItems) { CompareResult result = excludedItem.compareComplex(nameOnlyItemPath); // This is tricky. We really want to exclude all related paths: // subpaths, superpaths and (obviously) the item itself // Exclusion of subpaths are quite obtious. // But we also need to exclude superpaths. If we don't to this // then we efficiently grant access to the superpath element which // will also apply to this element - and that would include it. if (result != CompareResult.NO_RELATION) { return false; } } return true; }
boolean keep = false; for (ItemPath newExcludedItem: newExcludedItems) { CompareResult result = newExcludedItem.compareComplex(excludedItem); if (result == CompareResult.SUBPATH || result == CompareResult.EQUIVALENT) {
public boolean hasItemOrSubitemDelta(ItemPath propertyPath) { if (changeType == ChangeType.ADD) { // Easy case. Even if there is a sub-sub-property there must be also a container. Item item = objectToAdd.findItem(propertyPath, Item.class); return item != null; } else if (changeType == ChangeType.MODIFY) { for (ItemDelta<?,?> delta : getModifications()) { CompareResult compare = delta.getPath().compareComplex(propertyPath); if (compare == CompareResult.EQUIVALENT || compare == CompareResult.SUBPATH) { return true; } } } return false; }
public static void accept(Collection<? extends ItemDelta> modifications, Visitor visitor, ItemPath path, boolean recursive) { for (ItemDelta modification: modifications) { ItemPath modPath = modification.getPath(); ItemPath.CompareResult rel = modPath.compareComplex(path); if (rel == ItemPath.CompareResult.EQUIVALENT) { modification.accept(visitor, null, recursive); } else if (rel == ItemPath.CompareResult.SUBPATH) { modification.accept(visitor, path.remainder(modPath), recursive); } } }
Collection<PartiallyResolvedDelta<IV,ID>> deltas = new ArrayList<>(); for (ItemDelta<?,?> modification: modifications) { CompareResult compareComplex = modification.getPath().compareComplex(propertyPath); if (compareComplex == CompareResult.EQUIVALENT) { deltas.add(new PartiallyResolvedDelta<>((ItemDelta<IV, ID>) modification, null));
subDelta = (ItemDelta<IV,ID>) ((ContainerDelta<?>)delta).getSubDelta(path); } else { CompareResult compareComplex = delta.getPath().compareComplex(newResolvePath); if (compareComplex == CompareResult.EQUIVALENT || compareComplex == CompareResult.SUBPATH) { subDelta = (ItemDelta<IV,ID>) delta; Collection<ItemDelta<?,?>> subSubItemDeltas = new ArrayList<>(); for (ItemDelta<?,?> subItemDelta: subItemDeltas) { CompareResult compareComplex = subItemDelta.getPath().compareComplex(subAnyItem.getPath()); if (compareComplex == CompareResult.EQUIVALENT || compareComplex == CompareResult.SUBPATH) { subSubItemDeltas.add(subItemDelta);
for (ItemDelta<?,?> itemDelta: objectDelta.getModifications()) { ItemPath deltaPath = itemDelta.getPath(); ItemPath.CompareResult comparison = deltaPath.compareComplex(SchemaConstants.PATH_ASSIGNMENT); if (comparison == EQUIVALENT) {
for (ItemDelta<?,?> itemDelta: objectDelta.getModifications()) { ItemPath deltaPath = itemDelta.getPath(); CompareResult comparison = deltaPath.compareComplex(SchemaConstants.PATH_ASSIGNMENT); if (comparison == EQUIVALENT) {
CompareResult compareResult = processedPath.compareComplex(itemPath); if (compareResult == CompareResult.EQUIVALENT || compareResult == CompareResult.SUBPATH) { found = true;
public void applyTo(Item item, ParameterizedEquivalenceStrategy strategy) throws SchemaException { ItemPath itemPath = item.getPath(); ItemPath deltaPath = getPath(); CompareResult compareComplex = itemPath.compareComplex(deltaPath); if (compareComplex == CompareResult.EQUIVALENT) { applyToMatchingPath(item, strategy); cleanupAllTheWayUp(item); } else if (compareComplex == CompareResult.SUBPATH) { if (item instanceof PrismContainer<?>) { PrismContainer<?> container = (PrismContainer<?>)item; ItemPath remainderPath = deltaPath.remainder(itemPath); Item subItem = container.findOrCreateItem(remainderPath, getItemClass(), getDefinition()); applyToMatchingPath(subItem, strategy); } else { throw new SchemaException("Cannot apply delta "+this+" to "+item+" as delta path is below the item path and the item is not a container"); } } else if (compareComplex == CompareResult.SUPERPATH) { throw new SchemaException("Cannot apply delta "+this+" to "+item+" as delta path is above the item path"); } else if (compareComplex == CompareResult.NO_RELATION) { throw new SchemaException("Cannot apply delta "+this+" to "+item+" as paths do not match"); } }
ItemPath.CompareResult compareComplex = modification.getPath().compareComplex(path); if (compareComplex == ItemPath.CompareResult.EQUIVALENT) { if (itemDelta != null) {